Eclipse + Java + opencv246 environment setup and code Testing

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.