capture->set(CV_CAP_PROP_FOURCC, 0xe436eb7e); does not work due to cvRound. OpenCV2.4.3 windows x32. (Bug #2535)
Description
CvCaptureCAM_DShow::setProperty() can't set fourcc
MEDIASUBTYPE_RGB24,MEDIASUBTYPE_RGB32,MEDIASUBTYPE_RGB555,MEDIASUBTYPE_RGB565 etc...
because these fourcc values are overflow when converted from double to int.
EX)
MEDIASUBTYPE_RGB32 fourcc value is 0xe436eb7e.
capture->set(CV_CAP_PROP_FOURCC, 0xe436eb7e);
cap_dshow.cpp
bool CvCaptureCAM_DShow::setProperty( int property_id, double value )
~~~
case CV_CAP_PROP_FOURCC:
// value = 0xe436eb7e = 3828804478, but fourcc = 0x80000000.
fourcc = cvRound(value);
~~~
CV_INLINE int cvRound( double value )
{
#if (defined _MSC_VER && defined _M_X64) || (defined GNUC && defined x86_64 && defined SSE2 && !defined APPLE)
__m128d t = _mm_set_sd( value );
return _mm_cvtsd_si32(t);
#elif defined _MSC_VER && defined _M_IX86
int t;
__asm
{
fld value; // value = 0xe436eb7e = 3828804478.
fistp t; // t = 0x80000000.
}
return t;
Associated revisions
Fix truncation of fourcc value in dshow capture property setter (bug #2535)
Added test checking that all valid fourcc values are converted properly
Merge pull request #2535 from akarsakov:stereobm_fix
History
Updated by Vadim Pisarevsky about 12 years ago
- Affected version set to 2.4.3
- Target version deleted ()
Updated by Vadim Pisarevsky about 12 years ago
- Assignee deleted (
Vadim Pisarevsky)
Updated by Andrey Kamaev about 12 years ago
- Pull request set to https://github.com/Itseez/opencv/pull/387
- Assignee set to Andrey Kamaev
Updated by Kirill Kornyakov about 12 years ago
- Target version set to 2.4.4