Guide to Using the Raspberry Pi 4 CSI Camera

1. Camera Installation

1. Hardware Installation

Electrostatic Handling

The camera circuit board connects to the Raspberry Pi via a 15-pin ribbon cable.

Lift the clips on both ends of the connector.

The blue marking should face the network interface direction.

2. Software Installation

Modify the Raspberry Pi configuration to enable the camera module.

sudo raspi-config

Camera module detection

pi@raspberrypi:~ $ vcgencmd get_camerasupported=1 detected=1 or pi@raspberrypi:~ $ ls -al /dev/video0 crw-rw----+ 1 root video 81, 3 Mar  9 01:06 /dev/video0

2. Regular Camera Operations

Currently, three applications are provided:

raspistill captures imagesraspivid captures videoraspistillyuv captures images

raspistill uses the image encoding component, raspivid uses the video encoding component, and raspistillyuv does not use an encoding component but directly outputs YUV or RGB from the camera component to a file.

# Photo Test Displays a preview image from the camera for 5 seconds and takes a photo. raspistill -v -o test.jpg # View Image xdg-open test.jpg # Video Recording raspivid -o vv.h264 -t 10000s # Play Video vlc vv.h264 # Help Documentation Use the arrow keys to scroll, then type q to exit raspivid | less raspistill | less # Take a photo after a two-second (time unit in milliseconds) delay and save it as image.jpg raspistill -t 2000 -o image.jpg # Capture a photo of a custom size. raspistill -t 2000 -o image.jpg -w 640 -h 480 # Reduce image quality to decrease file size raspistill -t 2000 -o image.jpg -q 5 # Force the preview window to appear at coordinates 100,100 with a size of width 300 and height 200 pixels. raspistill -t 2000 -o image.jpg -p 100,100,300,200 # Disable the preview window raspistill -t 2000 -o image.jpg -n # Save the image as a PNG file (lossless compression format, but slower than JPEG). Note that when selecting image encoding, the file extension will be ignored. raspistill -t 2000 -o image.png –e png # Add some EXIF information to the JPEG file. This command sets the author name tag to Dreamcolor and GPS altitude to 123.5 meters. raspistill -t 2000 -o image.jpg -x IFD0.Artist=Dreamcolor -x GPS.GPSAltitude=1235/10 # Set embossed image effect raspistill -t 2000 -o image.jpg -ifx emboss # Set the U and V channels of the YUV image to specified values (128:128 for a black and white image) raspistill -t 2000 -o image.jpg -cfx 128:128 # Only display a two-second preview image without saving the image. raspistill -t 2000 # Interval photo capture, during 10 minutes (10 minutes = 600000 milliseconds), capture one photo every 10 seconds, and name them as image_number_001_today.jpg, image_number_002_today.jpg... and the last photo will be named latest.jpg. raspistill -t 600000 -tl 10000 -o image_num_%03d_today.jpg -l latest.jpg # Capture a photo and send it to the standard output device raspistill -t 2000 -o - # Capture a photo and save it to a file raspistill -t 2000 -o - > my_file.jpg # The camera works continuously, and when the enter key is pressed, a photo is taken. raspistill -t 0 -k -o my_pics%02d.jpg =================================================================== # Record a 5-second video clip (1080p30) with default settings raspivid -t 5000 -o video.h264 # Record a 5-second video clip with a specified bitrate (3.5Mbits/s) raspivid -t 5000 -o video.h264 -b 3500000 # Record a 5-second video clip with a specified framerate (5fps) raspivid -t 5000 -o video.h264 -f 5 # Send a 5-second encoded camera stream image to standard output raspivid -t 5000 -o - # Save a 5-second encoded camera stream image to a file raspivid -t 5000 -o - > my_file.h264

3. Advanced Operations

Building a Video Surveillance System Using Motion

Leave a Comment

×