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

Homework 3 (12 pts.) Write a Matlab code to: (2 pts) \" Use the function imadjus

ID: 3916445 • Letter: H

Question

Homework 3 (12 pts.) Write a Matlab code to: (2 pts) " Use the function imadjust(..) to improve the image o Apply the logarithmic and power gray level transformatiorn to improve medical images "Write a Matlab program to apply the contrast stretching function shown below to medical images. (5 pts) Use the functions: "imhist" with an image and draw the histogram using three different methods. (2 pts) Improve a medical image using histogram equalization and specification. (3 pts) 27 Contrast Stretching Function of HW3 240 180 120 0 120 180 240 255 Old gray levels (r) 28

Explanation / Answer

answered first 2 question and let me know if you have any queries

1] imadjust function to improve the image. please try this

I = imread( ' imagename.tif ' );

imshow( I );

Adjust constrast of the image so that 1% of the data is saturated at low and high intensities, and dispaly it.

j = imadjust( I );

figure

imshow ( J )

we can also specify the contrast limits

for example: k = imadjust (I, [0.3 0.7 ], [ ]);

figure

imshow( k )

2] Logarithmic image gray level transformation

F = imread( imagename.jpg);

F = imresize ( F, 0.5);

figure(1);

subplot(1,2,1);

imshow(F);

// now convert to grayscale

g = 0.2989 * F( :,:,1) + 0.5870 * F(: ,: , 2) + 0.1140 * F(:, : ,3);

c= 50;

// formula for log function transformation

H = uint8(C. log(double(l+g)));

subplot (1,3,1);

imshow (F);

title (' original image');

subplot (1,3,2);

imshow (g);

title (' gray image');

subplot (1,3,3);

imshow (H);

logtext = sprintf(' logarithmic operation for c= %2.1f ', C );

title (logtext);

3] program to apply the contrast stretching function

x = imread( ' image.jpg '); // reading a grayscale image

figure (1);

imshow(x);

title('original image')

a = min(x ( : ));

b = max(x ( : ));

x = (x-a). * (255/(b-a)); // just using the formula

figure(2)

imshow(x);

title(' contrast stretched image')