1. First download opencv2.4.6. When downloading opencv2.4.6, select windows. Then install
2. In fact, the installation process is the decompression process, and there is no installation wizard or the like. After the installation is complete, we are most concerned with this directory: opencv \ build \ Java, as shown in
Note: opencv-246.jar is needed in the Java class library of opencv, but the true implementation is opencv_java246.dll (x86 and x64 points, the key depends on how many places your computer is)
3. Create a Java Project
4. Create a Java class with the following code:
Package COM. njupt. ZHB. test; import Org. opencv. core. cvtype; import Org. opencv. core. MAT; public class main {/*** @ Param ARGs */public static void main (string [] ARGs) {// todo auto-generated method stubsystem. loadlibrary ("opencv_java246"); mat m = mat. eye (3, 3, cvtype. cv_8uc1); system. out. println ("m =" + M. dump ());}}
5. Introduce the required jar package, namely: opencv-246.jar
6. Set the native library of the project, that is, the path of opencv_java246.dll.
7. The running result is:
Project download path: http://download.csdn.net/detail/nuptboyzhb/5961815
Not for commercial purposes without permission