is there a way to access the camera driver from OpenCV to disable an image optimization?
When I started playing around with the camera I wrote a simple application to measure the FPS rate, but I was receiving only 15 frames instead of 30 FPS with 640x480 resolution as indicated in camera’s specifications.
I did some research and found out that I can disable the “RightLight” function on the “Logitech Webcam-Software” (additional Software from Logitech’s website). I did it and got 30 frames.
I would like to programmatically make sure that the “RightLight” function is turned off when I start my application without using an additional software. Is there a way to do it?
void testFPS() {
cv::VideoCapture cap(0);
//cap.set(cv::CAP_PROP_SETTINGS, 1); //open the settings menu
cap.set(cv::CAP_PROP_FRAME_WIDTH, 640);
cap.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
cap.set(cv::CAP_PROP_FPS, 30);
cap.set(cv::CAP_PROP_AUTOFOCUS, 0);
int frameCounter = 0;
std::stringstream ss;
cv::Mat mat;
auto start = std::chrono::high_resolution_clock::now();
while (true) {
cap >> mat;
frameCounter++;
auto finish = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = finish - start;
double fps = frameCounter / elapsed.count();
ss.str("");
ss << "FPS: " << fps;
cv::putText(mat, ss.str(), cv::Point(30, 30), cv::FONT_HERSHEY_SIMPLEX, 0.8, cv::Scalar(0, 0, 255), 1, cv::LINE_AA);
cv::imshow("Win", mat);
if (cv::waitKey(30) >= 0) { //esc
break;
}
}
}
P.S.
There is another strange thing (bug) that I have discovered. If I disconnect the camera and connect it again I only receive 15 frames and the “Logitech Webcam-Software” shows me that the “RightLight” function is disabled. However, in this case I’m only receiving 15 frames from OpenCV’s VideoCaputre object. To solve that I must enable the “RightLight” function and disable it again to make sure that I will receive 30 frames.