OpenCV VideoCapture.get()获取帧率错误

原因分析:

VideoCapture.get()返回的帧率以及宽高等均为double类型,以int类型接收或者打印出错~~~~~~~~~~~~~

备注:VideoCapture.get()参数说明

https://docs.opencv.org/4.2.0/d4/d15/group__videoio__flags__base.html#ggaeb8dd9c89c10a5c63c139bf7c4f5704daf01bc92359d2abc9e6eeb5cbe36d9af2

Enumerator
CAP_PROP_POS_MSEC 

Python: cv.CAP_PROP_POS_MSEC

Current position of the video file in milliseconds.

CAP_PROP_POS_FRAMES 

Python: cv.CAP_PROP_POS_FRAMES

0-based index of the frame to be decoded/captured next.

CAP_PROP_POS_AVI_RATIO 

Python: cv.CAP_PROP_POS_AVI_RATIO

Relative position of the video file: 0=start of the film, 1=end of the film.

CAP_PROP_FRAME_WIDTH 

Python: cv.CAP_PROP_FRAME_WIDTH

Width of the frames in the video stream.

CAP_PROP_FRAME_HEIGHT 

Python: cv.CAP_PROP_FRAME_HEIGHT

Height of the frames in the video stream.

CAP_PROP_FPS 

Python: cv.CAP_PROP_FPS

Frame rate.

CAP_PROP_FOURCC 

Python: cv.CAP_PROP_FOURCC

4-character code of codec. see VideoWriter::fourcc .

CAP_PROP_FRAME_COUNT 

Python: cv.CAP_PROP_FRAME_COUNT

Number of frames in the video file.

CAP_PROP_FORMAT 

Python: cv.CAP_PROP_FORMAT

Format of the Mat objects returned by VideoCapture::retrieve().

CAP_PROP_MODE 

Python: cv.CAP_PROP_MODE

Backend-specific value indicating the current capture mode.

CAP_PROP_BRIGHTNESS 

Python: cv.CAP_PROP_BRIGHTNESS

Brightness of the image (only for those cameras that support).

CAP_PROP_CONTRAST 

Python: cv.CAP_PROP_CONTRAST

Contrast of the image (only for cameras).

CAP_PROP_SATURATION 

Python: cv.CAP_PROP_SATURATION

Saturation of the image (only for cameras).

CAP_PROP_HUE 

Python: cv.CAP_PROP_HUE

Hue of the image (only for cameras).

CAP_PROP_GAIN 

Python: cv.CAP_PROP_GAIN

Gain of the image (only for those cameras that support).

CAP_PROP_EXPOSURE 

Python: cv.CAP_PROP_EXPOSURE

Exposure (only for those cameras that support).

CAP_PROP_CONVERT_RGB 

Python: cv.CAP_PROP_CONVERT_RGB

Boolean flags indicating whether images should be converted to RGB.

CAP_PROP_WHITE_BALANCE_BLUE_U 

Python: cv.CAP_PROP_WHITE_BALANCE_BLUE_U

Currently unsupported.

CAP_PROP_RECTIFICATION 

Python: cv.CAP_PROP_RECTIFICATION

Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently).

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后端支持这个功能)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JoannaJuanCV

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值