Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Very Low FPS Problem " Always 5 fps " QSFQSDFQSDFqsd

Hi everyone ,

I have good webcam " Logiteck C920 ", when i run any of my opencv programs i got just 5 fps.
I searched on the internet and i found that the computing inside the while loop slows down the fps.

So i tried a simple webcam program and i still got 5 fps , any help please to get a normal fps
i fond in the internet that many people got 16-30 fps easily with this webcam without any problem.

My webcam code simplified:

int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0

Mat save_img; cap >> save_img;

//reduce computing by disabling the rgb conversion
cap.set(CV_CAP_PROP_CONVERT_RGB , false);
cap.set(CV_CAP_PROP_FPS , 60);

if (!cap.isOpened())  // if not success, exit program
{
    cout << "Cannot open the video cam" << endl;
    return -1;
}

    namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"

while (1)
{

   Mat frame;
   cap.retrieve(frame);

   cout << "\n " << CV_CAP_PROP_FPS << "\n "  ;

    imshow("MyVideo", frame); //show the frame in "MyVideo" window
    Mat save_img; cap >> save_img;


    if (waitKey(10) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
   {
       imwrite("test.jpg", save_img);
        cout << "esc key is pressed by user" << endl;
        break; 
   }
}
return 0;

}

Thank you
Cheers

Very Low FPS Problem " Always 5 fps " QSFQSDFQSDFqsd"

Hi everyone ,

I have good webcam " Logiteck C920 ", when i run any of my opencv programs i got just 5 fps.
I searched on the internet and i found that the computing inside the while loop slows down the fps.

So i tried a simple webcam program and i still got 5 fps , any help please to get a normal fps
i fond in the internet that many people got 16-30 fps easily with this webcam without any problem.

My webcam code simplified:

int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0

Mat save_img; cap >> save_img;

//reduce computing by disabling the rgb conversion
cap.set(CV_CAP_PROP_CONVERT_RGB , false);
cap.set(CV_CAP_PROP_FPS , 60);

if (!cap.isOpened())  // if not success, exit program
{
    cout << "Cannot open the video cam" << endl;
    return -1;
}

    namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"

while (1)
{

   Mat frame;
   cap.retrieve(frame);

   cout << "\n " << CV_CAP_PROP_FPS << "\n "  ;

    imshow("MyVideo", frame); //show the frame in "MyVideo" window
    Mat save_img; cap >> save_img;


    if (waitKey(10) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
   {
       imwrite("test.jpg", save_img);
        cout << "esc key is pressed by user" << endl;
        break; 
   }
}
return 0;

}

Thank you
Cheers

Very Low FPS Problem " Always 5 fps "

Hi everyone ,

I have good webcam " Logiteck C920 ", when i run any of my opencv programs i got just 5 fps.
I searched on the internet and i found that the computing inside the while loop slows down the fps.

So i tried a simple webcam program and i still got 5 fps , any help please to get a normal fps
i fond in the internet that many people got 16-30 fps easily with this webcam without any problem.

My webcam code simplified:

int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0

Mat save_img; cap >> save_img;

//reduce computing by disabling the rgb conversion
cap.set(CV_CAP_PROP_CONVERT_RGB , false);
cap.set(CV_CAP_PROP_FPS , 60);

if (!cap.isOpened())  // if not success, exit program
{
    cout << "Cannot open the video cam" << endl;
    return -1;
}

    namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"

while (1)
{

   Mat frame;
   cap.retrieve(frame);

   cout << "\n " << CV_CAP_PROP_FPS << "\n "  ;

    imshow("MyVideo", frame); //show the frame in "MyVideo" window
    Mat save_img; cap >> save_img;


    if (waitKey(10) (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
   {
       imwrite("test.jpg", save_img);
        cout << "esc key is pressed by user" << endl;
        break; 
   }
}
return 0;

}

Thank you
Cheers

Very Low FPS Problem " Always 5 fps "

Hi everyone ,

I have good webcam " Logiteck C920 ", when i run any of my opencv programs i got just 5 fps.
I searched on the internet and i found that the computing inside the while loop slows down the fps.

So i tried a simple webcam program and i still got 5 fps , any help please to get a normal fps
i fond in the internet that many people got 16-30 fps easily with this webcam without any problem.

My webcam code simplified:

int main(int argc, char* argv[])
{
VideoCapture cap(0); // open the video camera no. 0

Mat save_img; cap >> save_img;

//reduce computing by disabling the rgb conversion
cap.set(CV_CAP_PROP_CONVERT_RGB , false);
cap.set(CV_CAP_PROP_FPS , 60);

if (!cap.isOpened())  // if not success, exit program
{
    cout << "Cannot open the video cam" << endl;
    return -1;
}

    namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"

while (1)
{

   Mat frame;
   cap.retrieve(frame);

   cout << "\n " << CV_CAP_PROP_FPS << "\n "  ;

    imshow("MyVideo", frame); //show the frame in "MyVideo" window
    Mat save_img; cap >> save_img;


    if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
   {
       imwrite("test.jpg", save_img);
        cout << "esc key is pressed by user" << endl;
        break; 
   }
}
return 0;

}

Thank you
Cheers