resolution not responding properly to query

asked 2016-11-01 04:35:10 -0600

atv gravatar image

updated 2016-11-01 04:37:51 -0600

-If i set the resolution, then query it after, it doesn't (always) show up. Sometimes it does. But it's not consistent.

I know most of this is old syntax, i'm converting as i go along. Maybe that's the reason for the resolution reporting value being inconsistent. And yes i know i'm setting CAP_PROP_FRAME_WIDTH, and querying CV_CAP_PROP_FRAME_WIDTH. I can't set CV_CAP_PROP_FRAME_WIDTH, that's why :-)

    capture.set(cv::CAP_PROP_FRAME_WIDTH, 320);
    capture.set(cv::CAP_PROP_FRAME_HEIGHT, 240);

    // We'll allow these values to be adjusted later in our program
    // but as a default we base them on resolution
    cout << capture.get(CV_CAP_PROP_FRAME_WIDTH) << endl;
    cout << capture.get(CV_CAP_PROP_FRAME_HEIGHT) << endl;
    lvl1=capture.get(CV_CAP_PROP_FRAME_WIDTH)/30;
    lvl2=capture.get(CV_CAP_PROP_FRAME_WIDTH)/20;
    lvl3=capture.get(CV_CAP_PROP_FRAME_WIDTH)/10;
    cout << "Level 1 threshold set to: " << lvl1 << endl;
    cout << "Level 2 threshold set to: " << lvl2 << endl;
    cout << "Level 3 threshold set to: " << lvl3 << endl;

Any idea's would be appreciated.

edit retag flag offensive close merge delete

Comments

just to elaborate, by not showing up i mean it takes the requested resolution alright, but the cout does not always show the right resolution, almost as if it didnt have time yet to update it.

atv gravatar imageatv ( 2016-11-01 09:51:24 -0600 )edit