Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ To compile and install OpenCV-2.3.1 FFmpeg-2.1.2 under CentOS     - About redis in Replication (Database)

- Installation and operation GAMIT software under Linux operating system (Linux)

- CentOS 5.8 (64) Python 2.7.5 installation error resolved (Linux)

- The Java way to stop a thread of execution (Programming)

- Oracle capability i / o (stress test database server i / o performance) (Database)

- Ubuntu 14.04 / 14.10 how to install FFmpeg 2.5.1 (Linux)

- Configuring Android NDK development environment for Mac OS X (Linux)

- How to Install Redis server on CentOS 7 (Server)

- Linux virtual memory and physical memory (Linux)

- Java multithreading easy to confuse the concept (Programming)

- Oracle multi-user concurrency and transaction processing (Database)

- Linux suffered SYN flood attack setting (Linux)

- Ubuntu Series Installation Docker (Linux)

- Java to achieve local fileCopy (Programming)

- Nagios plugin installation tutorial of Nrpe (Linux)

- C language keywords Comments (Programming)

- VMware installed Linux system and JDK deployment (Linux)

- MySQL master-slave database configuration and error handling Raiders (Database)

- Linux C source code (Ascii HexToBinary: Converts hexadecimal string format ASCII codes) (Programming)

- Compare Oracle MySQL (ICP) index condition pushdown is described (Database)

  To compile and install OpenCV-2.3.1 FFmpeg-2.1.2 under CentOS
  Add Date : 2018-11-21      
  Tested environment:

1.CentOS 6.3 32bit
2.CentOS 6.5 64bit

Once in CentOS 6.3 32bit installed OpenCV, see CentOS 6.3 installed OpenCV2.3.1, now for a 64bit system, bold, and do it again.

Check for and install the relevant procedures to ensure gtk successful installation, or can not display pictures

yum install gcc-c ++ # g ++ compiler
yum install gtk-devel # anyway gtk God horse, not necessarily gtk-devel, you can use * gtk-devel * Match
yum install gimp-devel
yum install gimp-devel-tools
yum install gimp-help-browser
yum install zlib-devel
yum install libtiff-devel # tiff image format support
yum install libjpeg-devel # jpeg image support
yum install libpng-devel # png image support
Multimedia data yum install gstreamer-devel # handle MP3, Ogg, MPEG1, MPEG2, AVI and other formats
yum install libavc1394-devel # 1394 audio interface control command set
yum install libraw1394-devel
yum install libdc1394-devel
yum install jasper-devel
yum install jasper-utils
yum install cmake # compiler convenient tool to build OpenCV
yum install swig
yum install python # python environment support
yum install libtool
yum install nasm # compilation tools

 Installation ffmpeg2.1.2

ffmpeg no ready-made package for CentOS rpm, so the need to use the source code to compile and install,

./configure --enable-shared -disable-yasm
make install

 At this time, ffmpeg installed by default to / usr / local below.

Install OpenCV-2.3.1
CMakeLists.txt use vi open the file, find the following line after his comment (#)


CMakeLists.txt use vi open files, search keywords ffmpeg, find the corresponding position,

if (EXISTS /usr/include/ffmpeg/libavformat/avformat.hOR HAVE_FFMPEG_SWSCALE)

 Confirm the above directory is / usr / include, if you install ffmpeg, modify the path, make the appropriate changes, and now we can not move.

Opencv source code to write home directory, followed by the implementation

mkdir release
cd release
cmake ../
make install

Wait for the end of the installation, the default installation location to / usr / local /.


#include < cv.h>
#include < highgui.h>

using namespace cv;
int main (int argc, char ** 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;

Write Makefile,

SRC = DisplayImage.cpp
LIB = -L / usr / local / lib /
INC = -I / usr / local / include / opencv /
Test: $ (SRC)
g ++ -o Test $ (LIB) $ (INC) -lopencv_core -lopencv_highgui -lopencv_ml $ ^

Execute make, no errors. Continue to run, / Test {ImagePathName}, the error "can not link to a dynamic library", roughly as follows:

error while loading shared libraries: libopencv_core.so.2.3: can not open shared object file: No such file or directory


cd /etc/ld.so.conf.d/ # this folder to store a variety of dynamic link library path information
vim usr-lib.conf

Add the following information (lib path where the opencv)

/ Usr / local / lib

Execute ldconfig command to save the file.

Re-run, no problem, call it a day.
- Teach you self-built Linux firewall free (Linux)
- Linux fast set ip bond (Linux)
- Use libcurl library download url image (Programming)
- Linux operating system Samba server configuration and use (Server)
- Linux disk and File System Concepts (Linux)
- Oracle TDE transparent data encryption (Database)
- Five programming fallacy (Programming)
- Use the dd command to the hard disk I / O performance test (Linux)
- Oracle view object space usage show_space (Database)
- stat Usage: Get permission to file the corresponding figures (Linux)
- Getting Started with Linux: Learn how to install and access CentOS 7 Remote Desktop on a VPS (Server)
- Ubuntu download install and configure Plank Dock (Linux)
- How to view the Linux graphics hardware information (Linux)
- Oracle user lock how to know what causes (Database)
- Android application security of data transmission security (Programming)
- Compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4 in (Linux)
- The hash function under OpenSSL (Linux)
- Bash Getopts - let your script supports command line parameters (Linux)
- How to install and configure in Ubuntu 14.10 'Weather Information Indicator' (Linux)
- RHEL5 multipath configuration (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.