我正在尝试使用 cv::VideoCapture 读取一堆 CV_32FC1
帧,但默认情况下它像 CV_8UC3
一样加载它们。
我尝试使用 VideoCapture::set()
更改对象属性,但该方法一直返回 0。
是否可以使用 cv::VideoCapture 加载 CV_32FC1
帧?我在文档中找不到答案,但我也找不到代码示例。 p>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include "opencv2/opencv.hpp"
int main(int argc , char** argv )
{
VideoCapture capture;
// return always 0:
std::cout << "FORMAT" = " << capture.get( CV_CAP_PROP_FORMAT ) << std::endl;
capture("./frames/frame_%02d.BMP";
// return always 0:
std::cout << "FORMAT" = " << capture.get( CV_CAP_PROP_FORMAT ) << std::endl;
// status is always false
bool status = capture.set( CV_CAP_PROP_FORMAT, CV_32FC1 );
// still 0:
std::cout << "FORMAT" = " << capture.get( CV_CAP_PROP_FORMAT ) << std::endl;
if( !capture.isOpened() ) // isok?
return -1;
cv::Mat image;
capture.read( image );
// image is 8UC3
return 0;
}
欢迎任何评论,在此先感谢。
最佳答案
正如 berak 在评论中所说:
“是否可以使用 cv::VideoCapture 加载 CV_32FC1 帧?” - 不。此外,您不能将 float 图像存储在 .bmp 中
关于c++ - 是否可以使用 cv::VideoCapture 加载 32 位帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28283064/