Converting Mat to IPLimage in Java / opencv [closed]

asked 2015-11-17 11:09:59 -0500

super_man1993 gravatar image

updated 2015-11-17 12:28:03 -0500

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);
            }
        }
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-07 05:36:21.785043

Comments

1

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)

berak gravatar imageberak ( 2015-11-17 11:15:45 -0500 )edit

okay thankyou. dont suppose you know how i can convert a mat to an iplimage??

super_man1993 gravatar imagesuper_man1993 ( 2015-11-17 11:33:59 -0500 )edit
1

from java ? no idea. from c++/jni ? you're kinda unclear about where youre are atm. some code snippet would sincerely help.

berak gravatar imageberak ( 2015-11-17 11:37:21 -0500 )edit

ive added some code

super_man1993 gravatar imagesuper_man1993 ( 2015-11-17 12:28:26 -0500 )edit
1

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.

berak gravatar imageberak ( 2015-11-17 12:37:54 -0500 )edit