如何获取相机的分辨率
How to get resolution of camera
- 如何获得相机的分辨率?有人可以给我一些建议。
- 我只能做以下内容,但是要获得解决方案需要太多时间。
-
代码的顺序看起来像这样: apen camerra B.改变相机的分辨率,然后检查REUSLT
void GetResolution( const int& countOfCamera, resolution_t (&resoulationTemp)[MAX_RESOLUTION] ){ VideoCapture *pVideoCaptures[MAX_CAMERA] = {NULL}; bool ret1 = false; bool ret2 = false; for ( int j=0; j<countOfCamera; ++j ) { pVideoCaptures[j] = new VideoCapture(j); /*========================================================================== *If we don't do this, we will not open the Camera correctly ===========================================================================*/ pVideoCaptures[j]->set( CV_CAP_PROP_FRAME_WIDTH, defaultResolution.width ); pVideoCaptures[j]->set ( CV_CAP_PROP_FRAME_HEIGHT, defaultResolution.height ); } for ( int i=0; i<MAX_RESOLUTION; ++i ) { for ( int j=0; j<countOfCamera; ++j ) { ret1 = pVideoCaptures[j]->set( CV_CAP_PROP_FRAME_WIDTH, resolutions[i].width ); ret2 = pVideoCaptures[j]->set ( CV_CAP_PROP_FRAME_HEIGHT, resolutions[i].height ); if ( !(ret1 && ret2) ) { //The resolution is not OK break; //Check the next resolution } else if ( j == ( countOfCamera -1 ) ) { //The resolution is OK for all camera,then store it. resoulationTemp[i].width = resolutions[i].width; resoulationTemp[i].height = resolutions[i].height; } else { //Do nothing } } } for ( int j=0; j<countOfCamera; ++j ) //Release the memory { pVideoCaptures[j]->release(); delete pVideoCaptures[j]; pVideoCaptures[j] = NULL; }
}
不幸的是,没有方便的方法可以通过OpenCV API获得特定相机的支持分辨率列表(因为它支持了许多平台和许多视频捕获后端)。即使您的代码也会遭受此困扰,请阅读videoio.hpp的来源。但是,大多数数字视频设备都支持标准分辨率,您可以简单地从中选择。获取支持格式的实际列表的另一种方法是使用第三方库,因为实例QT通过几个呼叫解决了此任务。
相关文章:
- 了解 GLM- openGL 中的相机转换
- OpenGL相机和相机空间转型的困惑
- 如何使用按钮更新GTK3图像以使用C++从相机捕获图片
- 使用分辨率定理用Z3证明
- Alt+Enter 在 Win32 应用中,管理大小调整和分辨率
- Opencv 恢复到比我设置的更高的分辨率
- 通过 API 控制 DJI 相机
- 在Windows(C++)中使用USB相机拍摄高分辨率照片
- C++ 不同分辨率的相机的Opencv校准
- Pi 相机与 v4l2 OpenCv - 无法获得 2592x1944 分辨率
- DirectX 9 - 获取相机分辨率?(C++)
- 如何获取相机的分辨率
- 相机校准是否取决于图像分辨率
- 访问Ximea相机并使用OpenCV设置预定义的分辨率时,由于相机默认分辨率的大小为Mat,因此显示混乱的输出
- C++ 获取支持的相机分辨率和帧速率 OSX
- 2D 坐标到 3D 坐标分辨率和相机矩阵
- OpenCV:获取相机分辨率C++
- 为什么OpenCV(@Banana Pi,Raspbian)中的全屏窗口分辨率会减慢相机镜头的速度并使其滞后
- 无法在Qt 5.0.2(Linux)中使用QCamera获取相机支持的分辨率以进行图像捕获
- OpenCV 不会显示分辨率大于 640x480 的相机源