Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Converting Mat to IPLimage in Java / opencv

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,

Converting Mat to IPLimage in Java / opencv

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);
            }
        }