{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ABCs_images - D Use the simpler grayscale formula where the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [A B C D E] = ABCs_images(filename1, filename2) % ABCs of Images % % This is a multi-part problem. Do each of the parts below. % % DO NOT CHANGE THE FUNCTION HEADER (the first line of code) % % a) imread. Read in the image matrix of a file whose name is stored in % the variable filename1. Store the image matrix in a variable named A. % % Write your code here: A = imread(filename1); A % b) Flipping images. Create a copy of A and then flip the image matrix % upside down. Store your result in B. Do *NOT* use the flipud() % function. % % Write your code here: B = A(end:-1:1,:,:); B % c) Swapping colors. Create a copy of A and then swap the green and blue % layers. Store your result in C. % % Write your code here: C = A(:,:,[1 3 2]); C % d) Grayscale. Store the grayscale of the image matrix A in the variable
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % D. Use the simpler grayscale formula where the pixel value is the average % of the three layers. Do *NOT* use the weighted average formula or any % built-in MATLAB functions such as rgb2gray() or gray(). Also, make sure % that D is a valid image matrix in that it has three dimensions and is of % type uint8(). % % Write your code here (it will be a few lines): D = D % e) Negative. Store the negative of the image matrix A in the variable E. % % Write your code here: E = %<fix this code>% E % f) imwrite. Write a new image that is similar to the image matrix A, % except that the image should be 50% less bright. The name of the new % image is stored in the variable filename2. % % Write your code here: %<fix this code>%...
View Full Document

  • Spring '08
  • Stallworth
  • Weighted mean, built-in MATLAB functions, weighted average formula, image matrix, valid image matrix, simpler grayscale formula

{[ snackBarMessage ]}

Ask a homework question - tutors are online