MATLAB: How to keep the pixel values same for writing an image

imageimage analysisimage processing

In attach picture the pixel matrix D is written as an image but if i read the same image from the written one I found that all pixel values except zero are converted to 255. Why this is happening? Is there any solution to keep the pixel values same after writing it?

Best Answer

imwrite(uint8(D), 'd.png')
Related Question