19 Jun 2010 @ 6:24 PM 
 

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:

http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=9199

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

Tags Tags: , , , ,
Categories: Programming, Research
Posted By: Tommy
Last Edit: 19 Jun 2010 @ 06 24 PM

E-mailPermalink
 

Responses to this post » (One Total)

 
  1. Tom Anderson said...
    6:24 pm - June 22nd, 2010

    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.

 

Leave 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=""> <strike> <strong>
\/ More Options ...
Change Theme...
  • Users » 2
  • Posts/Pages » 170
  • Comments » 8
Change Theme...
  • VoidVoid
  • LifeLife « Default
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLight
  • No Child Pages.
  • No Child Pages.
  • No Child Pages.