Doc _ Finale
-
Upload
vysakhpillai -
Category
Documents
-
view
216 -
download
0
Transcript of Doc _ Finale
-
8/14/2019 Doc _ Finale
1/12
Pseudo Coloration and Contrast EnhancementVysakh P
Department of EcEAmrita School of Engineering
Amritapuri Campus
Sandeep Nair CDepartment of EcE
Amrita School of EngineeringAmritapuri Campus
ABSTRACTThe paper presents algorithms for two of the essential image
processing techniques used in remote data sensing and medical
image processing namely contrast enhancement and pseudo
coloration.
KeywordsPseudo coloration, false coloring, contrast enhancement,
histogram equalization, intensity slicing.
1. INTRODUCTIONGenerally most of the scientific image accusation tools provide
an image in terms of varying grayscale intensities. This is
primarily because the image sensing transducer in most of such
equipment depends on frequencies outside the human visual
frequency. Specific techniques are applied to modify the
available raw data into grayscale intensities perceivable by the
human eye.
The number of gray levels depends on the amount of detail
required to be conveyed via the image.
The human perception is trained by the vibrant colours around
us in nature. So we easily identify patterns that are representedin colour. Also if the image is too dark (low contrast), we fail
to recognize patterns from it.
Exploiting the fact that many of the grayscale intensities can be
uniquely assigned to certain features in a context, many
algorithms for transforming grayscale images to colour images
have been developed.
2. PSEUDO COLOURINGThe process of assigning a particular colour to a particular
feature in a grayscale image preserving the intensity factor (or
not) so as to easily identify it (and represent it as a high
contrast colour image) is called pseudo colouring (or false
colouring). In order to understand the process, we require thebasic knowledge of digital image storage.
2.1 Digital image storageDigital images fall into two main categories:
Grayscale images
Colour images.
Gray scale images contain the intensity information of the
image in a two dimensional matrix format. The individual
matrix elements represent individual pixels and can be 1 to 32
bit long depending on the number of gray levels that are used
to represent the data. Usually the images are stored in 8-bit
long format resulting in 256 different gray levels (with 0
representing black and 255 representing white). At times they
are also represented in decimal format between 0 and 1
depending on the requirement.
Colour images are represented using three dimensional
matrices with each n x m matrix representing the red, green
and blue intensities separately which are taken together to
result in 256 x 256 x 256 possible colour combinations
(in case of 8-bit pixel notation). Representation of each
individual layer (red, green and blue) is similar to that of the
grayscale images.
2.2 Intensity slicing
The key idea used in the pseudo colouration process is to fix a
intensity slicing plane. The gray scale input image can be
represented as a mesh of pixel location vs. intensity. In 8-bit
image representation , the intensity scale ranges from 0 to 255.
So as to perform intensity slicing we fix an arbitrary plane at
an intensity level cutting the mesh into two halves. This is the
process of intensity slicing.
The second process is to assign a colour to the intensities
above and below the plane. Points lying on the plane are
arbitrarily assigned a colour. This is illustrated in the figurebelow.
2.3 ColourationThe process of colouration involves generating a threedimensional colour pixel matrix from the intensity scale
-
8/14/2019 Doc _ Finale
2/12
(grayscale) vector. This follows the intensity slicing operation
above to generate the final pseudo colored image.
The process involves identifying the RGB components of the
colours with which the intensity slices are to be substituted.
Each intensity component in the input vector is categorized
into a slice and the colour vector corresponding to each
intensity point is generated. In order to preserve the intensityinformation, the pixel value in the 3D result is multiplied with
a value proportional to the intensity in the original image.
The entire process can be summarized as below.
3. CONTRAST ENHANCEMENT
Images obtained from deep space telescope transponders or
medical imaging equipments rely mainly on signals from
outside the human visual spectrum. They are made into
visually perceivable format using variety of high endalgorithms and mathematical manipulations. But they usually
result in a grayscale image with gray levels clustered together
in certain regions (usually the low intensity regions). Same is
the case when camera aperture and shutter speeds are not
correctly set for manual cameras..
The resultant image will be dark and its features are not easily
recognizable by human eye.
In order to generate a high contrast gray scale image from a
low intensity image we employ principles of random variables
and histogram equalization.
3.1 Histogram equalizationThe intensity level information in a gray scale image can be
considered to be a random variable. On plotting the population
density (occurrence rate of each intensity level) as a histogram
we see that the intensity spectrum is clustered together near
some intensities. This is illustrated in Figure 3 below.
The equalization process involves normalizing the histogram
and replacing the intensities in the original image with the
intensities from the normalized curve.
The process of equalization involves finding the Cumulative
distribution of the random histogram. This normalizing curve
is used as the base curve for the transformation.
If r(x) is the normalized histogram of the original image(taking values between 0 and 1),
r(x) =1 [x=0, 1, 2.255].
Now, the transformation curve can be obtained by applying the
transformation equation
S(x) = r(x) [x=0, 1, 2.255].
In the case of the above histogram (Figure 3.), the normalized
histogram would look as in Figure 4 below.
Original
image
(gray
vector)
Intensity
slicing
Slice 1
Slice 2
Slice n
Colourization
Pseudo
coloured
outputimage
(colourvector)
Figure2. Pseudo-colouration process. Figure3. A low contrast image and its histogram
Figure4. Normalized histogram (transformation curve)
(see appendix for full details)
-
8/14/2019 Doc _ Finale
3/12
Now each intensity level in the original image is replaced by a
corresponding transformed intensity level as from the
transformation curve in Figure 4. [ S(x) ].
The histogram of the enhanced image will be evenly
distributed throughout the intensities. (shown in Figure 5).
.
The entire process of histogram equalization is schematically
shown below
4. ACKNOWLEDGMENTS
Our sincere thanks to Renu madam (lecturer Amrita School of
Engineering, Amritapuri campus ) for having provided us full
fledged support and motivation to take up this task andcomplete it successfully.
Our gratitude also extends to all staff members of our college
who directly or indirectly was associated with us throughout
the task.
Above all we thank the Almighty for having provided us with
all support in the forms mentioned above or otherwise.
5. REFERENCES[1] Digital Image Processing by Gonzales and Woods
[2] Fundamentals of image processing by Arun K Jain
[3] Image processing basics by
[4] Vidya [Campus intranet based e-book library]
[5] http://www.Wikipedia.com
Figure5. Enhanced image and its histogram.
(see appendix for full details)
Low
contrastgrayscale
image
Histogramformation
Normalizing
curveformation
Intensitysubstitution
Final high Image
Figure6. Histogram equalization process.
-
8/14/2019 Doc _ Finale
4/12
-
8/14/2019 Doc _ Finale
5/12
-
8/14/2019 Doc _ Finale
6/12
-
8/14/2019 Doc _ Finale
7/12
-
8/14/2019 Doc _ Finale
8/12
-
8/14/2019 Doc _ Finale
9/12
AppendixAppendixAppendixAppendixI
%Programtoenhancecontrastofagrayscaleimageusinghistogramequalizationmethod
% Authors:
% VysakhPandSandeepNairC
% S5ECE
% AmritaSchoolofEngineering,Amritapuri;
%*******************************************************************************
%Readingintheimageandconvertingitto'double'formattoenablecalculations
p=double(imread('washsat.tif'));
%displayingtheimage(imshowtakesintensitylevelsscaledfrom0->1)
figure,imshow(p/255);title('Originalfigure')
n=0; %Variableinit
[m,l]=size(p); %calculatingimagesize
k=m*l;
%TofindthePDFoftheintensityrandomvariables
fori=0:255
tmp=p-i; %makingalllocationsofintensityito0.
n(i+1)=k-length(find(tmp)); %Countingoccurrenceofi;
end %populationdensityofintensityiintheimage.
figure,stem(1:256,n);
title('Originalhistogram'); %Plottingtheoriginalhistogram;
n=n/k; %Normalizingthevalues
sum(n) %TestingifthePDFisValid.
%Remove'o'sfromstemplot(source:originalMatlabHisteqfunction)
hs=gca;
h=get(hs,'children');
delete(findobj(h,'flat','Marker','o'))
-
8/14/2019 Doc _ Finale
10/12
%Tofindthecumulativedistribution(togetthenormalizedcurve)
s=0; %Variableinit
fori=1:256
s(i)=sum(n(1:i)); %s(i)=sumofelementsfromn(1)ton(i)(CDF)end
figure,plot(s); %Plotofthenormalizedcurve
title('NormalisingCurve(transformationFn:)');
%Applyingthetransformationobtainedabove
eqim=p; %Storingimageintemporaryvariablefori=1:m
forj=1:l
eqim(i,j)=s(p(i,j)+1); %Eachintensitylevelinoriginalisreplacedwiththe
corresponding
end %variablein
end %thetransformationmatrix(thematrixindexof
%transformationmatrix
%from1-256storingthetransformedintensities%correspondingtoeachintheoriginal
figure,imshow(eqim);
title('Equalizedimage');
eqim=double(int8(eqim.*255)); %scalingrangebackto0->255androundingoffto
%integers
fori=0:255 %Findingtheequalizedhistogram
tmp=eqim-i;
n(i+1)=k-length(find(tmp));
end
figure,stem(1:256,n);
title('Equalizedhistogram'); %Plottingtheequalizedhistogram;
n=n/k;
sum(n)
-
8/14/2019 Doc _ Finale
11/12
%Remove'o'sfromstemplot
hs=gca;
h=get(hs,'children');
delete(findobj(h,'flat','Marker','o'))
%Tofindthecumulativedistribution(togetthenormalisedcurve)
s=0; %Variableinit
fori=1:256
s(i)=sum(n(1:i)); %s(i)=sumofelementsfromn(1)ton(i)(CDF)
end
figure,plot(s);
title('EqualizedCDF'); %Plotofthenormalizedcurve
-
8/14/2019 Doc _ Finale
12/12
AppendixAppendixAppendixAppendixII
%Programtofalsecolourofagrayscaleimageusingintensityslicingmethod
% Authors:
% VysakhPandSandeepNairC
% S5ECE
% AmritaSchoolofEngineering,Amritapuri;
%******************************************************************************* clear;
p=(imread('mri2.jpg')); %readinginthegrayscaleimagefigure,imshow(p); %displayingoriginalimage
p=double(p); %Typeconversionformathematicalmanipulation
[x,y]=size(p); %obtainingimagesize
fori=1:x
forj=1:y
pix=p(i,j);
ifpix