Regression in cap.cpp r8314 (Bug #1966)


Added by Philippe FOUBERT almost 13 years ago. Updated over 12 years ago.


Status:Done Start date:2012-05-21
Priority:High Due date:
Assignee:Alexander Mordvintsev % Done:

0%

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

Description

On Windows (but we may have the same behavior in another configuration), if we use DShow, CV_CAP_PROP_POS_FRAMES and CV_CAP_PROP_FRAME_COUNT properties are not defined
=> get(CV_CAP_PROP_POS_FRAMES) = -1 and get(CV_CAP_PROP_FRAME_COUNT) = -1
=> VideoCapture::read always fails

I think the added test is usefull but to be able to use it without any problem, we should adapt the way we read the properties.

Extracts of the source code to explain the problem:

double CvCaptureCAM_DShow::getProperty( int property_id ) {
...
// unknown parameter or value not available
return -1;
}

CV_IMPL double cvGetCaptureProperty( CvCapture* capture, int id ) {
return capture ? capture->getProperty(id) : 0;
}

double VideoCapture::get(int propId) {
return cvGetCaptureProperty(cap, propId);
}

bool VideoCapture::read(Mat& image) {
if (get(CV_CAP_PROP_POS_FRAMES) < get(CV_CAP_PROP_FRAME_COUNT))
if(!grab())
image.release();
else
retrieve(image);
else
image.release();
return !image.empty();
}


Related issues

related to Bug #1988: Cannot get frame from webcam VideoCapture source in XCode Cancelled 2012-05-25

Associated revisions

Revision ce07840e
Added by Roman Donchenko about 11 years ago

Merge pull request #1966 from asmorkalov:ocv_neon_support

History

Updated by Alexander Mordvintsev almost 13 years ago

fixed in r8411

  • Status changed from Open to Done

Updated by Andrey Kamaev almost 13 years ago

  • Target version set to 3.0

Updated by Andrey Kamaev over 12 years ago

  • Category changed from highgui-images to highgui-camera

Updated by Andrey Kamaev over 12 years ago

  • Assignee changed from Alexander Reshetnikov to Alexander Mordvintsev
  • Target version changed from 3.0 to 2.4.3

Also available in: Atom PDF