Composing multiple BW images to one color image
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 (2026). 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
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > Images > Modify Image Colors >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
