Method for obtaining USB camera image by using Dragonbaord 410c development board

The camera is a commonly used device in DIY. In your DIY creativity, you can use the camera to make a finishing touch. Instantly make your DIY become taller. This issue will introduce you a series of USB games on how to play Dragonbaord 410c development board. The camera's blog, with everyone to play with the Dragonbaord 410c USB camera.

On the Dragonbaord 410c development board provides a two-way USB interface, you can connect a USB camera, but unfortunately the current USB of the Dragonbaord 410c development board can only support USB2.0 devices, which may be difficult for some image processing enthusiasts, but the front Already said that we are just DIY, so basically using the USB interface on the dragonbaord 410c to connect to a normal USB camera can basically meet our needs.

Environment building everyone can refer to how to use 410c to quickly build a smart security surveillance camera article, according to here to prepare a Dragonboard 410c development board, adapter, mouse, keyboard and Logitech 270 camera, this blog will not repeat, here directly Dry goods.

Today, I will teach you the first step in image processing. Get the camera image. After installing the debain system on the Dragonbaord 410c development board, you can install the Python-OpenCV library by updating the system source and related images. The commands used here are as follows:

Sudo apt-get update -y

Sudo apt-get upgrade -y

Sudo apt-get install python-opencv -y

After you finish, everyone runs the python command input:

>>> improt cv2

Then type:

>>> exit()

Exit the python command mode,

Then we can also use the very easy to understand python script to write a program to quickly get the image data of our USB camera, here the specific code is as follows:

#! /usr/bin/env python

Import cv2, sys

DEVICE_NUMBER = 0

Vc = cv2.VideoCapture(DEVICE_NUMBER)

If vc.isOpened(): # try to get the first frame

Retval, frame = vc.read()

Else:

Sys.exit(1)

Retval, frame = vc.read()

Cv2.imshow("DB410c Workshop #0: Take Picture", frame)

cv2.waitKey(0)

Seeing the above code is not very surprising, in the dragonboard 410c environment only need to perform a few simple steps to complete the image data from the USB, compared to the use of C or C++, for the DIY developers is a Very good choice.

If you still don't believe it, you can copy the code to the UsbCamera.py file, save it, and then run the following command.

Python UsbCamera.py

At this time, you can get your image data. The test results I have here are as follows:

Well, here, everyone has mastered the first step of playing the Dragonboard 410c development board USB camera, get the camera image, follow-up we will further teach you more advanced tricks, so that you can easily use the camera in the DIY process Kind of operation.

For iPhone Xsmax

Dongguan Rongmao technology Co.,ltd , https://www.szroomoo.com

Posted on