To create a false color image

20 visualizaciones (últimos 30 días)
Tu Nguyen
Tu Nguyen el 31 de Mzo. de 2022
Respondida: Image Analyst el 5 de Dic. de 2023
Hi all;
I am doing an assignment that create a false color image from stretched channel of each color. I got stuck in creating an image from 4 color channel. Any possible to create an rgb image from 4 color channels. Sorry, I cannot attach the files because the file is .tif files
If I have that image, the next step I do for creating false color image is changing to index image by using rgb2ind function and convert back to false color image by using ind2rgb(indexedImage, jet(256)) right? The false color image will be from infrad_red to red, red to green, and green to blue
I really appreciate about your help.
clc;
close all;
clear all;
I1 = imread('red.tif');
I2 = imread('blue.tif');
I3 =imread('green.tif');
I4 = imread('infra_red.tif');
I1g = im2gray(I1);
I2g = im2gray(I2);
I3g = im2gray(I3);
I4g = im2gray(I4);
Ir = imadjust(I1, [0.3 0.6],[0.0,1.0]);
Ir_eq = histeq(I1);
Ib = imadjust(I2, [0.22 0.72],[0.0,1.0]);
Ib_eq = histeq(I2);
Ig = imadjust(I3, [0.02 0.48], [0 1]);
Ig_eq = histeq(I3);
Ii = imadjust(I4, [0.7 1], [0 1]);
Ii_eq = histeq(I4);
rgbImage = cat(3, Ir, Ig, Ib);
imshow(rgbImage);
Coloredimage = cat(4,I1g,I2g,I3g,I4g);
imshow(Coloredimage)
falseColoredImage = ind2rgb(cat(4,Ii_ind,Ir_ind,Ig_ind,Ib_ind), jet(256));
imshow(falseColoredImage);

Respuestas (2)

Saarthak Gupta
Saarthak Gupta el 5 de Dic. de 2023
Hi,
Looks like you are trying to create an RGB image from 4 color channels.
Adding an extra channel to a regular RGB image is a straightforward task, and can be done by simple array indexing in MATLAB:
RGBimage(:,:,4) = ExtraChannel;
To save the 4-channel RGB image, you need to save it as a PNG image with the ‘alpha’ option specified. The extra channel would be stored as transparency (Alpha) in the resulting PNG image; you need the three-output version of ‘imread’ to read the extra channel.
TIFF files can store 4 or more channels. Alternatively, you can write Tiff Image with Color and Alpha Channel Data.
However, please note that image processing routines like ‘ind2rgb’ work on m-by-n matrices and RGB images. To convert the given image to false color, you need to find alternate routines which operate on TIFF images. To fully understand the capabilities of Tiff objects, refer to the LibTIFF API and the TIFF specification and technical notes.
Please refer to the following documentation for further reference:

Image Analyst
Image Analyst el 5 de Dic. de 2023
See the attached article on a variety of ways to convert hyperspectral channels (wavelength bands) into RGB images.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by