Ask Your Question
1

Building OpenCV using Visual Studio 2013 OpenGL CUDA and TBB

asked 2015-01-05 09:13:13 -0500

Dmelladom gravatar image

updated 2015-01-05 09:39:29 -0500

Hello everybody and happy new year for those under gregorain calendar!

I have been trying to build OpenCV 2.4.10 on Windows 7 32bit using Visual Studio 2013 and it has been a real pain. Mostly, I think it is my lack of expertice what is making it so difficult. I have make some achivements but unfortunatelly it is not working 100%.

I would like to write a small manual not so focused on the step by step -it can be frustrating when one of those steps fails and you don't know how to reach the next one- and more focused on understanding what is happening on each step, why and what to expect when something goes wrong. I ask for your help, sure you have faced lot of them before and can explain why it is happening. I am downloading 3 to build with CMake 3.0.2 and Visual Studio 2013. I will update this thread as I take steps.

My aim is to build 2.4.10 with CUDA, TBB and OpenGL support. And make it work :)

  • Clone OpenCV 2.4.10 (I am using TortoiseGit at C:\OpenCV\src\src)
  • Download TBB Compiled (link: TBB WindowsOS)
  • Unzip TBB in C:\OpenCV\src\opt\tbb
  • Unzip OpenCV source in C:\OpenCV\src dir
  • Open CMake and target source dir C:\OpenCV\src and built dir C:\OpenCV\built
  • Configure CMake for the first time
    • Select Visual Studio 12 2013, Use default native compilers for a configuration Win32
    • Select this options:
    • Under WITH tab:
      • WITH_CUDA (already checked)
      • WITH_OPENGL
      • WITH_TBB
  • And click configure again...

Here, OPENGL libs are found (opengl32 and glu32) and first missing paths appear (TBB_INCLUDE_DIRS), those for TBB_INCLUDE_DIRS, so:

  • Point that line to C:\OpenCV\src\opt\tbb\include and click configure again.

After that configuration process, TBB tab appears in red with LIB_DIR and STDDEF_PATH labels pointed to my TBB folder.

  • Click configure again to confirm the changes.

This time, there are no tag in red, and everything seems to be fine. I check the output and GUI OpenGL support is set to Yes, and so is Use TBB (ver 4.3 interface 8002) under Other third-party libraries, so

  • Click Generate to generate the Visual Studio files

Files are generated, so

  • Open Visual Studio 2013 and open OpenCV solution at C:\OpenCV\built and wait for it to be ready

  • Select Debug and then Build Solution (Ctrl+Shift+B) and wait...

First errors happen when it tries to find the core lib, so I re-run CMake for a simple build, without OpenGL, CUDA or TBB.

So, first question is, why is this happening? Should it not build first the core libs and then go ahead with the rest of libs?

I will keep updating as answers come and as I keep on going...

Thanks a lot everybody!

D!

edit retag flag offensive close merge delete

Comments

I have re ran CMake without CUDA, OpenGL and TBB and it builds OK. I am trying now, with the libs built, to re build with all the options

Dmelladom gravatar imageDmelladom ( 2015-01-05 08:20:15 -0500 )edit

Now, the problem is the path given by CMake to find the tbb libs is wrong.

Dmelladom gravatar imageDmelladom ( 2015-01-05 09:28:13 -0500 )edit

I think that tbb has 2 versions x32 and x64, so you need to be careful! If OpenGL is on 32, I think you shall get the source of TBB and build it on 32 bits too... Or get the OpenGL and glu on x64

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-01-05 09:50:33 -0500 )edit
1

Thanks a lot thdarksdfthmn. I am using th ai32 version of TBB. It is just a matter of path: if I correct it when building, it builds OK.

Dmelladom gravatar imageDmelladom ( 2015-01-05 10:05:14 -0500 )edit

Then that is the problem... Good luck!

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-01-05 10:34:21 -0500 )edit

Not just that. Once I have everything built, no OpenGL support is available. I will send more info shortly

Dmelladom gravatar imageDmelladom ( 2015-01-05 10:35:19 -0500 )edit

More problems: in addition to not finding the tbb libs, there are 2 more errors: error: namespace "std" has no member "max" in project opencv_gpu This did not happened before. This solves the problem: http://code.opencv.org/issues/4084

Dmelladom gravatar imageDmelladom ( 2015-01-07 03:25:07 -0500 )edit

Now, I have a bunch of errors regarding Intellisense. I am having trouble to find any information about it. What is Intellisense?

Dmelladom gravatar imageDmelladom ( 2015-01-07 04:01:49 -0500 )edit

Have you searched on Wiki? I think that is some other thing over there...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-01-07 04:04:51 -0500 )edit

I did, I was thinking about how it affects to building OpenCV

Dmelladom gravatar imageDmelladom ( 2015-01-07 04:58:50 -0500 )edit

The Intellisense problems disapeared after adding the include algorithm line, so no probs with that.

Dmelladom gravatar imageDmelladom ( 2015-01-07 05:07:43 -0500 )edit

This link is pretty useful: http://initialneil.wordpress.com/2014...

Dmelladom gravatar imageDmelladom ( 2015-01-07 05:24:54 -0500 )edit

Now it looks like I should have compiled with NVCUVID support, re-building again...

Dmelladom gravatar imageDmelladom ( 2015-01-07 09:43:23 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-01-07 09:42:37 -0500

Dmelladom gravatar image

This guide solved my problems with CUDA, OpenGL and TBB:

http://initialneil.wordpress.com/2014...

I hope it helps.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-01-05 07:58:24 -0500

Seen: 1,786 times

Last updated: Jan 07 '15