How to configure the USB camera on the Orange Pi Zero 2 development board

1. First, insert the USB camera into the USB interface of the Orange Pi development board.

 2. Use the lsmod command to see that the kernel automatically loads the following modules.

 3. Use the v4l2-ctl (l is English lowercase letter l) command to view the device node information of the USB camera as /dev/video0

 Terminal updates, installation and viewing:

apt update
sudo apt install v4l-utils
v4l2-ctl --list-devices

 4. Use fswebcam to test USB camera

(1) Install fswebcam

sudo apt install fswebcam

(2) Photography instructions

  • The -d option is used to specify the device node of the USB camera
  • --no-banner is used to remove watermarks from photos
  •  -r option is used to specify the resolution of the photo
  • The -S option is used to skip previous frames
  • ./image.jpg is used to set the name and path of the generated photo

 

fswebcam -d /dev/video0 --no-banner -r 1280x720 -S 5 ./image.jpg

(3) In the server version of Linux system, after taking the photo, you can use the scp command to transfer the photo to the Ubuntu PC for mirror viewing. Modify the IP address and path according to the actual situation

scp image.jpg [email protected]:/home/root

(4) In the desktop version of Linux system, the captured pictures can be viewed directly through the HDMI display

5. Use motion to test USB camera

(1) Install the camera test software motion

sudo apt install motion

(2) Modify the configuration of /etc/default/motion and change start_motion_daemon=no to start_motion_daemon=yes

sed -i "s/start_motion_daemon=no/start_motion_daemon=yes/" \ /etc/default/motion

(3) Modify the configuration of /etc/motion/motion.conf and change stream_localhost on to stream_localhost off

sed -i "s/stream_localhost on/stream_localhost off/" \ /etc/motion/motion.conf

(4) Restart the motion service

/etc/init.d/motion restart

(5) Make sure that the development board can connect to the network normally, and then enter [development board’s IP address: 8081] in the Ubuntu PC or Windows PC on the same LAN as the development board, or in the Firefox browser of your mobile phone to see the video output by the camera.

 

Guess you like

Origin blog.csdn.net/qq_43460230/article/details/131848072