Ignore step 5 please Additional Notes Gray scale images are
Ignore step 5 please.
Additional Notes:
Gray scale images are stored in unsigned 8 bit integers, so in order to multiply a B matrix with a factor 0.5, etc. you will need to change the B matrix to a double precision.
You can do this by B=double(A).^0.5
since your matrix B is now double precision, you need to change it back to unsigned 8 bit integer and display.
You can do this by imshow(uint8(B)).
Solution
Here is the code for you:
%Use matlab command imread.
A = imread(\'FordEcosport.png\');
figure;
imshow(A);
%Use matlab command rgb2gray.
B = rgb2gray(A);
figure;
imshow(B);
%Use matlab command size.
[a, b] = size(B);
%Raise each pixel values by a power of 0.5, 1, 1.5
B = double(A);
C = B.^0.5; %.^is raising by 0.5 for each array value.
D = B.^1;
E = B.^1.5;
F = B.^2;
G = B.^4;
figure;
imshow(uint8(C));
figure;
imshow(uint8(D));
figure;
imshow(uint8(E));
figure;
imshow(uint8(F));
figure;
imshow(uint8(G));
imwrite(B, \'B.png\');
imwrite(C, \'C.png\');
imwrite(D, \'D.png\');
imwrite(E, \'E.png\');
imwrite(F, \'F.png\');
imwrite(G, \'G.png\');
%Use matlab command im2bw.
H = im2bw(B, 0.5);
I = imresize(A, 0.5);
figure;
imshow(I);

