You are on page 1of 5

# Image Negatives And Log transformation

AIM: To study about image enhancement in spatial domain and to write a program in
MATLAB to generate image negative and log transformation.

## APPRATUS: PC with MATLAB software.

THEORY:
Objective of image enhancement:
To process am image so that result will be more suitable than original image for specific
application. A method which is quite useful for enhancing an image may or may not be
necessarily be the best approach for enhancing other image.

## Image enhancement approach fall into two broad categories:

1) Spatial domain.
2) Frequency domain.

## Spatial domain: Refers to image plane itself and approaches in this

category are based on direct manipulation of pixels in an image.
Frequency domain: Based on modifying the Fourier transform of an
image.

There are some enhancement techniques based on various combination of method from
these two categories:

## Spatial Domain Enhancement: Spatial refers to aggregate of pixels composing an

image. Spatial methods are procedure that operates directly on these pixels.
The spatial domain processes can be denoted by the expression

g (x,y) = T [ f(x. y ) ]
where,
f (x, y) is the input image.
g (x,y) is the output image.
T is an operator on defined over a neighborhood of point (x, y).

## Basic Gray Level Transformation: Intensity transformations arc among the

simplest of all image processing techniques. The values of pixels, before and alter
processing, will be denoted by r and s, respectively.
Image Negatives:
The negative of an image with intensity levels in the range [0, L- l] is obtained by using
the negative transformation which is given by the expression
s=L-1-r
Reversing the intensity levels of an image in this manner produces the equivalent of a
photographic negative. This type of processing is particularly suited tor enhancing white
or gray detail embedded in dark regions of an image, especially when the black areas are
dominant in size.

Log transformation :
The general form of the log transformation is
s =c log (1 + r)
Where,
c is a constant,
and it is assumed that r>>0.
The log curve maps a narrow range of low intensity values in the input into a
wider range of output levels. It to expand the values of dark pixels in an image while
compressing the higher-level values. It compresses the dynamic range of images with
large variations in pixel values. Example, Fourier spectrum image. It can have intensity
range from 0 to 10^6 or higher.
While processing numbers such as these presents no problems for a computer,
image display systems generally will not be able to reproduce.
Inverse Log Transform:
It does exactly opposite of log operation. It is used to expand values of high pixels in an
image while compressing dark level.

CONCLUSION: Thus in digital negative we have seen that the grey level intensity is
changed to corresponding white and the white level intensity is changed to corresponding
grey level and in log transformation we have seen that low intensity pixels have changed
to high intensity and vice versa.
DIGITAL NEGATIVE

clc;
close all;
clear all;
a=double(a);
figure(1);
imshow(uint8(a));
title ('input image');
[m n]=size(a);
b=max(max(a));
c=b-a;
figure(2);
imshow(uint8(c));
title('output image');
Logarithmic Operation
clear all;
close all;
a=double(a);
[m n]=size(a);
b=abs(fft2(a));
b_log=log(1+b);
figure(1);
subplot(2,2,1);
imshow(uint8(a));
title('original image');
subplot(2,2,2);
imshow(uint8(b));
title('fft image');
subplot(2,2,3);
imshow(uint8(10*b_log));
title('log operation');