• OpenCV


    OpenCV 教程

    http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/tutorials.html#opencv

    # Installation in Linux

    Build core modules

    # Install minimal prerequisites (Ubuntu 18.04 as reference)
    sudo apt update && sudo apt install -y cmake g++ wget unzip
    # Download and unpack sources
    wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
    unzip opencv.zip
    # Create build directory
    mkdir -p build && cd build
    # Configure
    cmake ../opencv-master
    # Build
    cmake --build .

    Build with opencv_contrib

    # Install minimal prerequisites (Ubuntu 18.04 as reference)
    sudo apt update && sudo apt install -y cmake g++ wget unzip
    # Download and unpack sources
    wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
    wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/master.zip
    unzip opencv.zip
    unzip opencv_contrib.zip
    # Create build directory and switch into it
    mkdir -p build && cd build
    # Configure
    cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules ../opencv-master
    # Build
    cmake --build .
    
    

    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):

    sudo make install
     

    Build samples

    # C
    export C_INCLUDE_PATH=/usr/local/include/opencv4:$C_INCLUDE_PATH
    # CPP
    export CPLUS_INCLUDE_PATH=/usr/local/include/opencv4:$CPLUS_INCLUDE_PATH
     
    cd samples/cpp/example_cmake
    mkdir build
    cd build
    cmake ..
    make
     
     
    Cross compilation for ARM based Linux systems
     

    # 环境变量

    【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

     
  • 相关阅读:
    string用法
    动手动脑
    你已经创建了多少个对象?
    动手动脑
    课程作业2
    课程作业1
    课程作业2
    《大道至简》第一章观后感
    java虚拟机内存区域
    Gitbook安装使用教程
  • 原文地址:https://www.cnblogs.com/dong1/p/14751279.html
Copyright © 2020-2023  润新知