Installing OpenCV in Ubuntu 14.10

冷暖自知 提交于 2019-11-30 07:36:06

Unless you have special reasons I would suggest installing the OpenCV that are already in the Ubuntu repository: sudo apt-get install libopencv-dev

For video codecs I suggest simply trying to install all ffmpeg and gstreamer related codec packages.

Installing OpenCV from the Ubuntu repositories is a good choice for the most cases, but sometimes you need build OpenCV from sources yourself.

For example, if you need OpenCV's non-free functionality, or want to contribute to this project (you should use the latest version to create pull request), or want to change something (yes, OpenCV can also contain bugs).

Possible solution is building ffmpeg (it's rather simple) - I really don't understand why Debian/Ubuntu prefers libav without alternative.

For installing ffmpeg you should download its sources from official site or clone GIT repository (git://source.ffmpeg.org/ffmpeg.git), then enter source directory and run

./configure --enable-shared --disable-static
make
sudo make install

you can also add other parameters to configure. You can build static libraries too, but OpenCV can't be built with static ffmpeg libraries (now I don't know why).

After this you can download OpenCV sources from OpenCV site or clone GitHub repository (OpenCV repository), create build folder and run from it the following:

cmake PATH_TO_SOURCES -DCMAKE_BUILD_TYPE=Release
make
sudo make install

Of course, PATH_TO_SOURCES must be actual path to your OpenCV sources.

After these steps you have working latest OpenCV build in your system.

You can try to build without a ffmpeg:

cmake -DCMAKE_BUILD_TYPE=RELEASE -DWITH_FFMPEG=OFF ..
make
sudo make install
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!