Converting from Image to Mat - JavaFX
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()));
}