Graphics Programs Reference
In-Depth Information
An Application of RGB Images
To see how RGB images can be used, we look at how an image can be
filtered. An image of the Cat's Eye Nebula, which is stored on disk as a
JPEG image, can be read into matlab using the imread command:
>> q = imread('ngc6543a.jpg');
>> size(q)
ans =
The result is a 650
3 matrix, where the “pages” represent respec-
tive red, green, and blue intensities. We can display the image by typing:
axis image off
(See page 120 for a description of axis image .) On your screen this
appears as a colour image. Suppose we want to filter out the red com-
ponent. We do this by setting the first “page”, the red component of
the image, equal to zero. First we take a copy of the original so we can
later plot the two images side by side:
q_original = q;
q(:,:,1) = 0;
axis image off
axis image off
29.4 Example: Sonar
Let us look at some sonar data consisting of sound spectral power levels
measured as a function of frequency, direction of arrival, and time. Load
this data from the file sonar.mat :
>> load sonar
Search WWH ::

Custom Search