MATLAB: Hello.. I have executed many mathworks code , But in some codes i faced a problem when outout image is showed. It needs ‘[]’ to show.

[] to show the output

For example…
In the following code http://freesourcecode.net/matlabprojects/56850/adaptive-kmeans-clustering-for-color-and-gray-image.-in-matlab when i tried to execute a code and call imshow(resultant _mage),it gives me a blank output But when the same code is executed with imshow(resultant_image,[]) it shows me the output.Can anyone please tell me the reason behind this?.. Also how to resolve this problem.
Thanks in advance…

Best Answer

When you use imshow() on a double() array, it defaults to assuming that the data is in the range 0 to 1. If it is not in that range then the image can come out mostly black (of the values are lower) or mostly white (if the values are larger.) When you use [] as the second argument of imshow(), it looks at the content of the array and uses the min() of the array to map to the first colormap entry and it uses max() of the array to map to the last colormap entry.
This is expected behavior.