Converting Mat to IPLimage in Java / opencv [closed]
Is there any way to covert a Mat to an IPLimage in java or opencv??? Trying to implement Flandmark in Java, but i need to change the saved image to iplimage to do this. Thanks,
for (Rect rect : faceDetections.toArray()) {
int[] bbox = new int[4];
bbox[0] = rect.x;
bbox[1] = rect.y;
bbox[2] = rect.x + rect.width;
bbox[3] = rect.y + rect.height;
//Mat 'image' is a image of the users face, done in another class
//convert to Iplimage here from Mat
//flandmark only works with iplimage so need to convert to mat
final IplImage input = null;
flandmark.flandmark_detect(input, bbox, model, landmarks);
// convert back to Mat here
// display face landmarks
rectangle(image, new Point(bbox[0], bbox[1]), new Point(bbox[2], bbox[3]), new Scalar(255, 0, 0));
rectangle(image, new Point((int) model.bb().get(0), (int) model.bb().get(1)), new Point((int) model.bb().get(2), (int) model.bb().get(3)), new Scalar(0, 0, 255));
circle(image, new Point((int) landmarks[0], (int) landmarks[1]), 3, new Scalar(0, 0, 255), CV_FILLED, 8, 0);
for (int i = 2; i < 2 * model.data().options().M(); i += 2) {
circle(image, new Point((int) (landmarks[i]), (int) (landmarks[i + 1])), 3, new Scalar(255, 0, 0), CV_FILLED, 8, 0);
}
}
btw, a short edit to your question would prop it to the top again, too. (imho the much better way than asking a 2nd one, and deleting the former)
okay thankyou. dont suppose you know how i can convert a mat to an iplimage??
from java ? no idea. from c++/jni ? you're kinda unclear about where youre are atm. some code snippet would sincerely help.
ive added some code
maybe it helps, if you also add, what you're actually using, i.e https://github.com/uricamic/flandmark does not have a java wrapper originally.