% LECT05A.M 2/12/01 BME5002 J.G. HARRIS echo on clear close all % read in image figure(1) lung1=imread('lung1.jpg'); % this image is only two-dimensions size(lung1) pause % now display the image % what is wrong with this patient? % what is the pixel noise? imshow(lung1); pause % Now let's display a histogram equalized image % Notice how you can no longer see some of the % ribs on the left side of the image % Histogram equalization is not always a good idea!!!!! % why not? figure(2) imshow(histeq(lung1)) % IMAGE PROCESSING LECTURE 5B % BME5002 JOHN G. HARRIS 2/12/01 % 1D filtering chest=imread('chest.jpg','jpg'); %by default, jpeg images have 3 color bands %we only need to take one % (also convert the image from uint8 to double) chest=double(chest(:,:,1)); % imagesc always works, why not use imshow? figure(1) imshow(chest) colorbar pause imhist(chest); pause % must make a uint8 or a double between 0 and 1 so... chest=chest/max(max(chest)); pause % now imshow can be used imshow(chest) colorbar pause % imshow can take arguments of min and max grayscale values figure(2) 1 imshow(chest,[0 .6]) pause % can use imhist to compute histogram of a double image figure(2) imhist(chest) pause % take a vertical slice of the image slice=chest(:,200); figure(2) plot(slice) pause %look at new definition of boxcar blurring and %plotting function type convplot pause %blur the slice slice2=convplot(slice,ones(1,21)/21); % IMAGE PROCESSING LECTURE 5C % BME5002 JOHN G. HARRIS 2/12/01 % 2D filtering chest=imread('chest.jpg','jpg'); %by default, jpeg images have 3 color bands %we only need to take one % (also convert the image from uint8 to double) chest=double(chest(:,:,1)); figure(1) imagesc(chest); colorbar pause %Blurring the image with a boxcar filter b=ones(11,11)/(11*11); chest2=conv2(b,chest); pause figure(2) imagesc(chest2) colorbar colormap(gray(256)) pause %highpass filter vertical direction b=[1 1 1; 0 0 0 ; -1 -1 -1] chest2=conv2(b,chest); figure(2) imagesc(chest2) colorbar colormap(gray(256)) 2