I don't believe this is the typical way of converting a Mat to a BufferedImage. From my experience it is much similar to use MatOfByte:
Code:
// Lots of code...
Mat mat = getSomeImageMat();
MatOfByte bytes = new MatOfByte();
Highgui.imencode(someFormat, mat, bytes);
byte[] arr = bytes.toArray();
ByteArrayInputStream bis = new ByteArrayInputStream(arr);
BufferedImage img = ImageIO.read(bis);
// Even more code...
// Exceptions and Stream Closing omitted for brevity
This is what I have seen typically used. It's much simpler.
(I noticed you used this algorithm, but I will leave it here for future reference)
http://stackoverflow.com/questions/1...-mat-in-opencv
Is there some limitation where you can't use MatOfByte?