0
- カメラの解像度を取得するにはどうすればよいですか?誰かが私にいくつかの提案を与えることができます。
- 私ができることは次のとおりですが、解決に時間がかかりすぎます。
このようなコードのシーケンスを見て:camerra b.Changeカメラの解像度a.Open 、および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; }
を}チェックは
[これ](http://stackoverflow.com/questions/18458422/query-maximum-resolution-in-opencv)を試しましたか? – ikaro