OpenCV learn & mark

安装

sudo apt-get install build-essential  # 安装gcc等
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev  # 安装图形显示库等

# 然后checkout最新的代码

cd ~/workspace
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

# 然后编译,安装
make
sudo make install

参照这个: https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation

这里基本上不会遇到问题,把一些依赖库装上就行。

Try example

参照这个: https://docs.opencv.org/2.4/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html

这里可能遇到的问题:

  1. 找不到 OpenCV 的 .cmake 文件,可能是只 make 编译了,没有执行 make install 安装 OpenCV。执行 sudo make install 即可。
  2. 执行例程的时候遇到 core dump: OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow …
    Aborted (core dumped)
    这种情况就是在没有安装 libgtk2.0-dev的情况下编译了OpenCV。只需要安装libgtk2.0-dev后重新编译安装OpenCV,再重新编译例程即可。

然后就可以看到花花公子中sexy的 Lenna 了(福利原图请点这 link):

这里写图片描述

猜你喜欢

转载自blog.csdn.net/gw569453350game/article/details/78742508