[Solved] ORB_SLAM3 Compile Error: opencv4.0 not found four

CMake Warning at CMakeLists.txt:33 (find_package):
  Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "4.4".

  The following configuration files were considered but not accepted:

    /usr/share/OpenCV/OpenCVConfig.cmake, version: 3.2.0



CMake Error at CMakeLists.txt:35 (message):
  OpenCV > 4.4 not found.


-- Configuring incomplete, errors occurred!
See also "/home/tys/ORB_SLAM3/build/CMakeFiles/CMakeOutput.log".
make: *** No target specified and no makefile found. Stop.

The content of the error report is as above. I found a solution, and there is a solution available.

LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

find_package(OpenCV 4.4)
   if(NOT OpenCV_FOUND)
      message(FATAL_ERROR "OpenCV > 4.4 not found.")
   endif()

Find the above location in CMakeList.txt in the ORB_SLAM3 folder and modify

find_package(OpenCV 4.4), as shown in the following code.

LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

find_package(OpenCV 3 REQUIRED)
   if(NOT OpenCV_FOUND)
      message(FATAL_ERROR "OpenCV > 4.4 not found.")
   endif()

Normal, so that the fault can be solved.

Read More: