Composing multiple BW images to one color image

Composing n binary images to a colored image while each image is layer of some color.
642 Downloads
Updated 29 Nov 2009

View License

function [c_img] = RGB_layers(imgs,RGBs)

RGB_layers - Visualize n gray/binary images in pseudo color

INPUT: (imgs,RGBs)
imgs: m*k*n matrix. imgs(:,:,i) is a grayscale/BW image.
RGBs: n*3 matrix, each row represents what color the layer will be.
(Optional. By default it will be the jet colormap)

OUTPUT: m*k*3 color image.

EXAMPLE:

I=imread('cameraman.tif');
imgs(:,:,1)=I>180;
imgs(:,:,2)=I<70;
imgs(:,:,3)=mod(I,40)==0;
imgs(:,:,4)=mod(I,70)==0;

RGBs=[1,0,0;0,0.6,0;0,0,1;0.2,0,0.3];
c_img=RGB_layers(imgs,RGBs);
imshow(c_img);

BUG REPORT:
Please send your bug reports, comments and suggestions to
dsilver@tx.technion.ac.il .
Thanks.

Author: David Silver
Department of Computer Science
Technion - Israel Institute of Technology, Haifa, Israel
dsilver@tx.technion.ac.il
Version: 1.00

Cite As

David Silver (2024). Composing multiple BW images to one color image (https://www.mathworks.com/matlabcentral/fileexchange/25973-composing-multiple-bw-images-to-one-color-image), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Modify Image Colors in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0