Check If Opencv Is Compiled with Tbb

Check if OpenCV is compiled with TBB

Print the shared library dependencies of *libopencv_core* using ldd:

ldd /usr/local/lib/libopencv_core.so

And you should see TBB on the list.

If you were on Mac OS X the equivalent is otool -L, and on my system it outputs:

/Users/karlphillip/installers/OpenCV-2.4.2/build/lib/libopencv_core.2.4.dylib (compatibility version 2.4.0, current version 2.4.2)
libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

So according to the output above, my OpenCV installation was built to support TBB. ;D

Is there a way to know the options with which OpenCV was installed?

Yes, there is a way. You can use getBuildInformation().

import cv2
print(cv2.getBuildInformtion())

In case of cpp,

...
std::cout << cv::getBuildInformation() << std::endl;
...

This will return information about cmake settings, version control, compiler flags, third-party libraries etc related to opencv installation.

How to find in CMAKE file if OpenCV is compiled with CUDA

Here is the list of CMake variables, that can help you:

OpenCV_COMPUTE_CAPABILITIES - compute capability from which OpenCV has been compiled, can be added to nvcc flags.

list(APPEND CUDA_NVCC_FLAGS ${OpenCV_COMPUTE_CAPABILITIES})

OpenCV_CUDA_VERSION - CUDA toolkit version which was used to build OpenCV, if OpenCV was built without CUDA support, the variable is empty. You can check this variable:

if(OpenCV_CUDA_VERSION)
# Have CUDA support
endif()

OpenCV_USE_CUBLAS - true if OpenCV was built with CUBLAS support

OpenCV_USE_CUFFT - true if OpenCV was built with CUFFT support

OpenCV_USE_NVCUVID - true if OpenCV was built with NVCUVID support

How to install opencv with tbb enabled using mingw

I had the same problem, the following worked out for removing the tbb linking error:

(Assuming you have already built tbb, as you are already explaining in your question)

  • From CMake, configure one time OpenCV

  • Enable WITH_TBB, be careful not enabling BUILD_TBB: the automatic downloading and building of OpenCV failed miserably for me despite many efforts. If you had previously enabled BUILD_TBB, my suggestion is to restart from the beginnning, clearing cmake cache.

  • Configure a second time OpenCV

  • Now some variables should appear: TBB_INCLUDE_DIRS. For me I set the following values (respectively):

    tbb41_20130314oss/include

  • 2 new variables appears: TBB_STDDEF_PATH and TBB_LIB_DIR. They are assigned some apparently reasonable values. For me, TBB_STDDEF_PATH was correct, but TBB_LIB_DIR was not! So I corrected it to be:

    tbb41_20130314oss/build/windows_ia32_gcc_mingw4.8.1_release

    and I left TBB_STDDEF_PATH as it was:

    tbb41_20130314oss/include/tbb/tbb_stddef.h

  • Configure a third time

  • Finally, click Generate, and you are ready to build mingw32-make -j7

  • Once you start using the opencv library, make sue the tbb DLLs are in your path

How to know if SSE2 is activated in opencv

You can check if SSE2 is enabled with the function checkHardwareSupport like:

#include <opencv2/opencv.hpp>
#include <iostream>

int main()
{
cv::setUseOptimized(true); // Turn on optimization (if it was disabled)

// Get other build information
//std::cout << cv::getBuildInformation();

// Check SSE2 support
std::cout << cv::checkHardwareSupport(CV_CPU_SSE2);

return 0;
}


Related Topics



Leave a reply



Submit