Hooked
Hooked

Reputation: 41

colormap in matlab

For a colormap how do you accentuate the brightness of some of the dimmer features?

Upvotes: 4

Views: 2728

Answers (2)

Jonas
Jonas

Reputation: 74940

If you have a grayscale colormap, the grayvalues map linearly to the intensities. In order to enhance dim features, you want the low intensities to be mapped onto a larger range of grayvalues than the high intensities. In other words, you stretch the low intensities and compress the high intensities. This can be done by adjusting the gamma of the colormap. Of course you can do a gamma correction for RGB colormaps as well.

If you have the image processing toolbox, the Matlab command for this is IMADJUST, which you use like this:

newColormap = imadjust(oldColormap,[low_in; high_in],[low_out; high_out],gamma);

The new colormap maps the values in the range low_in/high_in to the range low_out/high_out - so you most likely want to use minimum/maximum of the colormap - and gamma is what you want to set to >1.

An alternative, quick way to emphasize dim features is to display the square root (or, for a more pronounced effect, the logarithm) of your image.

imshow(sqrt(img),[])

Upvotes: 3

gnovice
gnovice

Reputation: 125874

You can use the BRIGHTEN function to brighten the entire colormap, thus brightening the dimmer features as well:

brighten(0.5);  %# Brightens the current colormap

%# OR...

newMap = brighten(oldMap,0.5);  %# Brighten the colormap in variable oldMap
colormap(newMap);               %# Update the current colormap to newMap

If you want to brighten only the dimmer features (i.e. just part of the colormap), you have to first decide how to classify what counts as a "dimmer" feature. ;)

Upvotes: 3

Related Questions