The [] is used to override the default 'DisplayRange' used by imshow. If you don't specify a 'DisplayRange', imshow works it out from the class of the image. If the image is double, imshow uses [0 1], if the image is uint8, imshow uses [0 255]. When you load your jpg image, your image a is most likely of class uint8 with intensities in the range [0 255]. the imadjust'ed b is also of class uint8 with intensities in the same range. However, the call to imquantize will create seg_I of type double containing integer values 1 or 2 (since you only have one quantisation level). As said, by default imshow uses [0 1] for a |double image, and since all the intensities are greater than 1, they'll all appear white. Passing [] to imshow tells it to use the minimum and maximum intensities of the image as 'DisplayRange'. If you don't want to do that, in your particular case, you could simply do:
seg_I = imquantize(b,level, [0 1]);
imshow(seg_I);
In any case, I'm not sure why you're using imquantize when you have only one quantisation level. You're effectively binarising the image, so imbinarize seems more appropriate:
seg_I = imbinarize(b, level);
imshow(seg_I);
Best Answer