Professional Documents
Culture Documents
Chapter 3
Image Enhancement in the Spatial Domain
Part 1
1. Theoretical
Enhancement
The principal objective of enhancement is to process an image so that the result is
more suitable than the original image for a specific application.
S = T(r)
where T is a transformation that maps a pixel value (intensity) r into a pixel value s.
1
Linear
Identity: s = r, no transformation
S = L-1-r
L=0,1,2,3,4 =total 5
L=5
2
Logarithmic
Log Transformations
S = c log(1+r)
Power-law
Power-Law Transformations:
S = c rγ
3
2. Practical
Example1: Image Negatives
%img_neg.m
close all;
clear all;
I=imread('ch3.jpg');
I=im2double(I);
for i=1:size(I,1)
for j=1:size(I,2)
I1(i,j)=1-I(i,j);
end
end
subplot(121),imshow(I),title('original image')
subplot(122),imshow(I1),title('enhanced image (image negative)')
Output:
4
Output:
5
Enter the value of the constant c=1
Enter the value of gamma g=5 % for gamma value greater than 1 u gets dark image
3. Homework:
1. Repeat Example1 (Image Negatives) without converting the image to double, your output should
be the same as example1 output.