Searching on same topic myself :
As previously answered there is no direct property, but you could find supported resolutions trying to figure out accepted camera resolutions :
- trying all possible common resolutions
- probing minimum resolution and increasing width/height
Here C++ OpenCV 2.4.8/Windows tested code sample
trying common resolutions solution :
const CvSize CommonResolutions[] = {
cvSize(120, 90),
cvSize(352, 240),
cvSize(352, 288),
// and so on
cvSize(8192, 4608)
};
vector<CvSize> getSupportedResolutions(VideoCapture camera)
{
vector<CvSize> supportedVideoResolutions;
int nbTests = sizeof(CommonResolutions) / sizeof(CommonResolutions[0]);
for (int i = 0; i < nbTests; i++) {
CvSize test = CommonResolutions[i];
// try to set resolution
camera.set(CV_CAP_PROP_FRAME_WIDTH, test.width);
camera.set(CV_CAP_PROP_FRAME_HEIGHT, test.height);
double width = camera.get(CV_CAP_PROP_FRAME_WIDTH);
double height = camera.get(CV_CAP_PROP_FRAME_HEIGHT);
if (test.width == width && test.height == height) {
supportedVideoResolutions.push_back(test);
}
}
return supportedVideoResolutions;
}
Probing solution based on width increment :
vector<CvSize> getSupportedResolutionsProbing(VideoCapture camera)
{
vector<CvSize> supportedVideoResolutions;
int step = 100;
double minimumWidth = 16; // Microvision
double maximumWidth = 1920 + step; // 1080
CvSize currentSize = cvSize(minimumWidth, 1);
CvSize previousSize = currentSize;
while (1) {
camera.set(CV_CAP_PROP_FRAME_WIDTH, currentSize.width);
camera.set(CV_CAP_PROP_FRAME_HEIGHT, currentSize.height);
CvSize cameraResolution = cvSize(
camera.get(CV_CAP_PROP_FRAME_WIDTH),
camera.get(CV_CAP_PROP_FRAME_HEIGHT));
if (cameraResolution.width == previousSize.width
&& cameraResolution.height == previousSize.height)
{
supportedVideoResolutions.push_back(cameraResolution);
currentSize = previousSize = cameraResolution;
}
currentSize.width += step;
if (currentSize.width > maximumWidth)
{
break;
}
}
return supportedVideoResolutions;
}
I hope this will be helpful for futur users.