enhances image by min max values
Afficher commentaires plus anciens
How enhances the contrast of the Image with the of max and min values of the intensity value of the image.
Réponses (1)
The reflexive answer would be:
inpict = imread('pout.tif'); % uint8
outpict = mat2gray(inpict); % unit-scale double
imshow([inpict im2uint8(outpict)],'border','tight')
... but I would argue that using mat2gray() is not always appropriate. It forces a change of class, and the way it handles RGB images is not always appropriate or expected. For adjusting contrast, the simple choice is imadjust(). The simple imadjust() example would be:
outpict = imadjust(inpict); % uint8
imshow([inpict outpict],'border','tight')
There's two caveats though. First, this won't work for RGB inputs. That's just the way imadjust() does things. Second is that we're relying on some default parameters when we use this abbreviated syntax. In fact, we're not normalizing the image with respect to its extrema, but to some values near the extreme ends of the intensity distribution. We're truncating the upper and lower 1% of values. If you want to use the actual extreme values or if you want to choose other points:
inlevels = stretchlim(inpict,[0 1]); % extrema
outpict = imadjust(inpict,inlevels); % uint8
imshow([inpict outpict],'border','tight')
This also fixes the problem with RGB images. When handling RGB like this, each color channel gets adjusted independently with respect to its own distribution of values.
inpict = imread('westconcordaerial.png'); % uint8
inlevels = stretchlim(inpict,[0 1]); % extrema
outpict = imadjust(inpict,inlevels); % uint8
imshow([inpict outpict],'border','tight')
Catégories
En savoir plus sur Contrast Adjustment dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



