|
OpenCV
Build instructions for OpenCV4Java
NativeLib
IntroductionQuote from the OpenCV Wiki : "OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real time computer vision." LicenseBSD-style : OpenCV License DownloadsSources available from OpenCV's SourceForge Project. Java wrappers with self-extracting binaries for MacOSX and Windows 32bits : OpenCV.jar Building
QuickstartHave a look at JNA's frontpage import cv.*;
import cxcore.*;
import highgui.*;
import ml.*;
import static cv.CvLibrary.*;
import static cxcore.CxcoreLibrary.*;
import static highgui.HighguiLibrary.*;
import static ml.MlLibrary*;
import static opencv.OpenCV.*;
public class Test {
public static void main(String[] args) {
try {
IplImage img = highgui.cvLoadImage(args[0], CV_LOAD_IMAGE_UNCHANGED);
highgui.cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE);
highgui.cvShowImage("Example1", new CvArr(img));
System.in.read();
//HighguiLibrary.INSTANCE.cvWaitKey(0);
cxcore.cvReleaseImage(new PointerByReference(img.getPointer(0)));
highgui.cvDestroyWindow("Example1");
} catch (Throwable th) {
th.printStackTrace();
}
}
}
|
► Sign in to add a comment
sorry to ask,any doc for this or any more examples beside this one? btw,this is so exciting projects. thank you!
Sorry, that's the only example available so far. For more advanced OpenCV/Java stuff, you might want to have a look at Samuel Audet's work, which doesn't use JNAerated wrappers but hand-coded ones. Cheers
I might not fully understand the example but is it true that the OpenCV.jar doesn't contain the HighguiLibrary? class?
I tried to build the required classes according to the howto listed above (on Windows Vista 64bit) but run into the following error at the last command (java -jar jnaerator.jar ):
16-sep-2009 17:55:13 com.ochafik.admin.visualstudio.VisualStudioUtils? getProp INFO: environment? VISUAL_STUDIO_HOME=C:\Program Files (x86)\Microsoft Visual Studio 9.0 16-sep-2009 17:55:13 com.ochafik.admin.visualstudio.VisualStudioUtils? getProp INFO: environment? WINDOWS_SDK_HOME=C:\Program Files\Microsoft SDKs\Windows\v6.0A 16-sep-2009 17:55:13 com.ochafik.admin.visualstudio.VisualStudioUtils? getProp INFO: environment? VISUAL_STUDIO_INCLUDES=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Includ java.io.FileNotFoundException?: c:\Program Files (x86)\OpenCV1.2\src\cxcore\include\.h
The Paths to Visual Studio & WINDOWS_SDK_HOME are ok. It would be great if you can put me in the right direction. I'm really interested binding OpenCV to my Java projects but I might want to use jnaerator also for other projects. It seems great and much easier as JNI.
Thanks in advance,
Jan Snelders
Hi Jan,
Sorry for replying a bit late, I forgot to register to the comment notifications :-S Can you try with the following command instead :
Thanks
Hi Oliver,
I tried to build according to the howto listed above (on Windows XP) but run into the following error at the last command: C:\DevTools?\OpenCV>java -jar jnaerator-0.9.1.jar config.jnaerator 04.10.2009 15:29:06 com.ochafik.admin.visualstudio.VisualStudioUtils? getProp INFO: environment? VISUAL_STUDIO_HOME=C:\Program Files\Microsoft Visual Studio 9.0 04.10.2009 15:29:06 com.ochafik.admin.visualstudio.VisualStudioUtils? getProp INFO: environment? WINDOWS_SDK_HOME=C:\Program Files\Microsoft SDKs\Windows\v6.0A 04.10.2009 15:29:06 com.ochafik.admin.visualstudio.VisualStudioUtils? getProp INFO: environment? VISUAL_STUDIO_INCLUDES=C:\Program Files\Microsoft Visual Studio 9.0\VC\include;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include java.io.FileNotFoundException?: -entry
tArg(JNAeratorCommandLineArgs.java:48) JNAeratorCommandLineArgs.java:123)And, sorry for dummy question, I want to use OpenCV.jar with Eclipse. How can I do it?
Hi, the syntax of .jnaerator files changed and I forgot to update config.jnaerator, sorry about that... I've checked in an update... As for Eclipse look at methods 2 or 3 in section "Adding External JARs" of this howto
And feel free to join the NativeLibs4Java google group for further support :-) Cheers
I try to use the jnaerator for OpenCV 2.0 right now but don't manage to solve it without any errors as they totaly rearranged the whole package structure. Is there maybe a config-file for OpenCV 2.0 available as well?
Which version this support ,,,cause i have latest one Open CV2.3.1 but don,t know if it supports this or not
NativeLibs4Java?'s OpenCV bindings were just an experiment that is not supported nor maintained. I would advise you to try JavaCV, which is actively maintained : http://code.google.com/p/javacv/. Cheers