cvSetCaptureProperty for CV_CAP_PROPS_FPS on Dshow CAM devices (Bug #2114)


Added by Juergen Sienel over 12 years ago. Updated about 12 years ago.


Status:Done Start date:2012-06-29
Priority:Normal Due date:
Assignee:Andrey Kamaev % Done:

0%

Category:highgui-camera
Target version:2.4.4
Affected version:2.4.3 Operating System:
Difficulty: HW Platform:
Pull request:

Description

Using cvSetCaptureProperty will override the CV_CAP_PROP_FRAME_WIDTH and CV_CAP_PROP_FRAME_HEIGHT settings to the device defaults.
Seems that the corresponding CASE section misses getting and setting width and height similar to how it done with the fps in the if (handled) section, when changing width or height.


ocv_issue_ex.cpp - example code (1.4 kB) Juergen Sienel, 2012-07-09 07:00 pm


Associated revisions

Revision 0cd8684a
Added by Andrey Kamaev about 12 years ago

Fix setting of FPS after frame width and height with DShow cameras

Issue #2114

Revision 58882e5c
Added by Roman Donchenko about 11 years ago

Merge pull request #2114 from kazuki-ma:SparseMat_convertTo_typofix_24

History

Updated by Marina Kolpakova over 12 years ago

Could you provide a sample reproducing this problem?

Updated by Juergen Sienel over 12 years ago

Hi Marina,

find attached an example showing my issue. The example opens a CAM capture device (dshow on my windows XP) and queries frames of size 640*480 or 320*240 and displays them on the screen. While the first and second frame are captured correctly (setting first the fps, then width and height), the third returns a 640*480 frame.
Just changing the order how properties are set is a good work around.
Going through the code, I tried following modif, which worked for me.

bool CvCaptureCAM_DShow::setProperty( int property_id, double value )
{
 // some other code
 case CV_CAP_PROP_FPS:
        int fps = cvRound(value);
//JS        if (fps != VI.getFPS(index)) 
        if (fps != VI.getFPS(0))
       {   
//JS        int lwidth = VI.getWidth(index);
//JS        int lheight = VI.getHeight(index);
//JS        int lfourcc=VI.getFourcc(index); 
              VI.stopDevice(index);
              VI.setIdealFramerate(index,fps);
//JS          VI.setupDeviceFourcc(index, lwidth, lheight, lfourcc);           
              VI.setupDevice(index);
        }
        break;
// some more code
}

Regards

Juergen

  • File ocv_issue_ex.cpp added

Updated by Andrey Kamaev over 12 years ago

  • Category changed from highgui-images to highgui-camera

Updated by Vadim Pisarevsky over 12 years ago

  • Target version deleted ()
  • Assignee deleted (Vadim Pisarevsky)

Updated by Kirill Kornyakov over 12 years ago

  • Target version set to Next Hackathon

Updated by Vadim Pisarevsky about 12 years ago

  • Affected version set to 2.4.3
  • Target version deleted (Next Hackathon)

Updated by Andrey Kamaev about 12 years ago

  • Assignee set to Andrey Kamaev

Updated by Andrey Kamaev about 12 years ago

Fix is pushed to 2.4

  • Status changed from Open to Done

Updated by Kirill Kornyakov about 12 years ago

  • Target version set to 2.4.4

Also available in: Atom PDF