Hello,
I have a tablet and the parameter of the flux video are : 1080p 16:9 30fps, that's mean the camera resolution is 1920x1080, but when i open the camera with opencv it give me always 640x480 this the code i used :
VideoCapture capq(0);
if (!capq.isOpened()) // check if we succeeded
{ return -1;
}
Mat inputImage;
for (;;)
{
capq >> inputImage; // get a new frame from camera
if (waitKey(30) >= 0) break;
while (inputImage.empty()) {
std::cout << "Empty frame" << std::endl;
continue;
}
namedWindow("Display window1", WINDOW_AUTOSIZE);
imshow("Display window1", inputImage);
}
I tried with this code to set the camera resolution but it's not working it's giving me 640x480
// deb set camera resolution
//cv::VideoCapture* camera,
int max_width = 1080;
int max_height = 1920;
// Save current resolution
const int current_width = static_cast<int>(capq.get(CAP_PROP_FRAME_WIDTH));
const int current_height = static_cast<int>(capq.get(CAP_PROP_FRAME_HEIGHT));
// Get maximum resolution
capq.set(CAP_PROP_FRAME_WIDTH, 10000);
capq.set(CAP_PROP_FRAME_HEIGHT, 10000);
max_width = static_cast<int>(capq.get(CAP_PROP_FRAME_WIDTH));
max_height = static_cast<int>(capq.get(CAP_PROP_FRAME_HEIGHT));
// Restore resolution
capq.set(CAP_PROP_FRAME_WIDTH, current_width);
capq.set(CAP_PROP_FRAME_HEIGHT, current_height);
cout << "width maximale" << current_width << endl;
cout << "height maximale" << current_height << endl;
// fin set camera resolution
I need your help and thank you.