capture->set(CV_CAP_PROP_FOURCC, 0xe436eb7e); does not work due to cvRound. OpenCV2.4.3 windows x32. (Bug #2535)


Added by ippei ito over 12 years ago. Updated about 12 years ago.


Status:Done Start date:2012-11-12
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:https://github.com/Itseez/opencv/pull/387

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

Revision 2d625360
Added by Andrey Kamaev about 12 years ago

Fix truncation of fourcc value in dshow capture property setter (bug #2535)

Added test checking that all valid fourcc values are converted properly

Revision e34a7caa
Added by Andrey Pavlenko almost 11 years ago

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 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