IMAGE TRANSFORMATION and ROTATION
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I would like some helping in turning the right triangle with legs 25 pixels long, in each corner of the picture, to white. Here is a link to the picture(<http://web.njit.edu/~gwryan/CS101/picture.jpg>) it is a class assignment, I finished everything except for the question posted; kindly assist. Here goes:
I = imread('picture.jpg'); % transform image from I to J arraysize=size(I); MAXROW=arraysize(1); MAXCOL=arraysize(2); J=I; for r=1:MAXROW for c=1:MAXCOL if I(r,c,1)<125 & I(r,c,2)<125 & I(r,c,3)<125 I(r,c,1) = I(r,c,1) * .33; I(r,c,2) = I(r,c,2) * .33; I(r,c,3) = I(r,c,3) * .33; end end end for r=1:MAXROW for c=1:MAXCOL if I(r,c,1)>125 & I(r,c,2)>125 & I(r,c,3)>125 I(r,c,1) = I(r,c,1) * 1.25; I(r,c,2) = I(r,c,2) * 1.25; I(r,c,3) = I(r,c,3) * 1.25; end end end I = imread('picture.jpg'); J=imrotate(I,-45); %%% HERE IS WHERE I AM LOST!!!! arraysize=size(I); MAXROW=arraysize(1); MAXCOL=arraysize(2); for r=1:25 for c=1:26-r %change colors of r,c to 255 B(r,c,1)=255; B(r,c,2)=255; B(r,c,3)=255; end end for r=MAXROW-25:MAXROW for c=1:r-(MAXROW-25)+1 B(r,c,1)=255; B(r,c,2)=255; B(r,c,3)=255; end end for r =1:25 for c = MAXCOL-r:MAXCOL B(r,c,1)=255; B(r,c,2)=255; B(r,c,3)=255; end end figure(1); image(I); figure(2); image(J);
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!