Ubuntu12.04 notes on compiling and installing OpenCV2.4.8

Source: Internet
Author: User
OpenCV2.4.8 was successfully installed recently because of learning needs. The local machine is installed on Ubuntu12.04, the cross-compilation environment is installed, and raspberrypi is installed. The installation was successful. I thought I could have had a good time with it. I brainstormed yesterday and re-installed my computer. Only when problems occur can we make progress. This time, I plan to re-install OpenCV based on my memory. Recommended: Ubuntu12.04 install OpenCV2.4.2http: // www. linuxidc

OpenCV2.4.8 was successfully installed recently because of learning needs. The local machine is installed on Ubuntu 12.04, the cross-compilation environment is installed, and raspberrypi is installed. The installation was successful. I thought I could have had a good time with it. I brainstormed yesterday and re-installed my computer. Only when problems occur can we make progress. This time, I plan to re-install OpenCV based on my memory.

Recommended reading:

Ubuntu 12.04 install OpenCV2.4.2 http://www.linuxidc.com/Linux/2012-09/70158.htm

OpenCV in CentOS cannot read video file http://www.linuxidc.com/Linux/2011-07/39295.htm

Summary of installing OpenCV 2.4.5 in Ubuntu 12.04Http://www.linuxidc.com/Linux/2013-06/86704.htm

Install OpenCv2.1 nine-step http://www.linuxidc.com/Linux/2010-09/28678.htm in Ubuntu 10.04

Http://www.linuxidc.com/Linux/2011-11/47806.htm of face recognition system based on QT and OpenCV

(Note: This is not an installation tutorial. If you want to install it, please take a look at Step 4 to save time)

Enter the subject:

1. The first step of eternity is to sacrifice the system (personal habits, not mandatory)

Sudo apt-get update
Sudo apt-get upgrade

2. Prepare tools

Sudo apt-get install cmake
Sudo apt-get install cmake-curses-gui

3. Start Installation
Copy the source code opencv2.4.8.zip downloaded from the official website to/home/own, cd to this directory, and run

Unzip opencv2.4.8.zip
Cd opencv2.4.8
Mkdir release
Cd release
Ccmake ../

After entering ccmake, press c to bring up the following interface:

I didn't change everything, so I changed BUILD_JPEG and BUILD_PNG to ON. All the others were default. Press c ON the keyboard, press g, and then return to the command line interface,

Make
Sudo make install

In this step, opencv has been installed almost. Next,

Sudo vim/etc/ld. so. conf. d/opencv. conf

Insert the path "/usr/local/lib" installed by opencv in the new file, and then

Sudo ldconfig

Now, opencv is installed.

Iv. Test

First, restart the computer. Of course, it would be better if you want to restart the computer (hopefully), and then execute,

CDS/home/own/opencv-2.4.8/samples/c
./Build_all.sh
./Find_obj

There should be no problem in the first build process, but an error occurs when the second script is executed, as shown in:

As prompted, some dependent files libgtk2.0-dev should be missing. Execute directly as prompted:

Sudo apt-get install libgtk2.0-dev

Then return to step 3, re-make and sudo make install, and then directly go to step 4 without restarting the computer (it is estimated that the computer is only

Make the/etc/ld. so. conf. d/opencv. conf file take effect), and then we will find that opencv can run normally.

5. Experiences

When we first installed opencv, we first installed a large number of dependent libraries (no less than 10) based on the online tutorials, and then installed them step by step, but I don't know why those libraries are required? In fact, it seems that many of them are not necessary, and, if necessary, they can be added in the future. Only after carefully installing the software can you learn how to compile and install the software required for customization on the linux platform.

The problem is not terrible. On the contrary, this is an opportunity for us to make progress. ------ Sharing with Jun

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Link: Http://www.linuxidc.com/Linux/2014-04/100112.htm

Related Article

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.