0% found this document useful (0 votes)
72 views1 page

A Imread Imshow A: 'Cameraman - Tif'

The document demonstrates how to read and display images in MATLAB using the imread and imshow functions. It shows reading grayscale and color images, displaying a blank 3x3 matrix and a red 3x3x3 matrix. Exercises ask to determine the colors for all black, all white, and mid-gray 3x3x3 matrices, and have the user create and display yellow and orange 3x3x3 matrices.

Uploaded by

raymar2k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views1 page

A Imread Imshow A: 'Cameraman - Tif'

The document demonstrates how to read and display images in MATLAB using the imread and imshow functions. It shows reading grayscale and color images, displaying a blank 3x3 matrix and a red 3x3x3 matrix. Exercises ask to determine the colors for all black, all white, and mid-gray 3x3x3 matrices, and have the user create and display yellow and orange 3x3x3 matrices.

Uploaded by

raymar2k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Read and display an image (grayscale):

a = imread ('cameraman.tif');
imshow (a);

Read and display an image (color):

b = imread ('peppers.png');
imshow (b);

Create a 3 x 3 matrix and display it as an image:

a=[0,0,0;0,0,0;0,0,0];
imshow (a);

Create a 3 x 3 x 3 matrix for a red square and display it as an image:

g (:, :, 1) = [255, 255, 255; 255, 255, 255; 255, 255, 255];
g (:, :, 2) = [0, 0, 0; 0, 0, 0; 0, 0, 0];
g (:, :, 3) = [0, 0, 0; 0, 0, 0; 0, 0 ,0];

g = uint8 (g);
imshow (g);

Exercises:

What color is obtained from the following 3 x 3 x 3 matrices?

g (:, :, 1) = [0, 0, 0; 0, 0, 0; 0, 0, 0];


g (:, :, 2) = [0, 0, 0; 0, 0, 0; 0, 0, 0];
g (:, :, 3) = [0, 0, 0; 0, 0, 0; 0, 0 ,0];

imshow (g);

g (:, :, 1) = [255, 255, 255; 255, 255, 255; 255, 255, 255];
g (:, :, 2) = [255, 255, 255; 255, 255, 255; 255, 255, 255];
g (:, :, 3) = [255, 255, 255; 255, 255, 255; 255, 255, 255];

g = uint8 (g);
imshow (g);

g (:, :, 1) = [127, 127, 127; 127, 127, 127; 127, 127, 127];
g (:, :, 2) = [127, 127, 127; 127, 127, 127; 127, 127, 127];
g (:, :, 3) = [127, 127, 127; 127, 127, 127; 127, 127, 127];

g = uint8 (g);
imshow (g);

Create a 3 x 3 x 3 matrix for a yellow square and display it as an image.

Create a 3 x 3 x 3 matrix for an orange square and display it as an image.

You might also like