Night Camera Module for Raspberry Pi Wiki - DFRobot

SEN0338 Night Camera Module for Raspberry Pi

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

Hardware preparation and installation

Preparation

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

SEN0338- Raspberry Pi Setup

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

Directly copy the files into Raspberry Pi System.

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

Software Introduction

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 -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 -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.)

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 -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 -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_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 -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

Open source code, refer to D_mipicam.h for more details.

./buildme
sudo install -m 644 ./libdmipicam.so /usr/lib/

C Sample

Realize real-time video preview.

Realize real-time video preview of two-way cameras simultaneously. (RPI CM)

Compress video to H.264 and save as file

Capture a jpeg picture.

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 a YUV picture.

Two-way cameras capture jpeg pictures at the same time.

Export the orignal data of yuv format.

Continuously get YUV data and convert to opencv format, then display.

Continuously capture YUV data, convert to opencv format, and display. Then carry out two-dimensional code detection.

Python Sample

Realize real-time video preview.

Capture a jpeg picture.

Capture a yuv picture.

Compress video to H.264 and save as files.

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

More Documents

DFshopping_car1.png Get Night Camera Module for Raspberry Pi from DFRobot Store or DFRobot Distributor.

Turn to the Top