This preview shows page 1. Sign up to view the full content.
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
- Spring '08