Introduction
Compatible with all Raspberry Pi boards, this camera module has a very good imaging effect both in day and night and works well in low-light environment without infrared fill light; if you are an animal lover, it is really appropriate to use it to record the animal activities at night, especially nocturnal animals like owls, lemurs, and cats.
This module uses Sony 1 / 2.8Inch 2MP STARVIS sensor IMX327 with focal length 4mm, and supports 1080p @ 30fps video. It comes with excellent built-in ISP function, and the output format is uncompressed UYVY, YUV 422-8 bit. In addition, it is also equipped with noise reduction and anti-fog functions to ensure that the captured picture is excellent in both color fidelity and image quality.
This module adopts universal CSI interface, and connects to Raspberry Pi through cable. It also supports adjustable brightness, contrast, sharpness, and saturation, making the output image extremely clear. The camera module can be well suitable for machine vision, intelligent analysis, industrial control, face recognition, ADAS and other fields.
Specification
- Sensor: Sony IMX327LQR-C STARVIS
- Pixels: 2.07m pixels
- Resolution: 1920x1080
- Image Size: Diagonal 6.46mm (Type 1/2.8)
- Unit Cell Size: 2.9um(H)*2.9um(V)
- SNR1s Value: 0.23lx/0.18lx
- Frame Rate: 1080 p@25/1080 p@30 fps
- Exposure: Auto or Manual
- White Balance: Auto or Manual
- Shutter: 1/25(1/30)s to 1/50,000s
- Support Slow Shutter
- Denoising: 2D/3D noise reduction
- Image Setting: Brightness, Contrast, Sharpness, Saturation, Flip, Mirror
- Image Enhancement: BLC, DOL-WDR, Defog
- Day/Night Switch: Manual or IR-CUT filter with external trigger
- Lens: Support M12×0.5 or M16×0.5 depend on lens mount
- Lens Mount: MTV12 or MTV16
- Mounting Hole: 2 screw holes with diameter of 2.2mm Centre distance of 20mm
- PCB Connector: BTB050040-F1D
- Communication Interface: I2C, 3.3VDC
- Video Data Interface: MIPI: 2Lane, CSI2 YUV 422-8bit Data Type, Bandwidth: 1.188Gbps
- IR-CUT Control: IR-CUT motor control, 3.3VDC
- Day/Night External Trigger: compatible with 3.3VDC to 12 VDC
- Operating Conditions: -10℃-50℃, Humidity 95% or less, non-condensing
- Power Supply: 3.3VDC
- Power Consumption: 3.3VDC, 1.2W
- Dimension: 38388mm/1.501.500.31”(not include lens and IR-CUT)
Hardware preparation and installation
Preparation
- Hardware
- Raspberry Pi x1
- Ethernet cable x1
- Micro SD card x1
- HDMI Display x1
- Camera Module x1
- FFC Connector x1
- Dupont Wires
As shown in the figure below, connect the camera module onto the Raspberry Pi board with a FFC connector and Dupont wires (black to GND, red to 5V).
Insert the microSD card with downloaded Raspberry Pi system into the card slot, plug the Ethernet cable into the internet port, and connect the HDMI display to Raspberry Pi. Then, plug the USB power cable into your Raspberry Pi.
Installation and configuration of Raspberry Pi
More detailed information about Raspberry Pi installation, refer to Guide for Installing Raspberry Pi
Power on the board to start the Raspberry Pi system. The camera and I2C are both disabled in initial Raspberry Pi system, and we have to enable them manually. Run the command:
sudo raspi-config |
Enter option 5, enable Camera and I2C, and restart.
It is recommended to enable ssh and samba service on the Raspberry Pi. You can Google to find out how to enable them.
Software Package Download and Introduction
Two ways to download and transfer software packages into Raspberry Pi
- Execute the command line
git clone https://github.com/veyeimaging/raspberrypi.git
Directly copy the files into Raspberry Pi System.
- Click the link to download the software package
Transfer the software package into the Rasbperry Pi system via samba or use a U disk to copy the package file into it.
Software Introduction
- The software package includes video streaming and video control software package. i2c_cmd is the video control interface software package. There are two software packages for the video streaming interface: veye_raspcam is raspcam type toolkit, and D_mipi_rpi is D-SDK software package that provides SDK in c and contains demo in c and python.
- The video stream software package offers real-time display, capture, video recording and other functions. The video control software package controls the camera module via I2C, and provides the main ISP parameter configuration and other functions.
Both parts are open source.
How to use video stream software package
raspicam type toolkit
To begin with, add the executable permissions.
cd raspberrypi/veye_raspcam/bin/ |
chmod +x * |
- veye_raspipreview
./veye_raspipreview -t 20000 -p '0,0,1280,720' |
Realize the real-time display of 20s (20000 MS) video to HDMI output. The output window is 1280 * 720. The size of T and output window can be adjusted.
./veye_raspipreview -t -1 |
By adjusting t to - 1, the video output can be continuously displayed to HDMI output and displayed in full screen.
- veye_raspivid Video Recording
./veye_raspivid -t 5000 -o ~/test.h264 |
Realize video recording for 5s, and save the recording files to ~/test.h264. Adjust the size of t to select the recording time. Meanwhile, realize the real-time video display to HDMI output. (If preview function is not needed, you can add -n function.)
- veye_raspivid network transmission (direct tcp stream with netcat)
Execution on Rasbpberry Pi
./veye_raspivid -b 4000000 -t 0 -o - | nc -l -p 5000 |
DataRate bandwidth is 4Mbps, continuous transmission, the listening port is 5000.
It is recommended to use powershell for computers with windows system.
Use gstreamer on PC
./gst-launch-1.0 -v tcpclientsrc host=x.x.x.x port=5000 ! decodebin ! autovideosink |
The x.x.x.x is the IP address of Raspberry Pi.
Download address for gstreamer of windows version. Only need to install runtime files.
Use mplayer on PC
./mplayer -x 1280 -y 720 -geometry 0:0 -fps 200 -demuxer h264es -noborder ffmpeg://tcp://x.x.x.x:5000 |
The x.x.x.x is the IP address of Raspberry Pi.
Download address for mplayer for windows version.
- veye_raspividyuv
./veye_raspividyuv -t 200 -o /dev/shm/test.yuv |
Realize video recording in YUV Format data for 200ms, save the video files to /dev/shm/test.yuv in YUV420 I420 Format. Adjust the size of t to select the recording time.
- veye_raspiraw
./veye_raspiraw -md 2 -t 200 -o /dev/shm/out.%04d.yuv |
Capture pictures for 200ms and store them in /dev/SHM directory (memory file system), and then customers can export and view them. The file format is YUV data with size of 1920 * 1080. Uyvy format.
- veye_raspstillyuv
./veye_raspistillyuv -o /dev/shm/test.yuv |
Capture a picture and store it in /dev/shm directory (memory file system), and then customers can export and view them. The file is yuv data with size of 1920 * 1080. Storage format: YUV420 I420.
./veye_raspistillyuv -tl 50 -t 1000 -o /dev/shm/test%d.yuv |
Capture a picture at intervals of 50ms for 1 second and store it in /dev/shm directory (memory file system), and then customers can export to view them. The file is yuv data with size of 1920 * 1080. Storage format: YUV420 I420.
- veye_raspistill
./veye_raspistill -o ~/test.jpg |
Capture a picture and save in jpg format.
./veye_raspistill -e bmp -tl 50 -t 1000 -o /dev/shm/test%d.bmp |
Capture a bmp picture at intervals of 50ms for 1 second and store in /dev/shm directory (memory file system), and then customers can export to view them.
./veye_raspistill -k -o ~/test%d.jpg -t 0 |
Preview video in real-time, meanwhile,use the keyboard to capture a picture: Enter to capture, X Enter to exit.
The command veye_raspistill supports preview, and cancel it by -n.
D-SDK Software Package
Provides a C-based SDK library libdmipicam.so, and samples in C and python based on this library.
Install low-level support library
sudo apt-get update && sudo apt-get install libopencv-dev |
sudo apt-get install python-opencv |
sudo apt-get install libzbar-dev |
SDK
- Interface:
Open source code, refer to D_mipicam.h for more details.
- Compile:
./buildme |
- Install:
sudo install -m 644 ./libdmipicam.so /usr/lib/ |
C Sample
- preview
Realize real-time video preview.
- preview-dualcam
Realize real-time video preview of two-way cameras simultaneously. (RPI CM)
- video
Compress video to H.264 and save as file
- Capture
Capture a jpeg picture.
- video2stdout
Compress the video and output to stdout to serve the pipeline application, achieve the same effect as the command veye_raspivid.
./video2stdout | nc -l -p 5000 |
- capture_yuv
Capture a YUV picture.
- capture-dualcam
Two-way cameras capture jpeg pictures at the same time.
- yuv_stream
Export the orignal data of yuv format.
- capture2opencv
Continuously get YUV data and convert to opencv format, then display.
- qrcode_detection
Continuously capture YUV data, convert to opencv format, and display. Then carry out two-dimensional code detection.
Python Sample
- preview.py
Realize real-time video preview.
- capture.py
Capture a jpeg picture.
- capture_yuv.py
Capture a yuv picture.
- video.py
Compress video to H.264 and save as files.
- capture2opencv.py
Continuously get YUV data and convert to opencv format, then display.
How to use video control software package
Use I2C-0 as control BUS. We provide a script camera_i2c_config for BUS pin reuse configuration.
More detiled information, please refer to I2C Script User Guide
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum