使用OpenCV捕获网络摄像头图像时可以设置颜色深度吗? [英] Can I set the color depth while capturing the webcam image using OpenCV?
问题描述
我正在使用C ++中的OpenCV捕获图像
I am capturing the image using OpenCV in C++
firstFrame = cvQueryFrame(capture);
设置宽度和高度属性很容易
it is easy to set the width and height properties by
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, WIDTH );
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, HEIGHT );
我想知道是否可以在不进一步处理框架的情况下指定颜色深度吗?
I wonder if there is a way to specify the color depth as well without further processing the frame?
推荐答案
根据 文档 ,如果您使用功能retrive()
获取框架,则应该可以使用CV_CAP_PROP_FORMAT
进行操作.
According to the documentation, you should be able to do it using CV_CAP_PROP_FORMAT
if you use the function retrive()
to get your frame.
CV_CAP_PROP_FORMAT由Retrieve()返回的Mat对象的格式.
CV_CAP_PROP_FORMAT Format of the Mat objects returned by retrieve() .
但是,还请注意:
查询由所使用的后端不支持的属性时 VideoCapture类,返回值0.
When querying a property that is not supported by the backend used by the VideoCapture class, value 0 is returned.
这篇关于使用OpenCV捕获网络摄像头图像时可以设置颜色深度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!