CGAL install

CGAL

UBUNTU16.04 , EAO-SLAM-Final install failed.

Error:

CMake Error at CMakeLists.txt:73 (find_package):
  By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "CGAL", but
  CMake did not find one.

  Could not find a package configuration file provided by "CGAL" with any of
  the following names:

    CGALConfig.cmake
    cgal-config.cmake

  Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
  "CGAL_DIR" to a directory containing one of the above files.  If "CGAL"
  provides a separate development package or SDK, be sure it has been
  installed.

Solve:

ref:CSDN

sudo apt-get install libcgal-dev
apt-get install libcgal-demo

Other problem in SLAM install

use opencv 4.5.1

In file included from /home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/include/KeyFrame.h:29:0,
                 from /home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/include/MapPoint.h:16,
                 from /home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/include/Frame.h:18,
                 from /home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/Frame.cc:13:
/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/include/ORBextractor.h:26:23: fatal error: opencv/cv.h: 没有那个文件或目录
 #include 

&&&

/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/box_proposal_detail.cpp: In member function ‘void detect_3d_cuboid::detect_cuboid(const cv::Mat&, const Matrix4d&, const MatrixXd&, Eigen::MatrixXd, std::vector<std::vector<cuboid*> >&):
/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/box_proposal_detail.cpp:81:37: error: ‘CV_BGR2GRAY’ was not declared in this scope
     cv::cvtColor(rgb_img, gray_img, CV_BGR2GRAY);
                                     ^
/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/box_proposal_detail.cpp:239:52: error: ‘CV_DIST_L2’ was not declared in this scope
    cv::distanceTransform(255 - im_canny, dist_map, CV_DIST_L2, 3); // dist_map is float datat
                                                    ^
CMakeFiles/ORB_SLAM2.dir/build.make:569: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/detect_3d_cuboid/box_proposal_detail.cpp.o' failed

ref: [CSDN],[csdn].

/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/box_proposal_detail.cpp: In member function ‘void detect_3d_cuboid::detect_cuboid(const cv::Mat&, const Matrix4d&, const MatrixXd&, Eigen::MatrixXd, std::vector<std::vector<cuboid*> >&):
/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/box_proposal_detail.cpp:242:52: error: ‘COLOR_DIST_L2’ is not a member of ‘cv’
    cv::distanceTransform(255 - im_canny, dist_map, cv::COLOR_DIST_L2, 3);
                                                    ^
CMakeFiles/ORB_SLAM2.dir/build.make:569: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/detect_3d_cuboid/box_proposal_detail.cpp.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/detect_3d_cuboid/box_proposal_detail.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Is “CV_DIST_L2” rather than “COLOR_DIST_L2”; add “#include

/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/object_3d_util.cpp: In function ‘void plot_image_with_cuboid_edges(cv::Mat&, const MatrixXi&, const MatrixXi&):
/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/src/detect_3d_cuboid/object_3d_util.cpp:151:21: error: ‘CV_AA’ was not declared in this scope
                     CV_AA, //CV_AA,

add “#include

make[2]: *** No rule to make target '/home/user/project/EAO-SLAM-master-improve/lib/deep_sort_lib/MOT-deepsort-master/lib/libdeepsort.so', needed by '../lib/libORB_SLAM2.so'。 停止。
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Solve

In “/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/lib/deep_sort_lib/MOT-deepsort-master”

sh makeall.sh

Obtain libdeepsort.so
In “/home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve” CMakeLists.txt

set(deep_sort_lib /home/user/project/EAO-SLAM-master-improve/lib/deep_sort_lib/MOT-deepsort-master/lib/libdeepsort.so)

change to myself path:

set(deep_sort_lib /home/k402/EAO-SLAM-Final/EAO-SLAM-master-improve/lib/deep_sort_lib/MOT-deepsort-master/lib/libdeepsort.so)

ERROR in RUN

build/mono_tum Full data/rgbd_dataset_freiburg3_long_office_household/ Vocabulary/ORBvoc.bin Examples/Monocular/TUM3.yaml online
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.1) /home/k402/dev/opencv451/opencv-4.5.1/modules/dnn/src/darknet/darknet_importer.cpp:207: error: (-212:Parsing error) Failed to parse NetParameter file: /home/user/project/EAO-SLAM-master-improve/yolov3.cfg in function 'readNetFromDarknet'

已放弃 (核心已转储)

Ref CSDN

Anther error:

In file included from /home/k402/dev/opencv451/opencv_contrib-4.5.1/modules/viz/src/clouds.cpp:46:0:
/home/k402/dev/opencv451/opencv_contrib-4.5.1/modules/viz/src/precomp.hpp:56:30: fatal error: vtkVersionMacros.h: 没有那个文件或目录
compilation terminated.
modules/viz/CMakeFiles/opencv_viz.dir/build.make:62: recipe for target 'modules/viz/CMakeFiles/opencv_viz.dir/src/clouds.cpp.o' failed
make[2]: *** [modules/viz/CMakeFiles/opencv_viz.dir/src/clouds.cpp.o] Error 1
CMakeFiles/Makefile2:4992: recipe for target 'modules/viz/CMakeFiles/opencv_viz.dir/all' failed
make[1]: *** [modules/viz/CMakeFiles/opencv_viz.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

solve

Ref CSDN [skip ,is bad , install new version maybe]

sudo apt-get install libvtk6-dev

Retun to EAO Build/ build
rebuild vtk, than->opencv, than ->eaoslam…
build opencv451

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv4 -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=ON -D PYTHON3_EXCUTABLE=/usr/bin/python -D PYTHON3_INCLUDE_DIR=/usr/include/python3.6m -D PYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so -D PYTHON_NUMPY_PATH=/usr/local/lib/python3.6/dist-packages/numpy/ -D WITH_VTK=ON ..

eao, cmake error:

The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.

solve ref link:

sudo ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so
sudo ln -s /usr/bin/vtk6 /usr/bin/vtk

Still error

/usr/include/vtk-6.2/vtkAtomicInt.h:307:28: error: reference to ‘detail’ is ambiguous
 class vtkAtomicInt: public detail::vtkAtomicIntImpl<T>

delete vtk and install new version: ref link

eao CMakeLists.txt

set(VTK_DIR /home/k402/dev/VTK-9.1.0/build)#path of VTK

ref [CSDN]
STILL Error:

/usr/local/include/pcl-1.8/pcl/visualization/impl/pcl_visualizer.hpp:603:24: error:class vtkMapper’ has no member named ‘ImmediateModeRenderingOn’
   actor->GetMapper ()->ImmediateModeRenderingOn ();
                        ^
/usr/local/include/pcl-1.8/pcl/visualization/impl/pcl_visualizer.hpp: In member function ‘bool pcl::visualization::PCLVisualizer::updatePointCloud(const typename pcl::PointCloud<PointT>::ConstPtr&, const string&):
/usr/local/include/pcl-1.8/pcl/visualization/impl/pcl_visualizer.hpp:1431:38: error:class vtkMapper’ has no member named ‘ImmediateModeRenderingOff’
   am_it->second.actor->GetMapper ()->ImmediateModeRenderingOff ();

注释掉相关行,ref [link]

放弃!!!!扛不住了。。。。

2021-11-21更新
重新安装pcl库

Checking for module 'libopenni2'
--   No package 'libopenni2' found
-- Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS) 
** WARNING ** io features related to openni2 will be disabled
-- Could NOT find ensenso (missing: ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
** WARNING ** io features related to ensenso will be disabled
-- Could NOT find DAVIDSDK (missing: DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
** WARNING ** io features related to davidSDK will be disabled
-- Could NOT find DSSDK (missing: _DSSDK_LIBRARIES) 
** WARNING ** io features related to dssdk will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
CMake Error at /usr/local/lib/cmake/vtk-8.2/VTKTargets.cmake:1019 (message):
  The imported target "vtksys" references the file

     "/usr/local/lib/libvtksys-8.2.so.1"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/local/lib/cmake/vtk-8.2/VTKTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/local/lib/cmake/vtk-8.2/VTKConfig.cmake:123 (include)
  /usr/local/share/pcl-1.8/PCLConfig.cmake:497 (find_package)
  /usr/local/share/pcl-1.8/PCLConfig.cmake:652 (find_VTK)
  /usr/local/share/pcl-1.8/PCLConfig.cmake:841 (find_external_library)
  CMakeLists.txt:47 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/k402/EAO-SLAM/build/CMakeFiles/CMakeOutput.log".
See also "/home/k402/EAO-SLAM/build/CMakeFiles/CMakeError.log".

ref [1]、[ 2 ]

重新安装vtk库和pcl

ref [ csdn,安装VTK,再编译PCL ]
vtk8.2.0, pcl1.8.0

PS:版本对应

编译PCL之前要安装VTK,试过pcl1.8+vtk8.2,编译失败,所以注意对应关系。根据经验,归纳如下:

  1. pcl-1.7.2 vtk-5.10.1 / vtk-6.2.0

  2. pcl-1.8.1 vtk-7.1.1

  3. pcl-1.9.1 vtk-8.2.0

来源:简书

选择编译安装,可能报错解决:solve

some skill: CMake的find_package指令详解:ref(zhihu)

skill:CMakeList.txt格式:【参考】

基础模板:

## This is a standard CMakeLists.txt template, including
## how to enable C++11 compiler option and how to set 'Release'
## target compile option

cmake_minimum_required(VERSION 2.8)
project(cmake_template)

############# Use message function to print information ############
message(STATUS "CMake version: ${CMAKE_VERSION}")

############ enable C++11 compiler###############
## Method 1
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
    message(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
    message(STATUS "Please use a different C++ compiler.")
endif()
## Method 2
set(CMAKE_CXX_STANDARD 11)


############ #enable warnings##################
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")


#############Set cmake compiler options##############
## Method 1
set(CMAKE_BUILD_TYPE "Release")

## Method 2
IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
      "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
      FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

################## Some useful arguments ##########################
set(CMAKE_INCLUDE_CURRENT_DIR ON)

##########
##Build###
##########
add_library(lib hello.cpp)

add_executable(main main.cpp)
target_link_libraries(main ${LINK_LIBRARIES})

使用OpenCV库CMakeLists文件模板

cmake_minimum_required(VERSION 2.8.12)
project(PCL_test)

#find packages
find_package(PCL 1.7 REQUIRED)
add_definitions(${PCL_DEFINITIONS})

#include headers
include_directories(${PCL_INCLUDE_DIRS})

#target generation
add_executable(PCL_test main.cpp)

#link libraries
target_link_libraries(PCL_test ${PCL_LIBRARIES}

使用Eigen库CMakeLists文件模板

cmake_minimum_required(VERSION 2.8.12)
project(Eigen_test)

#find packages
find_package(Eigen3 REQUIRED)

#include headers
include_directories(${EIGEN3_INCLUDE_DIR})

#target generation
add_executable(Eigen_test main.cpp)

安装Qt5 + VTK7.1.1 + PCL1.8.1

参考:知乎,CSDN,CSDN

2021年11月27日,OK!

VTK报错相关:1.vtk和pcl版本对应
2.

In file included from /usr/local/include/vtk-7.1/vtkAtomicTypes.h:18:0,
                 from /usr/local/include/vtk-7.1/vtkObjectBase.h:54,
                 from /usr/local/include/vtk-7.1/vtkSmartPointerBase.h:30,
                 from /usr/local/include/vtk-7.1/vtkSmartPointer.h:26,
                 from /usr/local/pcl181/include/pcl-1.8/pcl/visualization/point_cloud_geometry_handlers.h:48,
                 from /usr/local/pcl181/include/pcl-1.8/pcl/visualization/point_cloud_handlers.h:41,
                 from /usr/local/pcl181/include/pcl-1.8/pcl/visualization/common/actor_map.h:40,
                 from /usr/local/pcl181/include/pcl-1.8/pcl/visualization/pcl_visualizer.h:48,
                 from /usr/local/pcl181/include/pcl-1.8/pcl/visualization/cloud_viewer.h:39,
                 from /home/k402/EAO-SLAM-master-improve/src/pointcloudmapping.cc:13:
/usr/local/include/vtk-7.1/vtkAtomic.h:529:11: error: reference to ‘detail’ is ambiguous
   typedef detail::AtomicOps<sizeof(void*)> Impl;
           ^~~~~~
/usr/local/include/vtk-7.1/vtkAtomic.h:82:11: note: candidates are: namespace detail { }
 namespace detail

solve:ref 【csdn】

修改/usr/local/include/vtk-7.1/vtkAtomic.h中三处:

typedef detail::AtomicOps<...> ...

改为:

typedef ::detail::AtomicOps<...> ...

运行时报错:

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.1) /home/k402/dev/opencv-4.5.1/modules/dnn/src/darknet/darknet_importer.cpp:207: error: (-212:Parsing error) Failed to parse NetParameter file: /home/user/project/EAO-SLAM-master-improve/yolov3.cfg in function 'readNetFromDarknet'

主要原因:“ /home/user/project”路径问题

更改为自己的路径,在文件/home/k402/EAO-SLAM-master-improve/include/yolo_track/yolov3.h:

const string image_path = "/home/user/project/EAO-SLAM-master-improve/test.png";//待检测图片
const string darknet_cfg = "/home/user/project/EAO-SLAM-master-improve/yolov3.cfg";//网络文件
const string darknet_weights = "/home/user/project/EAO-SLAM-master-improve/yolov3.weights";//训练模型
const string class_names = "/home/user/project/EAO-SLAM-master-improve/coco.names";

将其中所有的“/home/user/project”更改为“/home/k402”

CUDNN安装

安装、查看版本

OpenCV带CUDA和contrib编译安装

参考:CSDN
Ubuntu18.04,CUDA:11.5,CUDNN:8.3.0(根据官网匹配版本)
OpenCV官网(进入GitHub)下载OpenCV_Contrib-4.5.1对应版本,放到OpenCV文件夹内。

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv4 -D OPENCV_EXTRA_MODULES_PATH=/home/k402/dev/opencv-4.5.1/opencv_contrib-4.5.1/modules/ -D CUDA_CUDA_LIBRARY=/usr/local/cuda-11.5/targets/x86_64-linux/lib/stubs/libcuda.so -D CUDA_ARCH_BIN=7.5 -D CUDA_ARCH_PTX="" -D WITH_CUDA=ON -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_NVCUVID=ON -D BUILD_opencv_cudacodec=OFF ..

部分参考:【部分】
CUDA_ARCH_BIN=显卡算力的值,依据官网计算方法:【算力计算】
ps:不带cuda安装,另建立build1文件夹:

cmake -D CMAKE_INSTALL_PREFIX=/usr/local/opencv4 -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D ENABLE_CXX11=1 -D OPENCV_ENABLE_NONFREE=True ..

重新编译工程后中断,错误如下:

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.1) /home/k402/dev/opencv-4.5.1/modules/dnn/src/dnn.cpp:2373: error: (-216:No CUDA support) OpenCV was not built to work with the selected device. Please check CUDA_ARCH_PTX or CUDA_ARCH_BIN in your build configuration. in function 'initCUDABackend'

已放弃 (核心已转储)

Solve Try1:

查看CUDA_ARCH_BIN(显卡算力)是多少【查看】,采用其中第二种方式,输出结果:

k402@k402:~/dev/deepstream_tlt_apps/TRT-OSS/x86$ ./deviceQuery
Detected 1 CUDA Capable device(s)
Device 0: "NVIDIA GeForce RTX 3050 Laptop GPU"
  CUDA Driver Version / Runtime Version          11.5 / 11.5
  CUDA Capability Major/Minor version number:    8.6

算力是8.6,不是在官网查的7.5.
故重新编译OpenCV4.5.1,新建build-CUDA文件夹:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv4 -D OPENCV_EXTRA_MODULES_PATH=/home/k402/dev/opencv-4.5.1/opencv_contrib-4.5.1/modules/ -D CUDA_CUDA_LIBRARY=/usr/local/cuda-11.5/targets/x86_64-linux/lib/stubs/libcuda.so -D CUDA_ARCH_BIN=8.6 -D CUDA_ARCH_PTX="" -D WITH_CUDA=ON -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_NVCUVID=ON -D BUILD_opencv_cudacodec=OFF ..

运行时发生段错误,定位在Viewer.cc中:

“cv::namedWindow(“Raw Image”);”处。寻找原因:【CSDN】、【cv::namedWindow是非线程安全的】

重新再建build111编译OpenCV4.5.1

cmake时警告:

CMake Warning (dev) at /usr/local/share/cmake-3.12/Modules/FindOpenGL.cmake:270 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  cmake/OpenCVFindLibsGUI.cmake:76 (find_package)
  CMakeLists.txt:698 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

解决:【CSDN】
在cmakelist文件中加入下面内容:

if (POLICY CMP0072)
  set(OpenGL_GL_PREFERENCE LEGACY)
endif()

你可能感兴趣的:(V-SLAM,opencv,toolkit,自动驾驶)