It depends on the complexity of the wrapped library. However you can add a reference to the library with #AdditionalJar attribute and then use inline Java code or JavaObject to access its API.
See this tutorial:
Accesing third party Jar with #Additionaljar and JavaObject
Hello Erel,
I am one of many who would like to use opencv in B4A.
Do you think can I use the library opencv-2410.jar (file in opencv/build/java/... ) with #AdditionalJar,
and use inline Java code to access it?
For example embed Java code like the code shown below.
It is a java example (face detector) using methods of java opencv.
Is this correct?
Or am I astray?
Thanks a lot.
code:
------------------------------------------------------------------------------------------------------
package com.shekhar.facedetection;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;
public class FaceDetector {
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
System.out.println("\nRunning FaceDetector");
CascadeClassifier faceDetector = new CascadeClassifier(FaceDetector.class.getResource("haarcascade_frontalface_alt.xml").getPath());
Mat image = Highgui
.imread(FaceDetector.class.getResource("shekhar.JPG").getPath());
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);
System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height),
new Scalar(0, 255, 0));
}
String filename = "ouput.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}
-------------------------------------------------------------------------------------------