OpenCV VideoCapture.get()参数详解

本文详细介绍了OpenCV中VideoCapture类的get()方法参数,涵盖了从视频位置、帧尺寸到图像属性如亮度、对比度等各项设置,是理解和调整视频流的重要指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

OpenCV VideoCapture.get()参数详解

 

paramdefine
cv2.VideoCapture.get(0)视频文件的当前位置(播放)以毫秒为单位
cv2.VideoCapture.get(1)基于以0开始的被捕获或解码的帧索引
cv2.VideoCapture.get(2)视频文件的相对位置(播放):0=电影开始,1=影片的结尾。
cv2.VideoCapture.get(3)在视频流的帧的宽度
cv2.VideoCapture.get(4)在视频流的帧的高度
cv2.VideoCapture.get(5)帧速率
cv2.VideoCapture.get(6)编解码的4字-字符代码
cv2.VideoCapture.get(7)视频文件中的帧数
cv2.VideoCapture.get(8)返回对象的格式
cv2.VideoCapture.get(9)返回后端特定的值,该值指示当前捕获模式
cv2.VideoCapture.get(10)图像的亮度(仅适用于照相机)
cv2.VideoCapture.get(11)图像的对比度(仅适用于照相机)
cv2.VideoCapture.get(12)图像的饱和度(仅适用于照相机)
cv2.VideoCapture.get(13)色调图像(仅适用于照相机)
cv2.VideoCapture.get(14)图像增益(仅适用于照相机)(Gain在摄影中表示白平衡提升)
cv2.VideoCapture.get(15)曝光(仅适用于照相机)
cv2.VideoCapture.get(16)指示是否应将图像转换为RGB布尔标志
cv2.VideoCapture.get(17)× 暂时不支持
cv2.VideoCapture.get(18)立体摄像机的矫正标注(目前只有DC1394 v.2.x后端支持这个功能)

具体属性名及英文说明按顺序如下
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)
Note: 如果查询的视频属性是VideoCapture类不支持的,将会返回0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值