UBUNTU 14.04 Installation OPENCV 2.4.9

Source: Internet
Author: User

1. Download source code from opencv.org Opencv-2.4.9.zip

2. Unzip to the prepared directory

Unzip Opencv-2.4.9.zip

3. Enter the source directory and create the release directory

    CD opencv-2.4.9    mkdir release  

4. Install the pre-installed software

sudo apt-get install build-essential cmake libgtk2.0-dev pkg-config python-dev python-numpy Libavcodec-dev Libavformat-dev Libswscale-dev  

Why are these? From CMakeLists.txt, I don't know now.

5. Go to the release directory and install OpenCV All files will be placed in this release directory

CD release  

6. CMake Compile OpenCV source code, install all LIB files will be installed in the/usr/local directory

Cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local.  

7. Compiling and installing

8. Test, create a test.cpp file in a directory

#include <cv.h>#includeusing namespaceCV; intMainintargcChar*argv[])      {Mat image; Image= Imread (argv[1],1); if(ARGC! =2|| !image.data) {printf ("No Image data\n"); return-1; } Namedwindow ("Display Image", cv_window_autosize); Imshow ("Display Image", image); Waitkey (0); return 0; }

9. Write a cmake makefile, also known as CMakeLists.txt

Project (test)  find_package (OpenCV REQUIRED)  add_executable (test test)  target_link_libraries (test ${opencv_libs})  2.8)

10. Compile + Run

CMake.    Make  

Pay attention to CMake "." Get test executable after executing instruction

11. Do a random jpg picture to do a test, note to the above executable file in the same directory, my name here is test.jpg.

12. Execute the following command if you can see the picture, it means success.

./test   Test.jpg   

[ tested successfully on compatible machine 1 ]

Reference:

http://my.oschina.net/u/1757926/blog/293976http://blog.csdn.net/qust_waiwai/article/details/43890339http:// Www.cnblogs.com/fische/p/4094390.html

  

UBUNTU 14.04 Installation OPENCV 2.4.9

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.