OpenCV 教程
http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/tutorials.html#opencv
# Installation in Linux
Build core modules
Build with opencv_contrib
By default OpenCV will be installed to the /usr/local
directory, all files will be copied to following locations:
/usr/local/bin
- executable files/usr/local/lib
- libraries (.so)/usr/local/cmake/opencv4
- cmake package/usr/local/include/opencv4
- headers/usr/local/share/opencv4
- other files (e.g. trained cascades in XML format)
Since /usr/local
is owned by the root user, the installation should be performed with elevated privileges (sudo
):
Build samples
export C_INCLUDE_PATH=/usr/local/include/opencv4:$C_INCLUDE_PATH
# CPP
export CPLUS_INCLUDE_PATH=/usr/local/include/opencv4:$CPLUS_INCLUDE_PATH
# 环境变量
【1】include头文件路径
# C
export C_INCLUDE_PATH=XXXX:$C_INCLUDE_PATH
# CPP
export CPLUS_INCLUDE_PATH=XXX:$CPLUS_INCLUDE_PATH
【2】link链接库文件路径
-fPIC -shared
-fPIC -static
链接库文件的搜索路径指定有两种方式:1)修改/etc/so.ld.conf 2)修改环境变量,在其中添加自己的路径
1)在环境变量中添加
动态链接库搜索路径:
export LD_LIBRARY_PATH=XXX:$LD_LIBRARY_PATH
静态链接库搜索路径:
export LIBRARY_PATH=XXX:$LIBRARY_PATH
以上修改可以直接命令行输入(一次性),可以在/etc/profile中完成(对所有用户生效),也可以在用户home目录下的.bashrc或.bash_profile中添加(针对某个用户生效),修改完后重新登录即生效。
2)在/etc/ld.so.conf 中添加指定的链接库搜索路径(需要root权限),然后运行 /sbin/ldconfig,以达到刷新 /etc/ld.so.cache的效果。
以上两种方式均可以达到指定链接库搜索路径的效果。
###
海思平台OpenCV编译与进一步裁剪
https://zhuanlan.zhihu.com/p/198457743?utm_source=org.mozilla.firefox_beta