USB camera test

From Wiki-Orange Pi
Revision as of 17:21, 25 April 2023 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

1) First, you need to prepare a USB camera that supports UVC protocol as shown in the figure below or similar, and then insert the USB camera into the USB port of the Orange Pi development board

Pi-5-details2-pic07.png

2) Through the v4l2-ctl command, you can see that the device node information of the USB camera is /dev/video0

orangepi@orangepi:~$ v4l2-ctl --list-devices

Q8 HD Webcam: Q8 HD Webcam (usb-fc880000.usb-1):

/dev/video0
/dev/video1
/dev/media0
Note that the l in v4l2 is a lowercase letter l, not the number 1.

In addition, the serial number of the video is not necessarily video0, please refer to what you actually see.

3) In the desktop system, Cheese can be used to directly open the USB camera. The method of opening Cheese is shown in the figure below.:

Pi-5-details2-pic08.png

The interface after Cheese turns on the USB camera is shown in the figure below:

Pi-5-details2-pic09.png

4) Method of using fswebcam to test USB camera
a. Install fswebcam

orangepi@orangepi:~$ sudo apt update

orangepi@orangepi:~$ sudo apt-get install -y fswebcam

b. After installing fswebcam, you can use the following command to take pictures
a) -d option is used to specify the device node of the USB camera
b) --no-banner is used to remove the watermark of the photo
c) The -r option is used to specify the resolution of the photo
d) The -S option is used to set the number of previous frames to skip
e) ./image.jpg is used to set the name and path of the generated photo

orangepi@orangepi:~$ sudo fswebcam -d /dev/video0 \

--no-banner -r 1280x720 -S 5 ./image.jpg

c. In the server version of the linux system, you can use the scp command to transfer the taken pictures to the Ubuntu PC for image viewing after taking pictures

orangepi@orangepi:~$ scp image.jpg test@192.168.1.55:/home/test (Modify the IP address and path according to the actual situation)

d. In the desktop version of the linux system, you can directly view the captured pictures through the HDMI display