Assume you have installed OpenCV Pack @ D:\opencv\
Firstly , New-->Java Project . Assume the project name is cv_helloworld
Then right click on the project "cv_helloworld" , click Properties
In the new window , select "Java Build Path" on the left , select "Libraries" on the right , then click "Add External JARs"
select D:\opencv\build\java\opencv-2410.jar , OK
then dobule-click "Native library location" , select D:\opencv\build\java\x64 , OK
Demo :
package cv_helloworld; import org.opencv.core.CvType; import org.opencv.core.Mat; public class Main { public static void main(String[] args) { System.loadLibrary("opencv_java2410"); Mat m = Mat.eye(3, 3, CvType.CV_8UC1); System.out.println("m = " + m.dump()); } }
enjoy it~
Reference:
http://docs.opencv.org/2.4.4-beta/doc/tutorials/introduction/desktop_java/java_dev_intro.html
时间: 2024-11-05 14:58:19