Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need Help!!!! It is about matlab, and Please write down all the details!! Thanks

ID: 644380 • Letter: N

Question

Need Help!!!!

It is about matlab, and Please write down all the details!!

Thanks.

2. Grumpycat wants to prepare a Facebook profile picture. To make the picture more interesting to her Facebook friends (if she has any) she wants to take the original picture (at the left), and gradually darken (in one picture) or lighten (in the other picture) the image as you move to the right, ending up pure black or white at the right edge. Download your own grumpycat JPEG picture and do something like that. Explain what you are doing. Here's some hints: a) If A is the m x n x 3 color array then first turn the elements into floating point intensities between 0 and 1 using A=double(A)/255; 2) You can take the colors in the jth column, namely A(:,j,:) and shade them toward black, for instance, using a weighted average (1r)*A(:,j,:)+r*zeros(m,3) where r is zero for the first column (j=1) and r is 1 for the last column (j=n), which is completely black (of course you don?t need the second term, do you). Along the way, r steadily increases with j (you decide how). In shading toward white, you use r*ones(m,3) instead (although r*1 will do fine for the second term).

Explanation / Answer


clc

a = imread('cat.png');
imshow(a);

[m n p] = size(a);

a = double(a)/255;
r = 0;
change = 1/n;

b = a;

for j = 1:n
    b(:,j,:) = (1-r)*a(:,j,:) + r*zeros(m,1,3);
    r = r + change;
end

figure
imshow(b);

c = a;
r = 0;

for j = 1:n
    b(:,j,:) = (1-r)*a(:,j,:) + r*ones(m,1,3);
    r = r + change;
end
figure
imshow(c);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote