How do I build OpenCV with TBB?

theotherphil picture theotherphil · Nov 3, 2011 · Viewed 15.6k times · Source

I'm trying and failing to make opencv_traincascade use multiple threads. The only documentation I can find says to "build OpenCV with TBB". I'm not sure if I'm failing to successfully build OpenCV with TBB, or whether there's some flag I need to set for opencv_traincascade.

I've downloaded the OpenCV version 2.3.1 windows superpack and tbb40_20111003oss_win.zip, which I extracted to C:\tbb40_20111003oss. I then generated VC8 .sln and .proj files using CMake, setting

WITH_TBB: ON

TBB_INCLUDE_DIR:PATH=C:\tbb40_20111003oss\include

TBB_LIB_DIR:PATH=C:/tbb40_20111003oss/lib/intel64/vc8

OpenCV then builds without errors, but when I run opencv_traincascade it's singlethreaded. Does anyone know what I'm doing wrong?

Answer

Robert picture Robert · May 26, 2014

If you are on Mac you can do this with homebrew:

brew tap homebrew/science
brew install opencv --with-tbb

Or if you have already installed with homebrew:

brew uninstall opencv
brew install opencv --with-tbb

Also, the info command tells you about other flags you might be interested in, e.g. --with-java

brew info opencv