Raspberry Pi configures original CSI interface camera and generates /dev/video0 device node

Configure CSI interface camera

The CSI (Camera Serial Interface) interface of the Raspberry Pi development board is located next to the USB and Ethernet interfaces. We first unplug the black baffle of the CSI interface, then insert the blue end of the cable in the direction of the Ethernet interface, and then press the black baffle to fix it.
Insert picture description here
Connect one end of the camera in the same way, and keep the blue end of the cable in the same direction as the back of the camera.
Be sure to keep the power supply disconnected when wiring, otherwise it may burn out.
To activate the camera function,
first open the Raspberry Pi terminal and update the Raspberry Pi:

sudo apt-get update
sudo apt-get upgrade

Then enter the command to open the configuration interface of the Raspberry Pi:

sudo raspi-config

Insert picture description here
Insert picture description here
Insert picture description here
After opening it, use the reboot command to restart the Raspberry Pi. So far, the camera can be used on the Raspberry Pi.
Camera function
It is very simple to use the Raspberry Pi camera to take photos, just enter the command in the terminal. Here is the raspistill command in the Raspberry Pi system:

raspistill -o a.jpg -t 1000

The function of this command is to take a picture named a.jpg after a one-second delay and save it in the home directory of the Raspberry Pi. The parameter after the -t delay option is in milliseconds, and 1000 means 1 second. The delay option can be omitted when entering the command, but the name after -o must be present.
The recording function is
also realized by inputting commands. The command is as follows:

raspivid -o b.h264 -t 10000 -w 1280 -h 720

This command means to record a ten-second video named b.h264 with a resolution of 1280x720. Similarly, if there is no parameter after the name, the system will default the recording time to 5 seconds and the resolution to 1920x1080.
Although the video recorded at this time can be played on the Raspberry Pi, it is not a regular video file that can be run on a general player, and the recorded video has no sound. To convert a video in .h264 format to a video in mp4 format, you need to use a tool called gpac. sudo apt-get install -y gpac After
installation, enter the following command to convert the format of the video just now. The converted video is 30 frames per second.

MP4Box -fps 30 -add b.h264 b.mp4

If the Raspberry Pi can't find the
basic camera settings
sudo raspi-config command, enter the Raspberry Pi basic settings interface and
select:
5 Interfacing Options
and then all set Enable should be no problem (their specific functions I don’t know too):
Camera Enable
SSH Enable
VNC Enable
SPI Enable
I2C Enable
Serial Enable
1-Wire Enable

Generate /dev/video0 device node

After restarting, modify the configuration file so that the Raspberry Pi can generate the /dev/video0 device node

sudo vim /etc/modules-load.d/modules.conf

Add a line at the end

bcm2835-v4l2 #注意是4l2而不是412

As shown in the figure,
Insert picture description here
you can see the following effects.
Insert picture description here
At this point, the camera configuration is complete.

Guess you like

Origin blog.csdn.net/qq_50866711/article/details/113837457