USB camera image saving based on Dragonboard 410c development board

In the previous blog, I shared with you how to quickly write a program to read image information from a USB camera connected to the Dragonboard 410c development board. I will briefly introduce how to set up the camera development environment of the Dragonabord 410c development board, including related sources. The update, the installation of the library, according to the introduction in the last blog, after installing Python-OpenCV and importing the cv2 library, we can proceed to the next study of us today, and today we will ask you to further realize how to get images from the camera. Save and display in real time.

The same environment setup was introduced in the previous blog. I won't say much here. Directly on the code, the code for saving the image is as follows:

#!/usr/bin/env python
Import cv2, sys
# Constants
DEVICE_NUMBER = 0
IMAGE_FILE = "output.jpg"
# Init webcam
Vc = cv2.VideoCapture(DEVICE_NUMBER)
# Check if the webcam init was successful
If vc.isOpened(): # try to get the first frame
Retval, frame = vc.read()
Else:
Sys.exit(1)
Retval, frame = vc.read()
# Save the frame as an image file
Cv2.imwrite(IMAGE_FILE, frame)
# Read the output file
Img = cv2.imread(IMAGE_FILE)
# Show the image on the screen

Cv2.imshow("DB410c Workshop #1: Save Picture", img)

# Exit program after waiTIng indefinitely for a pressed key
cv2.waitKey(0)

It's just a little bit more code than getting the USB camera image data in front. It's amazing, so if you need to use the camera to get relevant image data for other programs during development, you can use this script to quickly implement it. Save a lot of development time, you can also avoid learning the complex Opencv interface library, if you do not believe, you can create a new script file, the command is as follows:

Vim sava_usb_img.py

Then press i to enter the edit mode of the vim editor, copy the above code and press the esc key to enter the vim command mode. Enter: wq to save and exit. At this time, you can get a frame of image from the camera and save it by running the script. , save to the output.jpg file, the specific effects are as follows:

Ok, here everyone learned how to use the powerful and easy-to-understand Python script and opencv to get and save the image data in the USB camera on the dragonbaord 410c development board. You can imagine if you can get it in real time in a DIY demo. Image data, at this time you can easily use this script to obtain images, and at the same time combine the technical means such as mail sending and network transmission, you can get live image data in real time. I won't say much here, just teach you how to save images. Follow-up in the "Dragonboard 410c USB Camera" series blog will bring you USB camera white, further realize more complex USB camera and related image processing operations, so stay tuned.

Air Glow Switch 2 In 1

vape with no nicotine for kids,vape with no nicotine,vape vuse pods

Shenzhen Aierbaita Technology Co., Ltd. , https://www.aierbaitavape.com