Download Opencv2.4.4.exe (other also available)
Unzip and install to d:/. The root directory. I named it for d:/opencv244, which contains a folder such as build.
Create a new project in Eclipse HELLOCV
(You can refer to the website steps
http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html)
I am a little bit different from the official website configuration. Two steps in the countdown.
The steps are as follows:
Right-click on Project--build path--configure build Path
Select the user library after selecting the Add library.
Next follow the instructions in user libraries
Select New
The name of your own version is 2.4.4, so take a name ~
Select the red circle option below
This time select Opencv-244.jar this thing under the OpenCV folder you installed. For me it is under the d:/opencv244.
The specific path is D:\opencv244\opencv\build\Java inside
Then select Native Library location Select Edit
Next Select D:/opencv244/build\java\x86
Note here the path must be careful, is the build of the Java x86. My classmates saw the x86 on the bottom of the build, and then the old error.
Note that if it is a 64-bit machine, choose x64, which is d:/opencv244/build\java\x64
My machine is 64-bit, the beginning of the selection of x86 error.
Then ok ok ok.
Then create a new test file Main.java
[Java]View PlainCopy
- Import org.opencv.core.*;
- public class Main {
- public static void Main (string[] args) {
- System.out.println ("Welcome to OpenCV" + core.version);
- System.loadlibrary (Core.native_library_name);
- Mat m = Mat.eye (3, 3, CVTYPE.CV_8UC1);
- System.out.println ("m =" + M.dump ());
- }
- }
Run to see the output
Proved successful ...
Finally, thanks to Sina netizens http://blog.sina.com.cn/s/blog_7b4a5b550101ifi7.html
Simple Eclipse Configuration OpenCV method