OpenCV Getting Started-Ubuntu 12.04 installation OpenCV

Source: Internet
Author: User

OpenCV Getting Started-Ubuntu 12.04 installation OpenCV


Originally intended to install OpenCV 3.0 on Ubuntu 12.04, the results of the following (2) in the error, do not know how to solve, so the end is to honestly install OPENCV 2.4.
(1) An error occurred at compile time:
In file included from/home/vonzhou/downloads/opencv-3.0.0-rc1/modules/videoio/src/cap_ffmpeg_impl.hpp:65:0,
FROM/HOME/VONZHOU/DOWNLOADS/OPENCV-3.0.0-RC1/MODULES/VIDEOIO/SRC/CAP_FFMPEG.CPP:45:
/home/vonzhou/downloads/opencv-3.0.0-rc1/modules/videoio/src/ffmpeg_codecs.hpp:171:7: Error:' av_codec_id_h263i ' is not declared in this scope
/home/vonzhou/downloads/opencv-3.0.0-rc1/modules/videoio/src/ffmpeg_codecs.hpp:287:7: Error: ' AV_CODEC_ID_WNV1 ' Was wasn't declared in this scope
MAKE[2]: * * * [MODULES/VIDEOIO/CMAKEFILES/OPENCV_VIDEOIO.DIR/SRC/CAP_FFMPEG.CPP.O] Error 1
FIX: The problem is ffmpeg, manually download and install (see here)
./configure--enable-shared--disable-static
Make
sudo make install
Then re-make our OpenCV.

(2) Error:
libopencv_videoio.so.3.0.0:undefined reference to "Avcodec_free_frame"
libopencv_videoio.so.3.0.0:undefined reference to ' Avcodec_encode_video2 '


To install the OPENCV 2.4.10 process:
(1) Install the necessary software;
(2) Download OpenCV and unzip;

(3) make, wait quietly;
Error occurred:
/home/vonzhou/downloads/opencv-2.4.10/modules/core/src/system.cpp:in function ' (Static initializers for/home/ Vonzhou/downloads/opencv-2.4.10/modules/core/src/system.cpp) ':
/home/vonzhou/downloads/opencv-2.4.10/modules/core/src/system.cpp:280:10:error:inconsistent operand constraints in an ' ASM '
[22%] Building CXX Object MODULES/CORE/CMAKEFILES/OPENCV_CORE.DIR/SRC/OPENGL_INTEROP_DEPRECATED.CPP.O
MAKE[2]: * * * [MODULES/CORE/CMAKEFILES/OPENCV_CORE.DIR/SRC/SYSTEM.CPP.O] Error 1
Resolution: This is a compiler-related issue, upgrade GCC or not resolved, you can replace the System.cpp file (see here).
(4) sudo make install
(5) configuration: sudo vi/etc/ld.so.conf.d/opencv.conf, adding content:
/usr/local/lib
Then: sudo ldconfig

(6) The installation is successful, and after rebooting, test it with your own sample code:
CD downloads/opencv-2.4.10/samples/c
./build_all.sh
Then run the Human Face test program:./facedetect

Running result: Your face will be identified and processed,:)


Reference:

Http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html
Upgrade GCC to 4.8 http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-ubuntu-14-04-lts/


OpenCV Getting Started-Ubuntu 12.04 installation OpenCV

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.