allow icvGetPropertyCAM_V4L to return zero

now icvGetPropertyCAM_V4L behaves the same as in cap_libv4l. This also
fixes passing boolean values.
This commit is contained in:
Pavel Rojtberg 2015-10-09 12:05:29 +02:00 committed by Pavel Rojtberg
parent f7981a8ae8
commit 18034a5138

View File

@ -2303,15 +2303,11 @@ static double icvGetPropertyCAM_V4L (CvCaptureCAM_V4L* capture,
return -1;
}
if(property_id == CV_CAP_PROP_AUTOFOCUS) {
return (double)capture->control.value;
}
/* get the min/max values */
cv::Range range = capture->getRange(property_id);
/* all was OK, so convert to 0.0 - 1.0 range, and return the value */
return ((float)capture->control.value - range.start + 1) / range.size();
return ((float)capture->control.value - range.start) / range.size();
}
#endif /* HAVE_CAMV4L2 */