[Solution] OpenCV 2.2 Webcam launch problem

My developing environment: Windows 7 64 bit, Visual Studio 2008 32bit, OpenCV 2.2 2010-12-05 Package from official website.

My webcam, which works fine in OpenCV 2.1, could not even be launched in OpenCV 2.2. After some google work, it seems to be a known Bug of 2.2 version and has been solved in the branch but not in the package.

So, just DIY! Only one file needs to be modified: $(OpenCV Folder)\modules\highgui\src\precomp.hpp


#if !defined WIN32 && !defined _WIN32
#include "cvconfig.h"
void  FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin );


#include "cvconfig.h"
#if defined WIN32 || defined _WIN32
void  FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin );

Re-compile OpenCV project, and done.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    Thanks! With your help my isight webcam can work in OpenCV now!

  2. Adrienne Marie
    Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    Was the webcam able to display properly with this bug fix?
    When I did this a blank grey screen popped up instead of the video stream.

    I am using Windows 7 64-bit in opencv 2.2 64 bit in visual studios 2008

  3. Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    In my case, it works. I am also working in Win7 64bit. Maybe you can debug into your code to see what the exception is.

  4. deniz
    Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    i changed precomp.hpp just like you say but it didn’t work.nothing changed..How can i solve this problem?

  5. Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    en, without more details I am afraid that I can not offer much help. But maybe you can check the coder in your environment, or just change another version of OpenCV for testing.

  6. Samarth
    Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    I am using OpenCV in Ubuntu-11.04
    My webcam works properly with Cheese.But it is not working with cvCreateFromCAM().
    Can you please help me out in this matter?

  7. MyBigBaby
    Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    Hello,thx for sharing, I changed the code in precomp.hpp in VS2010, then rebuild, but nothing changed. My envirement is WIN 7 32bit +VS2010+openCV 2.2.0, it is still a blank gray window. when I tried again, there is a worse situation,the blank gray window appeared just for a second and then disappeared…
    Could you help me with solving this problem?

  8. nikhil
    Posted %A %B %e%q, %Y at %I:%M %p | Permalink

    the grey window appears for me too, i did the above changes u have shared, but the problem remains the same. any other way to clear this blank screen .

One Trackback

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>