Why VFW call to get MJPG decompressor fails?

asked 2016-08-11 11:00:33 -0600

jhg543 gravatar image

I am using opencv C++ (2.4.13) prebuilt binary (VS12 x64) on windows 10 x64 (10.0.10586) to read some image frame from my webcam using the following code:


VideoCapture capture;
capture.open(-1);
if (!capture.isOpened()) 
{ 
    printf("--(!)Error opening video capture\n"); return -1; 
}

while (capture.read(frame)) ....

Opening the cam was successful but capture.read(frame) failed, returning an empty frame.

My cam works well in windows 10's camera application.

I debugged into opencv source code and it shows that the grab() works well but there are problems decoding the frame data with windows VFW api call in "cap_vfw.cpp":


hic = ICOpen( MAKEFOURCC('V','I','D','C'),
                      vfmt0.biCompression, ICMODE_DECOMPRESS );

with vfmt0.biCompression = 0x47504a4d ( "MJPG" = motion JPEG )

The ICOpen function returned zero so the whole progress failed. Do I need to install additional decompressor or any configuration step to get cam work under windows 10?

edit retag flag offensive close merge delete

Comments

1

Does it work using capture.open(0);?

LBerger gravatar imageLBerger ( 2016-08-11 11:39:35 -0600 )edit