• How to solve multi-version conflict of OpenCV or PCL on ROS kinetic?


    20200909更新

    因为装了ros Kinetic,因此有opencv 3 以上的版本。直接locate

    locate opencv3
    

    即可看到

    /opt/ros/kinetic/share/opencv3
    /opt/ros/kinetic/share/opencv3/package.xml
    /usr/share/doc/ros-kinetic-opencv3
    /usr/share/doc/ros-kinetic-opencv3/changelog.Debian.gz
    /var/lib/dpkg/info/ros-kinetic-opencv3.list
    /var/lib/dpkg/info/ros-kinetic-opencv3.md5sums
    /var/lib/dpkg/info/ros-kinetic-opencv3.shlibs
    /var/lib/dpkg/info/ros-kinetic-opencv3.triggers
    

    但是直接把这些目录放在CMakeLists.txt中,还是不行。

    set (Opencv_DIR /opt/ros/kinetic/share/opencv3)
    find_package( OpenCV 3.1 REQUIRED )
    

    因为cmake需要找到文件OpenCVConfig.cmake。再locate一次

    locate OpenCVConfig.cmake
    

    /opt/ros/kinetic/share/OpenCV-3.3.1-dev/OpenCVConfig.cmake
    /usr/share/OpenCV/OpenCVConfig.cmake
    

    可以准确知道目录为

    set (OpenCV_DIR /opt/ros/kinetic/share/OpenCV-3.3.1-dev)
    find_package( OpenCV 3.1 REQUIRED )
    

    Solve multi-version conflict


    prepare: make sure you know which version is in your machine:

    pkg-config --modversion opencv 
    

    Note: If it don't work, try 'tab' before you type 'Enter'.


    • Install OpenCV 2.4.9 by typing command line:
    sudo apt-get install libopencv-dev
    
    • Set path in your CMakeLists.txt before 'find_package(OpenCV 2.4.9 REQUIRED)'
    set(OpenCV_DIR /usr/include/opencv2) 
    

    Note: According to your OpenCV location to modify it. If you don't know where it is, run the following commands in terminal. What was installed by command "apt-get install" usually is located in /usr/include/ .

    sudo updatedb
    locate OpenCVConfig.cmake
    
  • 相关阅读:
    (转载)博客园如何转载别人的文章
    python实现凯撒密码、凯撒加解密算法
    python新手学习可变和不可变对象
    Pycharm中配置远程Docker运行环境的教程图解
    python新手学习使用库
    python的help函数如何使用
    python编写softmax函数、交叉熵函数实例
    python能开发游戏吗
    python属于解释语言吗
    python的控制结构之For、While、If循环问题
  • 原文地址:https://www.cnblogs.com/linweilin/p/9895565.html
Copyright © 2020-2023  润新知