Linux/Ubuntu中的OpenCV安装
OpenCV Installation in Linux/Ubuntu
我正在做这个教程http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-安装但我很困惑。我停止了从源代码构建OpenCV。
我已经创建了一个名为Workspace的文件,在其中我制作了cmake_binary_dir(命名版本)。我下载了源文件(它在我的主目录中,名为:opencv-2.3.1),现在我想运行这个
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
我使用的位置:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/markus/opencv-2.3.1
但是终端一直告诉我,这个源目录不存在!?那么我做错了什么?
CMAKE_INSTALL_PREFIX定义二进制文件编译和链接后的分发位置,默认为好位置(/usr/local/),因此避免将其定义为
你漏掉了拖尾部分。。在你的cmake命令中,它告诉它在哪里获得源代码,因此错误消息
以下是从源代码安装使用cmake 的任何项目时的典型步骤
如果你看到一个文件:
CMakeLists.txt
在src目录中,这表示它希望您使用cmake
0 cd into dir where your expanded source code lives
1 mkdir build # make a build dir (initially empty)
2 cd build
3 cmake .. # NOTE those little .. which declares relative path to src dir
which says populate current dir (build) with compiled code
and get the source code and configs from parent directory (..)
4 examine the output, if it looks successful go to step 5
if it has errors you may need to install upstream dependent
libraries then try cmake again
5 make -j4 # compile source, -j speeds up by using multicore
6 sudo make install <-- only if above step 4 and 5 are OK
您可以从命令行完成cmake相关的所有操作,但它的GUI非常方便,尤其是在不熟悉的项目中。在上面而不是键入:
cmake ..
其GUI版本为:
cmake-gui ..
在GUI中,它很容易切换开/关设置,比如构建示例或不构建示例。。。右边的值列是可编辑的。。。如果您在gui中更改了底部的设置,请点击按钮Configure
,然后当它完成时,点击Generate
以执行与正常cmake ..
相同的操作,现在返回到上面的步骤4以执行编译
相关文章:
- 安装opencv失败-粘贴CMakeError.log的内容
- Mingw-64 在构建和安装后不会编译 openCV 代码
- 如何在 Ubuntu 上安装 OpenCV for C/C++
- C++:如何在Windows 10上使用编译器MinGW 9.2.0安装OpenCV
- OpenCV 安装错误:没有这样的文件或目录"pyopencv_generated_include.h"
- 如何为 opencv 安装 gstreamer 1.0 坏插件?
- OpenCV 检查计算机上是否安装了视频编解码器 (C++)
- yocto opencv w/ gstreamer安装问题
- 在VSCODE和OPENCV中编辑C 项目,而无需安装整个库
- 如何构建和安装 OpenCV+contrib .so 库 for Android
- 如何在Mac上安装C 的OPENCV并使用NetBean配置
- 如何在不安装的情况下将opencv源文件作为cmake依赖项包括在内
- 安装额外模块openCV后未定义跟踪器
- 使用libstdc 在自制中安装OpENCV 3
- OpenCV 安装,未解析的外部符号
- Linux/Ubuntu中的OpenCV安装
- OpenCV 安装错误 Ubuntu
- OpenCV 安装 VS 10 无法构建
- Python的OpenCV安装问题
- OpenCV 3.0安装错误