There are few more methods for "automatic windowing Image in Matlab".
Some applies grayscale images, and some support color.
There are linear processing algorithms like imcontrast
and imadjust
(linear with gamma).
There is histeq
, that performs histogram equalization.
I can recommend adapthisteq
that applies "Contrast-limited adaptive histogram equalization (CLAHE)"
Refer to Matalb documentation:
http://www.mathworks.com/help/images/functionlist.html#btdrtx1
Contrast Adjustment
Contrast adjustment, histogram equalization, decorrelation stretching
Functions
imadjust Adjust image intensity values or colormap
imcontrast Adjust Contrast tool
imsharpen Sharpen image using unsharp masking
histeq Enhance contrast using histogram equalization
adapthisteq Contrast-limited adaptive histogram equalization (CLAHE)
imhistmatch Adjust histogram of image to match N-bin histogram of reference image
decorrstretch Apply decorrelation stretch to multichannel image
stretchlim Find limits to contrast stretch image
intlut Convert integer values using lookup table
imnoise Add noise to image
Choosing the right method depends on your goals.
If you need fidelity to input, choose linear method.
If you need the highest contrast choose histogram equalization (in price of saturation).
If you need nice balanced image you can choose CLAHE.
The best algorithms are not built in to Matlab, but need more effort (to search, to implement, to buy...).