Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Image processing Lab

Lab#5

Homework

I) Develop a Matlab code that will perform the histogram equalization described
above. (Uses Lab5_2.tif).

Solution:
%hw1.m
clc close
all clear
all
f = imread('Lab5_2.tif');
g = histeq(f);

subplot 221,imshow(f),title('original image') subplot


222,imhist(f),title('original Image Histogram'),ylim('auto') subplot
223, imshow(g),title('Image after Histogram Equalization') subplot
224, imhist(g),title('Histogram Equalization'),ylim('auto')

Output:

II) Develop a Matlab code that will perform Image Enhancement using
averaging described above. (Uses Lab5_2.tif and the noise type is salt &
pepper).
Solution:
%hw2.m
clc

close all clear all


I=imread('Lab5_2.tif'); if length(size(I))>2 I=rgb2gray(I); end I=im2double(I);
for i=1:8
N=imnoise(I,'salt & pepper'); eval(['In' num2str(i) ' =N;'])

%Gaussian white noise

aluates the MATLAB code


ON.(In1=N); end I1=I+N;%noisy Image

2+In3+In4)/4;
8=(Ia6+In7+In8)/8;

,title('Original Image'); subplot(322),imshow(I1),title('noisy Image');


a2),title('Approx. due to 2 images') subplot(324),imshow(Ia4),title('Approx. due to 4 images') subplot(325),imshow(Ia6),title('Approx. due to 6 im
a8),title('Approx. due to 8 images')

Output:
2

You might also like