Hi there!
Great library by the way I have been having a lot of fun with it over the last few days.
First of all I im using x86 OpenCV 2.49 with Visual Studio Express 2010 and ASMLibrary of coarse.
I have been using the library to extract facial points and for now just print them to the screen. I plan to write them to a CSV file later.
I have successfully integrated the library into both android and windows applications. I first modified demo_fit to print the points to the console rather than display an image, I also modified the source to accept a CSV string of images rather than just one meaning it would only initialize the cascades once and then iterate over each image. This all worked fantastically!!
I then decided to write a JNI wrapper dll for windows almost identical to the JNI wrapper in the android demo. This was a relatively painless process except that the FastCascadeDetector had to be removed as this is only supported on *NIX platforms. Other than that I managed to integrate directly with Java and successfully load the required DLL files and get a working example. Below is a list of the DLL files in order of load.
System.loadLibrary("opencv_java249");
System.loadLibrary("opencv_core249");
System.loadLibrary("opencv_imgproc249");
System.loadLibrary("opencv_highgui249");
System.loadLibrary("opencv_objdetect249");
System.loadLibrary("asmlibrary");
System.loadLibrary("Sensum-ASM"); // My JNI wrapper dll.
then i load the cascades with the following methods. I am using the included 'my68-1d.amf' and 'haarcascade_frontalface_alt2.xml'.
nativeReadModel
nativeInitCascadeDetector
/*
...
I then do some openCV VideoCapture stuff and get a frame in a Mat
*/
Here is where the problem occurs.
After about 10 loops on the native functions below the javaw.exe crashes with a native exception. I have attached the crash log to this post for your review. I have only invoked either of the below methods and not the actual 'nativeFitting' or 'nativeVideoFitting' methods so I guess the problem lies with the initial face detection.
I have tested both running the code inside a loop and just timed interval iterations using Thread.sleep(1000) and the result is the same, about 10-11 loops and it fails.
/**
* This function can only be used after nativeInitCascadeDetector()
* @param imageGray original gray image
* @param face all faces' feature points
* @return true if found faces, false otherwise
*/
public boolean detectAll(Mat imageGray, Mat faces){
return nativeDetectAll(imageGray.getNativeObjAddr(),
faces.getNativeObjAddr());
}
/**
* This function can only be used after nativeInitCascadeDetector()
* @param imageGray original gray image
* @param faces only one face's feature points
* @return true if found faces, false otherwise
*/
public boolean detectOne(Mat imageGray, Mat face){
return nativeDetectOne(imageGray.getNativeObjAddr(),
face.getNativeObjAddr());
}
I would be most greatful if you had any insight into what could cause this issue.
Thanks in advance,
Shane