Common Problems and Solutions
This section contains problems that may be encountered in the project and their solutions.
1. Missing OpenCV library or header file
Problem
The following error occurs when compiling:
fatal error: opencv2/opencv.hpp: No such file or directory
Solution
Make sure OpenCV is installed correctly.
Add the path of OpenCV in the CMake configuration:
cmake .. -DCMAKE_PREFIX_PATH=/path-to-opencv
2. Dataset path error
Problem
The following error occurs when running the program:
Error: Cannot find image at ./data/left/0000000000.png
Solution
Check whether the data directory exists.
Make sure the path in
main.cpp
is consistent with the actual data storage location.
3. Image display abnormality
Problem
The image window does not appear or is blank when the program is running.
Solution
Make sure the environment supports GUI (such as X11 or Wayland).
In a server environment, use
ssh -X
to enable the graphical interface.
4. Other errors during compilation
Link error
undefined reference to cv::xxx
Solution: Make sure the OpenCV library is linked correctly.
C++ standard version incompatible
error: ‘auto’ is not allowed in C++98
Solution: Enable C++11 in CMake configuration:
cmake .. -DCMAKE_CXX_STANDARD=11
Last updated