我在 ubuntu 16.04 中安装 opencv。安装完必要的先决条件后,我使用了以下命令:-

我在 ubuntu 16.04 中安装 opencv。安装完必要的先决条件后,我使用了以下命令:-
avi@avi-VPCEB46FG:~$ cd ~/opencv
avi@avi-VPCEB46FG:~/opencv$ cd build
avi@avi-VPCEB46FG:~/opencv/build$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..

OpenCV 安装过程中出现错误:

CMake Error: The source directory "/home/avi/opencv" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

ls /home/avi/opencv

avi@avi-VPCEB46FG:~$ cd ~/opencv
avi@avi-VPCEB46FG:~/opencv$ ls
build  opencv  opencv_contrib

之后ls /home/avi/opencv/opencv

avi@avi-VPCEB46FG:~/opencv$ cd opencv
avi@avi-VPCEB46FG:~/opencv/opencv$ ls
3rdparty  cmake           CONTRIBUTING.md  doc      LICENSE  platforms  samples
apps      CMakeLists.txt  data             include  modules  README.md
avi@avi-VPCEB46FG:~/opencv/opencv$ 

我该如何解决这个问题?

答案1

CMakeLists.txt文件位于文件夹中/home/avi/opencv/opencv。因此,要构建/home/avi/opencv/build(别名~/opencv/build),您应该使用:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ../opencv

相关内容