gpt4 book ai didi

c++ - 如何获取视频采集设备信息?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:57:21 24 4
gpt4 key购买 nike

我需要从 C++ 代码查询连接的视频捕获设备(主要是网络摄像头)的设备信息。这些信息至少应包含帧速率、输出格式和控制值(颜色调整)。

最佳答案

Opencv 的 VideoCapture::get(int propId)可以获得以下信息

CV_CAP_PROP_POS_MSEC      Current position of the video file in milliseconds or video capture timestamp.
CV_CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/captured next.
CV_CAP_PROP_POS_AVI_RATIO Relative position of the video file: 0 - start of the film, 1 - end of the film.
CV_CAP_PROP_FRAME_WIDTH Width of the frames in the video stream.
CV_CAP_PROP_FRAME_HEIGHT Height of the frames in the video stream.
CV_CAP_PROP_FPS Frame rate.
CV_CAP_PROP_FOURCC 4-character code of codec.
CV_CAP_PROP_FRAME_COUNT Number of frames in the video file.
CV_CAP_PROP_FORMAT Format of the Mat objects returned by retrieve() .
CV_CAP_PROP_MODE Backend-specific value indicating the current capture mode.
CV_CAP_PROP_BRIGHTNESS Brightness of the image (only for cameras).
CV_CAP_PROP_CONTRAST Contrast of the image (only for cameras).
CV_CAP_PROP_SATURATION Saturation of the image (only for cameras).
CV_CAP_PROP_HUE Hue of the image (only for cameras).
CV_CAP_PROP_GAIN Gain of the image (only for cameras).
CV_CAP_PROP_EXPOSURE Exposure (only for cameras).
CV_CAP_PROP_CONVERT_RGB Boolean flags indicating whether images should be converted to RGB.
CV_CAP_PROP_WHITE_BALANCE Currently not supported
CV_CAP_PROP_RECTIFICATION Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently)

例如:

VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check it exists
return -1;
double fps = cap.get(CV_CAP_PROP_FPS);

关于c++ - 如何获取视频采集设备信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24630158/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com