EricLYang / ORB-SLAM2-Example

This is an example and simple version of ORB-SLAM
Other
6 stars 6 forks source link

opencv > 2.4.3 not found #3

Open KMShein opened 3 years ago

KMShein commented 3 years ago

I have install the 2.4.11 and 4.5.2 into my virtual box (Ubuntu). It's still giving me the error of not finding the 2.4.3. Would you please le me know how to solve it and where exactly should we put that opencv?

EricLYang commented 3 years ago

Since you installed 2.4.11, you need to update the CMakeLists.txt https://github.com/EricLYang/ORB-SLAM2-Example/blob/master/CMakeLists.txt

find_package(OpenCV 2.4.11 REQUIRED)

Same DBoW2 https://github.com/EricLYang/ORB-SLAM2-Example/blob/master/Thirdparty/DBoW2/CMakeLists.txt

find_package(OpenCV 3.0 QUIET)if(NOT OpenCV_FOUND) find_package(OpenCV 2.4.3 QUIET) if(NOT OpenCV_FOUND) message(FATAL_ERROR "OpenCV > 2.4.3 not found.") endif()endif()
KMShein commented 3 years ago

opcv The compatible version was not found and also 4.5.2 versions were considered but not accepted. Is there any steps that I was missing? I really appreciate your help. Thanks.

EricLYang commented 3 years ago

If you know where is 2.4.11, you should specify the path manually, check here https://stackoverflow.com/questions/49816206/cmake-find-package-specify-path/49816516

KMShein commented 3 years ago

I tried it with "exact required" and added the path. It was not accepted as well. Do you know where to download the 2.4.3 version? 22

EricLYang commented 3 years ago

can you attach your CMakeList.txt ?

KMShein commented 3 years ago

Of course. I have attached both below. Thanks for replying.

On Sun, May 23, 2021 at 4:47 PM Liang Yang @.***> wrote:

can you attach your CMakeList.txt ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EricLYang/ORB-SLAM2-Example/issues/3#issuecomment-846622312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUFZ6VAHEWYAPF6O43TUOODTPFSURANCNFSM45LEAATQ .

cmake_minimum_required(VERSION 2.8) project(ORB_SLAM2_PCL_MAP)

IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release) ENDIF()

MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")

Check C++11 or C++0x support

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") add_definitions(-DCOMPILEDWITHC11) message(STATUS "Using flag -std=c++11.") elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") add_definitions(-DCOMPILEDWITHC0X) message(STATUS "Using flag -std=c++0x.") else() message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif()

LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

find_package(OpenCV 4.5.2 REQUIRED /home/kaung/Desktop/FinalProject/Programs/opencv-4.5.2) find_package(OpenCV 4.5.2 QUIET) if(NOT OpenCV_FOUND) find_package(OpenCV 4.5.2 QUIET) if(NOT OpenCV_FOUND) message(FATAL_ERROR "OpenCV > 2.4.3 not found.") endif() endif()

find_package(Eigen3 3.1.0 REQUIRED) find_package(Pangolin REQUIRED)

for pcl map

find_package(PCL 1.7 REQUIRED )

include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include ${EIGEN3_INCLUDE_DIR} ${Pangolin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} )

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

add_library(${PROJECT_NAME} SHARED src/System.cc src/Tracking.cc src/LocalMapping.cc src/LoopClosing.cc src/ORBextractor.cc src/ORBmatcher.cc src/FrameDrawer.cc src/Converter.cc src/MapPoint.cc src/KeyFrame.cc src/Map.cc src/MapDrawer.cc src/Optimizer.cc src/PnPsolver.cc src/Frame.cc src/KeyFrameDatabase.cc src/Sim3Solver.cc src/Initializer.cc src/Viewer.cc src/SystemSetting.cc src/InitKeyFrame.cc src/Camera.cc src/pointcloudmapping.cc )

target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${EIGEN3_LIBS} ${Pangolin_LIBRARIES} ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o.so ${PCL_LIBRARIES} -lboost_system )

Build examples

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/RGBD_excutable)

add_executable(rgbd_tum rgbd_camera/rgbd_tum.cc) target_link_libraries(rgbd_tum ${PROJECT_NAME})

cmake_minimum_required(VERSION 2.8) project(DBoW2)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")

set(HDRS_DBOW2 DBoW2/BowVector.h DBoW2/FORB.h DBoW2/FClass.h
DBoW2/FeatureVector.h DBoW2/ScoringObject.h
DBoW2/TemplatedVocabulary.h) set(SRCS_DBOW2 DBoW2/BowVector.cpp DBoW2/FORB.cpp
DBoW2/FeatureVector.cpp DBoW2/ScoringObject.cpp)

set(HDRS_DUTILS DUtils/Random.h DUtils/Timestamp.h) set(SRCS_DUTILS DUtils/Random.cpp DUtils/Timestamp.cpp)

find_package(OpenCV 4.5.2 REQUIRED /home/kaung/Desktop/FinalProject/Programs/opencv-4.5.2) find_package(OpenCV 4.5.2 QUIET) if(NOT OpenCV_FOUND) find_package(OpenCV 4.5.2 QUIET) if(NOT OpenCV_FOUND) message(FATAL_ERROR "OpenCV > 2.4.3 not found.") endif() endif()

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

include_directories(${OpenCV_INCLUDE_DIRS}) add_library(DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS}) target_link_libraries(DBoW2 ${OpenCV_LIBS})

KMShein commented 3 years ago

Those two CMakeList gave me the following response.

On Sun, May 23, 2021 at 7:41 PM leon leon @.***> wrote:

Of course. I have attached both below. Thanks for replying.

On Sun, May 23, 2021 at 4:47 PM Liang Yang @.***> wrote:

can you attach your CMakeList.txt ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EricLYang/ORB-SLAM2-Example/issues/3#issuecomment-846622312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUFZ6VAHEWYAPF6O43TUOODTPFSURANCNFSM45LEAATQ .

EricLYang commented 3 years ago

can you try

find_package(OpenCV 2.4.11 REQUIRED /path/to/2.4.11)

opencv 3 is not supported

KMShein commented 3 years ago

I tried it with 4.5.2 and it worked but now i am having the another problem of "opencv/cv.h : no such file or directory". I think it came from ORBextractor.h. I tried comment it out in ORBextractor.h but it gave even worse errors.

On Mon, May 24, 2021 at 1:05 AM Liang Yang @.***> wrote:

can you try

find_package(OpenCV 2.4.11 REQUIRED /path/to/2.4.11)

opencv 3 is not supported

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EricLYang/ORB-SLAM2-Example/issues/3#issuecomment-846739308, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUFZ6VA55BJTPONQDZQXOMDTPHNBTANCNFSM45LEAATQ .