using openCV java with eclipse

Since version 2.4.4, (3.4.x) OpenCV supports Java. In this tutorial I will explain how to setup development environment for using OpenCV Java with Eclipse in Windows, so you can enjoy the benefits of garbage collected, very refactorable (rename variable, extract method and whatnot) modern language that enables you to write code with less effort and make less mistakes. Here we go.

Configuring Eclipse

First, obtain a fresh release of OpenCV from download page and extract it under a simple location like C:\OpenCV-2.4.6\. I am using version 2.4.6, but the steps are more or less the same for other versions.
Now, we will define OpenCV as a user library in Eclipse, so we can reuse the configuration for any project. Launch Eclipse and select Window –> Preferences from the menu.
1-window-preferences.png
Navigate under Java –> Build Path –> User Libraries and click New....
2-user-library-new.png
Enter a name, e.g. OpenCV-2.4.6, for your new library.
3-library-name.png
Now select your new user library and click Add External JARs....
4-add-external-jars.png
Browse through C:\OpenCV-2.4.6\build\java\ and select opencv-246.jar. After adding the jar, extend the opencv-246.jar and select Native library location and press Edit....
5-native-library.png
Select External Folder... and browse to select the folder C:\OpenCV-2.4.6\build\java\x64. If you have a 32-bit system you need to select the x86 folder instead of x64.
if you in Ubuntu 16.04, then you should choose : your-opencv-folder/build/lib
6-external-folder.png


then you can test your first openCV java program....

留言

這個網誌中的熱門文章

【多益】現點現做的英文怎麼說呢?

《Microsoft Word 應用》:圖片被文字蓋住解決方法,不可設定為固定行高

如何在Ubuntu系統上安裝Notepad ++ (Install Notepad++ On Ubuntu 16.04 / 17.10 / 18.04 / 20.04)