Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Getting blank images when trying to construct image using byte array?

I am using byte array to generate a grayscale png image of size 440*442 size.But all i am getting are blank images of the size.C:\fakepath\FirstMyImgOut.png

byte[] bytesArrayForImage=new byte[array.length];
for (int i=0; i<array.length; i++) {
    bytesArrayForImage[i] = (byte) Integer.parseInt(array[i]);

}
Mat mat = new Mat(440,442, CvType.CV_8UC1);

mat.put(440,442,  bytesArrayForImage);

 String filename111 = Path;
 Highgui.imwrite(filename111, mat);