To mathematically manipulate an image using Matlab, one must first load the image and then split it into three color layers. In Matlab, this is done with the following script.

image = imread('IMGT1818.bmp'); %load the image

imshow(image) %show the color image

imageRed = image(:,:,1); %separate out the first layer, red

imageGreen = image(:,:,2); %separate out the second layer, green

imageBlue = image(:,:,3); %separate out the third layer, blue

figure,imshow(imageRed) %show the red layer

figure,imshow(imageGreen) %show the green layer

figure,imshow(imageBlue) %show the blue layer

A couple of notes here.

First, Matlab is case sensitive. There's a huge difference between the variable f and F.

Second, digital images loaded into Matlab must be enclosed with hyphens because the name of a file is not a variable

Third, the semicolon (;) suppresses output. Without it, the Command Window in Matlab fills with the decimal values of each pixel as an array is loaded or mathematically manipulated.

And fourth, the percent sign (%) signifies a comment. Any text after it is ignored in the script.

So what is the final result of this script? Below is a screen shot of Matlab after splitting a thermal image taken during descent at GPSL 2017.

From left to right, color image, red layer, green layer, and blue layer |

Meanwhile, readers can try to do this separation of color layers themselves, and without using Matlab (a very expensive matrix mathematics program). The Freeware program, Octave should be nearly identical to Matlab. So you might want to install this program and try out the script I give above.

Many successful image splittings

## No comments:

## Post a Comment