如何在 Raspberry Pi 上使用 TBB 构建 OpenCV? [英] How do I build OpenCV with TBB on Raspberry Pi?
问题描述
我正在尝试使用 TBB 构建 OpenCV 以启用多线程.
I am trying to build OpenCV with TBB to enable multi-threading.
注意:我能够从源代码构建 OpenCV-2.4.10无 TBB,然后使用 OpenCV Python 绑定.
Note: I am able to build OpenCV-2.4.10 without TBB from source and then use the OpenCV Python bindings.
当我尝试全新安装并在安装了 TBB 的情况下构建 OpenCV 时,WITH_TBB=ON
标志我无法 import cv2
- 我将此视为构建过程中出现问题.
When I try a fresh install and building OpenCV with TBB installed the WITH_TBB=ON
flag I am then unable to import cv2
- I take this to mean something has gone wrong in the build process.
这是我尝试这样做的方法:
Here's how I'm trying to do it:
# Download, unpack and build TBB:
wget -O ~/tbb43_20150316oss_src.tgz --no-check-certificate https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb43_20150316oss_src.tgz
tar -xvzf tbb43_20150316oss_src.tgz
cd tbb43_20150316oss
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"
# Build OpenCV:
cmake -D WITH_TBB=ON -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON ..
make -j4
推荐答案
只是为了其他人正在寻找相同问题的解决方案,我获得了成功,只是要求为我构建 TBB 的 cmake 实用程序:
Just for others looking for solution for the same problem, I got success just asking for the cmake utility for build TBB for me:
cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_TBB=ON (more options) ..
在那之后,cmake 下载了 TBB,我得到了类似的东西:
After that, cmake downloaded TBB and I got something like:
Parallel framework: TBB (ver 4.4 interface 9003)
在我的 cmake 输出中.我正在使用 Pixel 运行 Raspbian Jessie 环境.希望这会有所帮助.
in my cmake output. I'm running a Raspbian Jessie environment with Pixel. Hope this helps.
这篇关于如何在 Raspberry Pi 上使用 TBB 构建 OpenCV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!