superimposeImage ( grayscaleIm, colormap )

version (2.49 KB) by Francisco
Superimposes a color image (or colormapped image) to a grayscale image for visualization.


Updated 9 Sep 2014

View License

Superimposes a color image (or colormapped image) to a grayscale image for visualization of colormaps (density, flow or whatever you are working on) using the grayscale image as a transparency index, for a better visualization.
It works with RGB images (MxNx3 matrices) or with simple grayscale images using a colromap (clasically 'jet', but others can be defined as well).


SUPERIMPOSEIMAGE(im, map) depicts the grayscale image IM fake coloured using the color information in MAP. If MAP is a grayscale image, it uses the 'jet' default colormap. If it is a true color image (a matrix NxMx3), it uses its colour.

SUPERIMPOSEIMAGE(..., 'colormap', cm) uses a user-defined colormap instead of the default 'jet'. E.g. 'bone', 'hot', etc.

SUPERIMPOSEIMAGE(..., 'alpha', alpha) controls the transparency of IM by adjusting its brightness. An alpha > 1 will reduce the transparency of the fake color map, whereas an alpha < 1 will increase the transparency of this maps.

h = SUPERIMPOSEIMAGE(...) returns the handle of the current figure.

Cite As

Francisco (2022). superimposeImage ( grayscaleIm, colormap ) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!