Converting from Image to Mat - JavaFX

asked 2013-12-02 12:55:51 -0600

Maciejp gravatar image

updated 2013-12-02 13:19:54 -0600

berak gravatar image

Hi,

I have a problem converting data from Image (javafx.scene.image.Image) to Mat. Doing it the other way is quite straightforward:

public Image matToImage(Mat input) {
MatOfByte buf = new MatOfByte();    
Highgui.imencode(".png", input, buf);
return new Image(new ByteArrayInputStream(buf.toArray()));

}

edit retag flag offensive close merge delete