How to convert from Iplimage to Mat in java?
Hi everyone,
I have trouble converting from Iplimage to Mat in java. Since OpenCV java API doesn't have ability to load video files, I utilized javacv to load video files. But then I need to convert Iplimage to Mat in order to use openCV to do face detection. What should I do to realize it?
Thanks for any help in advance!
Quan
This might not be of much help (just bits and pieces)... but someone posted the structure of IplImage here:
http://stackoverflow.com/questions/17307430/explanation-of-iplimage-img
...and a fast function to convert Mat into java.awt.image.BufferedImage (which might resemble IplImage to some degree), can be found here:
http://answers.opencv.org/question/10344/opencv-java-load-image-to-gui/
( look for "public static BufferedImage matToBufferedImage(Mat bgr)" )
Basically, I would try to read the "imageData" field from IplImage structure and write it using "matrix.put(0, 0, data);" to the Mat object. If the dimensions and color palettes already match before trying this, it might succeed. But I've got no working method to try, since I can't get any IplImage structures on my system...