Install and use Java to develop OpenCV configurations in Linux
When I have time, I have finally developed OpenCV for Java in Eclipse in Linux and configured it for installation. Why did it take so long and I will talk about it slowly.
Compiling and installing OpenCV in Linux
First of all, install OpenCV in Linux is not troublesome, refer to the document can be completed: http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
You can perform the following steps:
1) install gcc, cmake, and other messy software (however, in Ubuntu, it's almost all there by default ...)
sudo apt-get install build-essential python-dev cmake
2) download opencv-2.4.8.zip and decompress it.
3) create a build folder
cd ~/opencvmkdir buildcd build
4) Enter:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..makesudo make install
The make command takes dozens of minutes to complete... and then theoretically ends... If java development is not required, it will be okay. For example, you can run the python code in the sample folder...
However, if you want to use java for development, you need to do so .....
Install opencv-java
This step is very DT, because there is a document on the official website, specifically on how to develop with java... http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html
1) First, install ant:
sudo apt-get install ant
2) Run cmake. The key is the cmake parameter. The official website provides the following information:
Export JAVA_HOME =/usr/lib/jvm/java-6-Oracle # cmake-DBUILD_SHARED_LIBS = OFF ..
Pay attention To the output. If "To be built" contains java, it should be OK.make -j8You can...
This is the most boring place. After running cmake with such a parameter, runmake -j8Always fail, saying there is an error .....
Found this is a BUG: http://code.opencv.org/issues/2859
Add the following parameters:-DBUILD_TESTS=OFFRight...
Therefore, the cmake parameter can be written as follows:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTS=OFF ..
3) Run cmake with the above parameters, and then:
make -j8sudo make install
In this way, make is successful...
How can I determine whether the installation is successful?
After the preceding operations, check whether there is a build folder in the bin directory.opencv-248.jarFile:
If so, the java component of opencv is successfully installed...
!! Note !! Cannot Use Windows OpenCV installation directory that opencv-248.jar !! The jar generated just now is different from the jar in Windows !! (I checked the MD5 code... in fact, the file size can also be seen !!)
Configuration in Eclipse
Here is a very good post, which is well written and I will not repeat it. Link:
This post is very good, but does not introduce the part of the compilation. Because the compilation process for installing java components is different from that provided on the official website, that's why I spent half a day !......
OpenCV official tutorial Chinese version (For Python) PDF
Install the required OpenCV2.4.1 package in Ubuntu Linux
Install OpenCV2.4.2 on Ubuntu 12.04
OpenCV in CentOS cannot read Video Files
Summary of installing OpenCV 2.4.5 in Ubuntu 12.04
Install OpenCv2.1 in Ubuntu 10.04
Face Recognition System Based on QT and OpenCV
Install OpenCV 2.4.9 in Ubuntu 14.04 and 13.10
OpenCV details: click here
OpenCV: click here
This article permanently updates the link address: