The code below is a real-time image of the OpenCV grab camera in the PYTHON3 environment, and the histogram is calculated by OpenCV's calhist function and displayed in 3 different windows.Import Cv2Import NumPy as NPFrom matplotlib import Pyplot as PltImport timeCap = Cv2. Videocapture (0)For I in range (0, 19):Print (Cap.get (i))while (1):RET, frame = Cap.read ()# color = (' B ', ' G ', ' r ')color = ((255
Key points:
1. Read the camera
2. The R, G, and B channels (cvSplit) are separated from a colored image)
3. Create a histogram for each channel image and display
The source code is as follows:
// Camera_Capture_Histogram.cpp: Defines the entry point for the console application. // author: JarvisChu // date: 2012-1-14 # include "stdafx. h "# include" opencv2/opencv. hpp "# include
The effect is as follows
One, augmented realityAugmented Reality (AR) is a technology that calculates the position and angle of a camera image in real time and adds a corresponding image, the goal of which is to set the virtual world in the real world and interact with it on the screen. This technology is estimated to be proposed by 1990. With the increased computing power of the portable electronics, it is expected that augmented reality will be used more and more widely.Sec
The simplest example of an AVDevice Based on FFmpeg (reading a camera ),FFmpeg has a class library that interacts with multimedia devices: Libavdevice. You can use this library to read data from multimedia devices on your computer (or other devices) or output data to a specified multimedia device.Libavdevice supports the following devices as input:
Alsa
Avfoundation
Bktr
Dshow
Dv1394
Fbdev
Gdigrab
(Handle, Vidioc_s_ctrl, ctrl);Sometimes, the hardware settings are strange, you can set a message, but you can't get information about how to set it up. For example: HD-500 can set the gain. But you can't get the settings.8. Use the Extended CTRL setting:Focal length (fouce);Note 1:enum V4l2_field field; Detailed9. Set the resolution:struct V4l2_control control; memset (control, 0, sizeof (control)); Control.id = v4l2_cid_auto_white_balance; Control.value = 1; if (IOCTL (FD, Vidioc_s_ctrl, con
It is found that the method for reading videos or USB camera in opencv is so simple. The following is the code for reading cameras in opencv2.31:
Int main () {// open the video file // CV: videocapture capture ("bike. avi "); // 0 open default camera CV: videocapture capture (0); // check whether the video is enabled
Today in the camera read Video lab found that the original read the file based on directly modified Veidocapture capture ("string") for Vediocapture capture (0) Although the compilation can be successful, but the video can not read normally (card at the first frame , or cannot be opened).Videocapture Capture (0);//Note here the //Verify that the video is turned on successfully if(!capture.isopened ()) {return 1; }//Get frame rate //double fps
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.