Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Ubuntu 12.04 installation OpenCV2.4.1 and compile test     - Linux automatic installation and implementation (Linux)

- Manually compile Hadoop 2.6.0 under Ubuntu 14.04 (Server)

- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)

- Zabbix configure DataGuard monitoring (Database)

- Linux Getting Started tutorial: Ubuntu 14.04 in the installation Sogou Pinyin (Linux)

- Oracle Database import and export combat (Database)

- SSH service configuration to use a certificate login Linux server (Server)

- Network Security: SYN attacks against under linux (Linux)

- How to clean up your Ubuntu 14.10 / 14.04 / 13.10 system (Linux)

- Linux bash: scp: command not found the problem (Linux)

- 32-bit and 64-bit integer in PHP and MySQL range (Database)

- Nginx version information hidden or modified (Server)

- Ubuntu prevent arp attacks (Linux)

- Hadoop safe hftp (Server)

- To install Google Chrome browser under Ubuntu 14.04 LTS (Linux)

- Linux terminal program running in the background (Linux)

- CentOS7 installation GAMIT and GMT (Linux)

- Linux system with a firewall to prevent the DOS attack (Linux)

- Nginx installation configuration Zabbix (Server)

- Oracle study notes view (Database)

 
         
  Ubuntu 12.04 installation OpenCV2.4.1 and compile test
     
  Add Date : 2018-11-21      
         
         
         
  Write on Ubuntu OpenCV application, does have many advantages, although initially configure the environment a little trouble. Now, I OpenCV2.4.1 in Ubuntu 12.04 LTS on environment configuration summarized as follows.

First, the Ubuntu system must first ensure that the system software is up to date for each. Just so

sudo apt-get update
sudo apt-get upgrade

Second, OpenCv will depend on a variety of packages, you need to install the next.

sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev

Third, it is to download and unzip followed OpenCv

wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.1/OpenCV-2.4.1.tar.bz2
tar -xvf OpenCV-2.4.1.tar.bz2
cd OpenCV-2.4.1

Of course there are other methods. For example, download the .zip, unzip it directly.

Fourth, then, the new folder and use cmake to compile.

mkdir build
cd build
cmake -D WITH_TBB = ON -D BUILD_NEW_PYTHON_SUPPORT = ON -D WITH_V4L = ON -D INSTALL_C_EXAMPLES = ON -D INSTALL_PYTHON_EXAMPLES = ON -D BUILD_EXAMPLES = ON -D WITH_QT = ON -D WITH_OPENGL = ON ..

This ready to compile and install OpenCv

make
sudo make install

Fifth, the configuration OpenCv.

sudo gedit /etc/ld.so.conf.d/opencv.conf

In the end of the file add / usr / local / lib, and execute

sudo ldconfig

Then open another file and add these lines at the end of

sudo gedit /etc/bash.bashrc

Add Content

PKG_CONFIG_PATH = $ PKG_CONFIG_PATH: / usr / local / lib / pkgconfig
export PKG_CONFIG_PATH

Sixth, and finally you need to restart or log out, to validate the configuration.

Next, the operation of several examples, test OpenCv

Before running the following example, we need to prepare for the next

cd ~ / OpenCV-2.4.1 / samples / c
chmod + x build_all.sh
./build_all.sh

cd ~ / OpenCV-2.4.1 / samples / c
chmod + x build_all.sh
./build_all.sh

./facedetect --cascade = "/ usr / local / share / OpenCV / haarcascades / haarcascade_frontalface_alt.xml" --scale = 1.5 lena.jpg

./facedetect --cascade = "/ usr / local / share / OpenCV / haarcascades / haarcascade_frontalface_alt.xml" --nested-cascade = "/ usr / local / share / OpenCV / haarcascades / haarcascade_eye.xml" --scale = 1.5 lena.jpg

The most important thing is how we write OpenCv compiled program.

Below, an example is given. Directly on the code

#include < highgui.h>
#include < iostream>
using namespace std;

int main (int argc, char ** argv)
{
  IplImage * image = cvLoadImage ( "lena.jpg");
  // If (argc < 2 || image == NULL)
  // {
  // Cout < < "No image data \ n";
  // Return -1;
  //}
  cvNamedWindow ( "Display Image", CV_WINDOW_AUTOSIZE);
  cvShowImage ( "Display Image", image);
  cvWaitKey (0);
  cvReleaseImage (& image);
  cvDestroyWindow ( "Display Image");
  return 0;
}

A brief explanation, pkg-config command requires .pc with a file. opencv is / usr / lib / pkgconfig folder following file is called Oh opencv.pc.

--cflags specified for compilation header files where to look, --libs indicating the connection process so the file where to look.
     
         
         
         
  More:      
 
- To install Docker under CentOS7 (Linux)
- Enterprise Hadoop cluster architecture - DNS installation (Server)
- build Android environment on Ubuntu 12.04 (Server)
- Learn to read the source code of vmstat (Linux)
- To install the latest version of Shotwell 0.18 under Ubuntu (Linux)
- CentOS Set the Mono environment variable (Server)
- Spring classic face questions Share (Programming)
- Java regular expressions examples (Programming)
- RedHat Linux 6.4 installation RTL8188CUS wireless network card driver (Linux)
- Configuring Proxy on a Unix terminal, accelerate Android Studio Construction (Linux)
- How to Set Free SSH password on CentOS / RHEL (Linux)
- To obtain installation package (RPM) under RHEL6 (Linux)
- Java Timer (regular calling, to achieve a fixed time to perform) (Programming)
- Oracle 11g new features of the collection of multi-column statistics (Database)
- Linux Getting Started tutorial: Borrow Windows fonts in Ubuntu 14.10 (Linux)
- Installation Flow N Play- interface stylized video player on Ubuntu (Linux)
- Delay for the specified IP port analog network to send and receive packets on Linux (Linux)
- Install DB2 V10 and Data Studio V3 under Linux (Ubuntu) environment (Database)
- OpenGL Programming Guide (8th edition of the original book) - compute shader (Programming)
- How to create a binary distribution with Bash (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.