OpenCV 编译:1)lopencv_viz vtk 模块;2)提升编译速度
Posted cx2016
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV 编译:1)lopencv_viz vtk 模块;2)提升编译速度相关的知识,希望对你有一定的参考价值。
精华:
mkdir build cd build cmake .. -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_OSX_DEPLOYMENT_TARGET= -DBUILD_JASPER=ON -DBUILD_JPEG=ON -DBUILD_OPENEXR=ON -DBUILD_PERF_TESTS=OFF -DBUILD_PNG=ON -DBUILD_TESTS=OFF -DBUILD_TIFF=ON -DBUILD_ZLIB=ON -DBUILD_opencv_hdf=ON -DBUILD_opencv_java=ON -DBUILD_opencv_text=ON -DOPENCV_ENABLE_NONFREE=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_1394=ON -DWITH_CUDA=OFF -DWITH_EIGEN=ON -DWITH_FFMPEG=ON -DWITH_GPHOTO2=ON -DWITH_GSTREAMER=ON -DWITH_JASPER=ON -DWITH_OPENEXR=ON -DWITH_OPENGL=ON -DWITH_QT=ON -DWITH_TBB=ON -DWITH_VTK=ON -DVTK_DIR=/usr/local/Cellar/vtk/8.2.0_7/lib -DOPENCV_EXTRA_MODULES_PATH=/Users/CarolH/git/opencv_contrib/modules -DBUILD_opencv_python2=ON -DBUILD_opencv_python3=ON -DCMAKE_PREFIX_PATH="$(brew --prefix qt5);$(brew --prefix vtk)" sudo make -j8 sudo make install |
|
opencv
https://stackoverflow.com/questions/24985713/opencv-undefined-symbols-for-architecture-x86-64-error
g++ $(pkg-config --cflags --libs opencv4) -std=c++11 test.cpp -o Test
https://segmentfault.com/a/1190000019604411
PKG_CONFIG_PATH="~/usr/local/Cellar/release/unix-install"
https://blog.csdn.net/qq_22073849/article/details/88893201
Warning: opencv@3 dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
==> Caveats
opencv@3 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have opencv@3 first in your PATH run:
echo ‘export PATH="/usr/local/opt/opencv@3/bin:$PATH"‘ >> ~/.zshrc
For compilers to find opencv@3 you may need to set:
export LDFLAGS="-L/usr/local/opt/opencv@3/lib"
export CPPFLAGS="-I/usr/local/opt/opencv@3/include"
For pkg-config to find opencv@3 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/opencv@3/lib/pkgconfig"
==> Summary
?? /usr/local/Cellar/opencv@3/3.4.9_1: 670 files, 214MB
|
|
|
|
https://stackoverflow.com/questions/2197223/where-are-the-opengl-header-files-located-on-macosx
Linux下OpenGL的安装与cmake编译OpenGL程序
https://blog.csdn.net/SarKerson/article/details/78068417
https://github.com/gillesboisson/vscode_opengl_glfw_template
https://bbs.guaik.org/topic/34/mac%E9%85%8D%E7%BD%AEopengl%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83-cmake
Mac配置OpenGL开发环境(CMake)
https://zhuanlan.zhihu.com/p/57699829
Mac OSX系统CMake、QT5运行OpenCV 4.0
https://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/
https://blog.csdn.net/TH_NUM/article/details/87887115
Mac CLion配置OpenCV环境
https://github.com/gaoxiang12/slambook/issues/113
https://www.dazhuanlan.com/2019/12/07/5deaf1305b77e/
export PKG_CONFIG_PATH="/usr/local/opt/opencv@3/lib/pkgconfig"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
cp /usr/local/opt/opencv@3/lib/pkgconfig/opencv.pc /usr/local/lib/pkgconfig/
https://www.dazhuanlan.com/2019/12/07/5deaf1305b77e/
https://blog.csdn.net/pikachu_777/article/details/83860100
mkdir build
cd build
cmake -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++"
-DCMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++"
-DCMAKE_OSX_DEPLOYMENT_TARGET=
-DBUILD_JASPER=ON
-DBUILD_JPEG=ON
-DBUILD_OPENEXR=ON
-DBUILD_PERF_TESTS=ON
-DBUILD_PNG=ON
-DBUILD_TESTS=ON
-DBUILD_TIFF=ON
-DBUILD_ZLIB=ON
-DBUILD_opencv_hdf=ON
-DBUILD_opencv_java=ON
-DBUILD_opencv_text=ON
-DOPENCV_ENABLE_NONFREE=ON
-DWITH_1394=ON
-DWITH_CUDA=ON
-DWITH_EIGEN=ON
-DWITH_FFMPEG=ON
-DWITH_GPHOTO2=ON
-DWITH_GSTREAMER=ON
-DWITH_JASPER=ON
-DWITH_OPENEXR=ON
-DWITH_OPENGL=ON
-DWITH_QT=ON
-DWITH_TBB=ON
-DWITH_VTK=ON
-DOPENCV_EXTRA_MOULES_PATH=
-DBUILD_opencv_python2=ON
-DBUILD_opencv_python3=ON
-DPYTHON3_EXECUTABLE=#{which "python3"}
-DPYTHON3_LIBRARY=#{py3_config}/libpython#{py3_version}.dylib
-DPYTHON3_INCLUDE_DIR=#{py3_include}
..
sudo make -j4
sudo make install
|
|
|
|
mkdir build
cd build
cmake .. -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_OSX_DEPLOYMENT_TARGET= -DBUILD_JASPER=ON -DBUILD_JPEG=ON -DBUILD_OPENEXR=ON -DBUILD_PERF_TESTS=ON -DBUILD_PNG=ON -DBUILD_TESTS=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON -DBUILD_opencv_hdf=ON -DBUILD_opencv_java=ON -DBUILD_opencv_text=ON -DOPENCV_ENABLE_NONFREE=ON -DWITH_1394=ON -DWITH_CUDA=ON -DWITH_EIGEN=ON -DWITH_FFMPEG=ON -DWITH_GPHOTO2=ON -DWITH_GSTREAMER=ON -DWITH_JASPER=ON -DWITH_OPENEXR=ON -DWITH_OPENGL=ON -DWITH_QT=ON -DWITH_TBB=ON -DOPENCV_EXTRA_MOULES_PATH= -DBUILD_opencv_python2=ON -DBUILD_opencv_python3=ON -DCMAKE_PREFIX_PATH="$(brew --prefix qt5);$(brew --prefix vtk)"
sudo make -j4
sudo make install
cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)
This works for me, and it‘s simpler than the solution on the Cockatrice wiki:
QT5_DIR=$(brew info --installed qt5 | grep "^$(brew --cellar qt5)" | cut -d‘ ‘ -f1)
cmake .. ... -DCMAKE_PREFIX_PATH=$QT5_DIR/
mkdir build
cd build
cmake .. -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libc++" -DCMAKE_OSX_DEPLOYMENT_TARGET= -DBUILD_JASPER=ON -DBUILD_JPEG=ON -DBUILD_OPENEXR=ON -DBUILD_PERF_TESTS=OFF -DBUILD_PNG=ON -DBUILD_TESTS=OFF -DBUILD_TIFF=ON -DBUILD_ZLIB=ON -DBUILD_opencv_hdf=ON -DBUILD_opencv_java=ON -DBUILD_opencv_text=ON -DOPENCV_ENABLE_NONFREE=ON -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_1394=ON -DWITH_CUDA=OFF -DWITH_EIGEN=ON -DWITH_FFMPEG=ON -DWITH_GPHOTO2=ON -DWITH_GSTREAMER=ON -DWITH_JASPER=ON -DWITH_OPENEXR=ON -DWITH_OPENGL=ON -DWITH_QT=ON -DWITH_TBB=ON -DWITH_VTK=ON -DVTK_DIR=/usr/local/Cellar/vtk/8.2.0_7/lib -DOPENCV_EXTRA_MODULES_PATH=/Users/CarolH/git/opencv_contrib/modules -DBUILD_opencv_python2=ON -DBUILD_opencv_python3=ON -DCMAKE_PREFIX_PATH="$(brew --prefix qt5);$(brew --prefix vtk)"
sudo make -j8
sudo make install
|
|
|
|
https://blog.csdn.net/ding977921830/article/details/46799043
史上最全opencv源码解读,opencv源码详细解读目录
|
|
|
|
https://stackoverflow.com/questions/30004850/cmake-does-not-find-opencv-libraries
https://www.jianshu.com/p/71345b565297
Mac下编译用于iOS平台的OpenCV及OpenCV_Contrib Framework
https://www.jianshu.com/p/162f2cdf4f88
OpenCV macOS:编译安装OpenCV4+Opencv Contrib
http://bbs.cvmart.net/articles/192/vote_count?
一文看懂OpenCV4 新特性
https://zhuanlan.zhihu.com/p/45043308
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Users/CarolH/Downloads/opencv-4.2.0/build/unix-install
https://blog.csdn.net/weixin_43562948/article/details/103956901
macOS版homebrew+VScode配置opencv(c/c++)亲测可用
https://blog.csdn.net/sunzhao1000/article/details/103185875
Ubuntu环境下VScode配置OpenCV的C++开发环境
https://blog.csdn.net/qq_22073849/article/details/88895786
MAC visual Studio Code 运行调试c/c++ 配置(完美解决)
官方安装教程:
https://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html
ubuntu安装opencv viz模块
https://blog.csdn.net/ljl1015ljl/article/details/102363139
以上是关于OpenCV 编译:1)lopencv_viz vtk 模块;2)提升编译速度的主要内容,如果未能解决你的问题,请参考以下文章
openCV编译的程序运行时error while loading shared libraries
armubuntu mate下配置qt与opencv最快捷的方法