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     - shell script: the number of characters in the text to print no more than 6 words (Programming)

- MyCAT separate read and write to achieve MySQL Practice (Database)

- Oracle 10g after the failure to start the upgrade (Oracle instance terminated. Disconnection forced) (Database)

- VPS xen openvz kvm (Server)

- Eclipse installs support for Java 8 (Linux)

- Ubuntu 14.04 LTS NTFS partition can not access solution (Linux)

- Ubuntu 14.04 LTS to compile the source code Android4.4.2 (Linux)

- Make Linux more secure server tips (Linux)

- Installation and use Docker under Ubuntu 14.04 (Linux)

- Monitoring network traffic with Iptraf in Linux environment (Linux)

- Acting on JavaScript events (Programming)

- SLF4J Tutorial (Programming)

- Four safety delete files under Linux tools (Linux)

- Ubuntu 14.04 forget solution root password (Linux)

- Unix system security configuration (Linux)

- CentOS 6.6 shortcut command execution (Linux)

- How do I upgrade from Ubuntu 15.04 to Ubuntu 15.10 (Linux)

- RHEL5.x RHEL6.x replace CentOS yum source (Linux)

- Bash Automated Customization Linux belongs to its own CentOS system (Linux)

- Java Foundation - implicit conversion vs cast (Programming)

  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.
- Node.js developers must know four JavaScript concepts (Programming)
- 10 important Linux ps command combat (Linux)
- Docker study notes (Server)
- How to upgrade the kernel to 3.13.7 on Ubuntu / Linux Mint (Linux)
- Apache Tomcat integration and resin (Server)
- MySQL full-index scan bug (Database)
- Use GNU / Linux broadcasting of television programs (Linux)
- Linux and Windows Security Topics (Linux)
- Linux security configuration (Linux)
- How nodeclub constructed Docker image (Server)
- Linux remote wake the computer original code [C] (Linux)
- Nodejs mysql pool Example (Programming)
- How to run in support UDp Docker container JBoss data virtualization GA (Server)
- Use OpenSSL to generate a certificate detailed process (Linux)
- Linux Command Line Art (Linux)
- Btrfs file system creation and their characteristics in Linux (Linux)
- Linux file permissions bit forced bits and adventure Comments (Linux)
- Use rfkill soft-switching and Bluetooth wireless capabilities in Linux (Linux)
- Browser caching mechanism on the analysis (Linux)
- Lua non-blocking write log (Programming)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.