Regression in cap.cpp r8314 (Bug #1966)
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
Merge pull request #1966 from asmorkalov:ocv_neon_support
History
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