ABCs_images

ABCs_images - of the three layers Do*NOT use the weighted...

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 % D. Use the simpler grayscale formula where the pixel value is the average
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % 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): a = double(A); avg = (a(:,:,1)+a(:,:,2)+a(:,:,3))./3; nimg(:,:,1) = avg; nimg(:,:,2) = avg; nimg(:,:,3) = avg; D = uint8(nimg); D % e) Negative. Store the negative of the image matrix A in the variable E. % % Write your code here: E = 255-A; 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: imwrite(A.*0.5,filename2);...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.

Ask a homework question - tutors are online