Hope for a long time Fedora21 finally released. First, let's take a picture:
The default desktop is still simple:
All right, don't talk nonsense. Take a look at setting up the OPENCV development environment under Fedora, because I've built it (the process is hard)
First mention the reference article, thank the Blogger:
Http://www.cnblogs.com/gala/archive/2011/10/10/2206529.html
Here's what I wrote.
General: Because the main reference is the official document set up, so if there is no problem I took directly.
1. Various dependency relationships:
GCC 4.4.x or later. (according to the installation of GCC and g++ in the way of the Internet to search the installation method is good)
Git (because if you are cloning from GitHub source code, you must use this, if you have downloaded the compressed package, you can ignore this, of course, installation is not difficult)
Python 2.6 or later and Numpy 1.5 or later with developer packages (Python-dev, python-numpy); (This is the normal installation, it is best to download Numpy source code yourself, Otherwise the network installation will be very slow and cumbersome)
The last libjasper was found, so there was no Ann.
All dependencies are now installed. Here are the installation links:
Unzip the download OpenCV source package to get a directory:
After entering this directory, create a new folder under the directory named release
Enter the release directory (of course in the terminal), now empty,
Then execute the following command
cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d Build_python_support=on.
Note the last two points that represent the previous level of the directory don't forget. (Command I was executed with sudo)
If there is no error after completion (note is error, warning no matter)
Perform:
Make Make Install
In this case make is the main, if make error, it must be corrected after the re-make. Of course not the character is particularly bad should be able to make out. This is a long process and it's better to prepare something else to pass the time.
Here is the Add library path:
sudo vim/etc/ld. so.conf.d/opencv.conf Add the following content /usr/local/lib
Then you need to update the system library:
sudo ldconfig
Set environment variables: in a personal or system configuration file, you can:
Export Pkg_config_path=/usr/local/lib/pkgconfig: $PKG _config_path
In addition, you need to do the following before testing:
sudo cp/usr/local/lib/pkgconfig/opencv.pc/usr/lib/pkgconf
is to copy the Pkg-config file to the global directory.
Here is the test code from the document:
DisplayImage.cpp
1#include <stdio.h>2#include <opencv2/opencv.hpp>3 4 using namespaceCV;5 6 intMainintargcChar**argv)7 {8 if(ARGC! =2 )9 {Tenprintf"usage:DisplayImage.out <image_path>\n"); One return-1; A } - - Mat image; theImage = Imread (argv[1],1 ); - - if( !image.data) - { +printf"No image data \ n"); - return-1; + } ANamedwindow ("Display Image", cv_window_autosize); atImshow ("Display Image", image); - -Waitkey (0); - - return 0; -}
Create a new file named CMakeLists.txt with the following:
1 2.8 )2Project (displayimage)3find_package (OpenCV REQUIRED)4 add _executable (displayimage displayimage. CPP )5 target_link_libraries (displayimage ${opencv_libs})
Copy two files to the same directory (preferably create a new project directory)
Execute the following command under the terminal in this directory:
Be careful not to forget the point behind the cmake that represents the current directory.
There is no problem after the direct:
No problem after executing the program to view the results:
This is done, of course, we can also go into the source code comes with the example of testing, here is not much to say.
Because it is only the initial configuration, so there may be a lot of problems, if there are problems in the future I will record the supplementary.
Readers are welcome to discuss.
Above.
OpenCV a brief introduction to the development environment under Linux (Fedora)