首页 文章

OpenCV的VideoCapture :: get(CV_CAP_PROP_FORMAT)返回的数字是什么意思?

提问于
浏览
1

OpenCV函数VideoCapture::get返回"the specified VideoCapture property" . 我们可以使用属性 CV_CAP_PROP_FORMAT 来请求帧的格式 .

这些帧是Mat对象,来自文档(here)Mat "represents an n-dimensional dense numerical single-channel or multi-channel array"但似乎不包含格式枚举 .

我如何理解VideoCapture :: get(CV_CAP_PROP_FORMAT)返回的每个数字的格式是什么?如何将它们映射到图像格式选项?

1 回答

  • 1

    正如@DanMašek上面评论的那样是Mat的数据类型代码,例如: CV_8UC1 ,可以看到,例如,代码here

    case CV_CAP_PROP_FORMAT:
       return CV_MAKETYPE(CV_8U, capture->frame.nChannels);
    

    (对于那些类型的同义词here#define . )

    @Hammer在对他的回答here:"the U means unsigned, the S means signed, the F means float. the number is how many bits are involved. CV_16S means a 16 bit signed integer"的评论中进一步解释了这些同义词 . 除此之外,"Cn"表示通道数,例如C3为RGB .

相关问题