Posted By Tommy

Compiling OpenCV 2.0 with Visual Studio 2010

I had a couple of troubles setting up OpenCV 2.0 in Microsoft Visual Studio 2010. I simply updated the working build from VS 2008. It had been working fine. So the first thing I found out that there was an error with “std::back_inserter”. The problem is that it was part of the standard package, but now it’s not. This trouble affects two files: “cvmodelest.ccp” and cvhog.cpp” so it’s easily cured by adding 

#include <iterator> 

to cv.h. somewhere around line 60.

Another problem I encountered was a crash with videoInput.lib. It seems that it’s been compiled with VS2005 and it’s source code is not included. So with a bit of research I found that it’s not exactly a necessary thing to include anyway, so I followed the instructions:

# On Windows: enabling the VideoInput library:

The libvideoInput.a library file provided by Willow Garage was built with the old SJLJ exception handling method. Therefore, you cannot link against it using compilers that use the new DWARF-2 exception handling method like MinGW 4.4.x, unless you rebuild the libvideoInput.a file using MinGW. The best bet for compilers using DWARF-2 is not to use VideoInput at all. This can be done by taking the following step:

1. Comment the line containing “#define HAVE_VIDEOINPUT 1″ (i.e. near line 101 or 105), in file src/highgui/_highgui.h.

In contrast, for old compilers using SJLJ like TDM, to have VideoInput included in OpenCV 2.0:

1. Edit file src/highgui/CMakeLists.txt
2. At line 199, insert ” ole32 oleaut32 uuid” at the end of the list of libraries to be linked against (i.e. after “videoInput strmiids”). The developers have forgotten to insert them.

Responses to this post » (3 Total)

  1. Tom Anderson says:

    By the way, if you follow step number 1 above, then you will lose access to the videoInput.dll that allows you to capture from the webcam. So I’m not convinced that it’s the best method for fixing the problem.

    So far I’ve been able to compile OpenCV2.10 with VS2010, and the tests are almost all passing, which is a good sign, but nonetheless, not everything works properly when I want to use the highgui and the webcam. I’m having to go back to OpenCV2.0 and VS2008, which is a bit of a bother. I hope to get more acquainted with this problem later but for now I really need my project to work!!! So I’m not bothering with forcing the upgrade to VS2010 just yet.

  2. Christophe says:

    I created a video tutorial on compiling and configuring OpenCV 2.1.0 with TBB support for Visual Studio 2010, you can find it here:

  3. Tommy says:

    This is a great video. There are some really helpful tips he mentions on the way, so it’s valuable to arch even for somebody who knows about setting up the Visual Studio environment. Also, TBB wont work foe all versions of OPENCV, so Christophe points out exactly where to get them. Watch this video!

Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Tags Comment Meta:
RSS Feed for comments
TrackBack URI