Full Process of OpenCV2.3.0 installation and configuration compilation under Ubuntu12.04

Source: Internet
Author: User
Tags gtk
After several days of efforts, we have initially completed the installation and use of opencv2.3.0. Record the process to help others. First of all, the step is to download and compile opencv. According to the idea provided by this great god, it is easier to install and compile opencv. The main steps are as follows: 1. Download opencv decompress opencv2, enter the decompressed directory, create a directory for storing the compiled file, and retrieve the directory name by yourself, my name is release3. I don't remember which version of opencv will be used after compilation.

After several days of efforts, we have initially completed the installation and use of opencv2.3.0. Record the process to help others.

First of all, the step is to download and compile opencv. According to the idea provided by this great god, it is easier to install and compile opencv. The main steps are as follows:

1. Download opencv and decompress opencv

2. Enter the decompressed directory and create a directory for storing the compiled files. The directory name is obtained by yourself. The name I used is release.

3. Do not remember which version of opencv is used, and the pre-compilation configuration will no longer use the configure file. Instead, use cmake to check whether cmake is installed in your system.

4. Go to the directory we just created and run cmake

5. make & make install.

It is particularly prompted that you need to install a library, or you will find a problem during running.

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, file/home/bush/OpencvSrc/OpenCV-2.3.0/modules/highgui/src/window. cpp, line 275

Terminate called after throwing an instance of 'cv: exception'

What ():/home/bush/OpencvSrc/OpenCV-2.3.0/modules/highgui/src/window. cpp: 275: error: (-2) 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 function cvNamedWindow

The cause information of the problem has prompted you to install libgtk2.0-dev and pkg-config. It is not difficult to enter the following command. Pkg-config has been installed in the system.

The command corresponding to the above steps is

1,
Wget http://nchc.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.3/OpenCV-2.3.0.tar.bz2

Tar-xvf OpenCV-2.3.0.tar.bz2

2,

Cd OpenCV-2.3.0
Sudo mkdir relese
Cd relese
Sudo apt-get install libgtk2.0-dev

3. Check whether cmake is installed in your system. If not, install the command on your own.

Sudo apt-get install cmake

I usually write the installation and compilation processes in the script,

######################################## #################################
# File Name: Install_cmake.sh
# Author: ma6174
# Mail: ma6174@163.com
# Created Time: Friday, January 1, February 28, 2014
######################################## #################################
#! /Bin/bash


######################################## ######
# FunctionName: echocolor
# Author: bush2582
# Role: the output will have color
# Created Time:
######################################## ######
Echocolor ()
{
Echo-e "\ e [0; 33 m $ {@} \ e [0 m ";
}

 

######################################## ######
# FunctionName: InstallGCC
# Author: bush2582
# Role: check g ++ is already in system
# Created Time:
######################################## ######
Function InstallGCC ()
{
 
Which g ++;
If [$? -Eq 1];
Then
Read-p "g ++ is not installed in this system do you want to install? (Y/y/n/N) "ynInstall_GCC;

If [$ ynInstall_GCC = "Y"] | [$ ynInstall_GCC = "y"];
Then
# Echo "now we will install g ++ ";
Echocolor "now we will install g ++"
Sudo apt-get install g ++;
Fi
Else
Echocolor "g ++ already install in this system ";
Fi
}
######################################## ######
# FunctionName: InstallCmake
# Author: bush2582
# Role: install Cmake
# Created Time:
######################################## ######

Function InstallCmake ()
{
InstallGCC;
Echocolor "now we will star the program that CMake is installed in this system ";
Cd cmake-2.8.0;
./Configure;
Sudo make;
Sudo make install;
Exit 0;
}

 


######################################## #################################
Read-p "Do you want to download Cmake? (Y/y/n/N )? "Downyn
If [$ downyn = "Y"] | [$ downyn = "y"];
Then
Wget http://down1.chinaunix.net/distfiles/cmake-2.8.0.tar.gz;
Echocolor "now Staring Tar cmake ";
Tar-xvf cmake-2.8.0.tar.gz;
Else
Echocolor "now Staring Tar cmake ";
Tar-xvf cmake-2.8.0.tar.gz;
Fi

Read-p "Do you want to install camke now (Y/y/n/N )? "Yn
If [$ yn = "y"] | [$ yn = "Y"];
Then
InstallCmake;
Else
Exit 0;
Fi

3. Here/usr/local/opencv is the path I customized to install in the system

Sudo cmake-D CMAKE_BUILD_TYPE = RELEASE-D CMAKE_INSTALL_PREFIX =/usr/local/opencv-D BUILD_PYTHON_SUPPORT = ON ..

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

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.