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

Write matlab code for: Image: \"b.tif\" read the image into workspace using func

ID: 3785779 • Letter: W

Question

Write matlab code for:

Image: "b.tif"

read the image into workspace using function imread

display the image using function imshow

convert the color image into grayscale using function rgb2gray

display the histogram of the grayscale version using function imhist

enlarge the grayscale image by four times using function imresize

crop the enlarged image to its original size using function imcrop

display the image size, average intensity, maximum and minimum intensity

save the image into a file named “output.jpg” using function imwrite

--

Within the program, use comment lines to describe how to execute the program to demonstrate the successful completion of the above actions.

Explanation / Answer

A = imread('b.tif'); % reading the image using imread
imshow(A); %diso=paying the image using imshow

A1 = rgb2gray(RGB); % converting to black and white
figure
imshow(A1) %displaying image

imhist(A) %diplaying histogram for the image that we read

A2 = imresize(A, 4); %resizing the image to 4 times
[A3, rect] = imcrop(A2); %cropping the image
[x,y,z] = size(A); %size of image
[maxVal,maxInd] = max(A(:)); % maximum intensity
[minVal,minInd] = min(A(:)); % minimum intensity
avgerage = (maxVal+minval)/2 % average intensity

imwrite(A2,'output.jpg') %writing image

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