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

*** Matlab Code *** Given a 100 x 100 uint8 matrix A representing a grayscale im

ID: 3747664 • Letter: #

Question

*** Matlab Code ***

Given a 100 x 100 uint8 matrix A representing a grayscale image, write a few lines of code to do each of the following. Try to avoid using loops. a. Sort all the intensities in A, put the result in a single 10,000-dimensional vector x, and plot the values in x. b. Display a figure showing a histogram of A's intensities with 32 bins. c. Create and display a new binary image the same size as A, which is white wherever the intensity in A is greater than a threshold t, and black everywhere else. d. Generate a new image (matrix), which is the same as A, but with A's mean intensity value subtracted from each pixel. Set any negative values to 0. Use rand to write a function that returns the roll of a six-sided die. first column is [1, 2, 3]', and whose second column is [4, 5, 6]'. set r to the row it occurs in and c to the column it occurs in number of unique values that occur in v. e. f. Let y be the vector: y [16]. Use the reshape command to form a new matrix z whose g. Use the min and find functions to set x to the single minimum value that occurs in A, and h. Let v be the vector: v [1 8 8 2 1 3 9 8]. Use the unique function to compute the total

Explanation / Answer

%we are supposed to answer 4 subparts at a time

%please ask last 4 subparts again

%a
x=sort(A(:));
plot(x)
%b
figure
histogram(x,32);
%c
t=10;%threshold
C=A;
C(C<t)=0;
C(C>t)=255;
figure
imshow(C);
%d
D=A-mean(A(:));
D(D<0)=0;
figure
imshow(D)