SlideShare a Scribd company logo
1 of 23
MORPHOLOGICAL BACKGROUND DETECTION &
     ENHANCEMENT OF IMAGES WITH POOR LIGHTING

An industry Oriented Mini Project submitted to the Jawaharlal Nehru Technology University in
partial fulfillment of the requirements for the award of the Degree of
                                BACHELOR OF TECHNOLOGY
                                             IN
           ELECTRONICS AND COMMUNICATION AND ENGINEERING
                                     Submitted By

         K.Sindhu                     G.V.Charan Tej                   M.Srinivasulu
         07AJ1A0444                    07AJ1A0412                       07AJ1A0423




DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
             AMRITA SAI INSTITUTE OF SCIENCE AND TECHNOLOGY
             (APPROVED BY AICTE, NEW DELHI; AFFILIATED TO JNTU, KAKINADA)
                        PARITALA, KRISHNA DISTRICT – 521 180 (A. P.)
                                      NOV-DEC 2010




                                              1
CERTIFICATE

                              This is to certify that K.Sindhu(07AJ1A0444), G.V.Charan
tej(07AJ1A0412), M.Srinivasulu(07AJ1A0423) Students of B.Tech (Electronics And
Communication Engineering) IV-I Semester have successfully completed their project work,
titled “MORPHOLOGICAL BACKGROUND DETECTION & ENHANCEMENT OF
IMAGES WITH POOR LIGHTING” at AMRITA SAI INSTITUTE OF SCIENCE AND
TECHNOLOGY during the Academic year 2009-2010. This is submitted as a partial fulfillment
for the award of the Degree B.Tech( Electronics And Communication Engineering) and is not
submitted else where.



                                                  Head of the Department
                                                      (Mr.B.RamaRao)




                                           2
ACKNOWLEDGEMENTS


      We would like to express our deepest gratitude to Dr. P. V. SUBBAIAH            Principal,
Amrita Sai Institute of science and Technology.
       We are grateful to the Head of the Department of ECE Mr.B.RamaRao, under the
supervision of their assistance and encouragement in carrying out the project.
     We sincerely thank all the faculty and staff members of the Department of ECE for their
kind co-operation.
     Finally we thank one and all who directly or indirectly helped us to complete our
mini project successfully.


                                                                       Yours Sincerely,
                                                                                      K.Sindhu
                                                                                 G.V.Charan tej
                                                                                  M.Srinivasulu




                                             3
CONTENTS

 ABSTRACT

1. INTRODUCTION

  1.1 Morphology
  1.2 Morphological Transformations

2. PROPOSED METHOD

  2.1   Background detection by block analysis
  2.2   Background detection using morphological operations
  2.3   Structuring element
  2.4   Histogram equalization


3. CODING

4. RESULT & CONCLUSION




                                           4
ABSTRACT:
       In this project, some morphological transformations are used to detect the background in
images characterized by poor lighting. Lately, contrast image enhancement has been carried out
by the application of two operators based on the Weber’s law notion. The first operator employs
information from block analysis, while the second transformation utilizes the opening by
reconstruction, which is employed to define the multi background notion.
       When we are taking the image, the flash will fall on the target and reflects back to the
lens. Then the monochrome image will be formed. The image may be dark or poor lightening.
Due poor lightening the background of the image is not clear. This image can be enhanced by
lightening the back ground. It employs the division of whole image of into several blocks. Each
block consists of pixels. Find out the minimum and the maximum values of the pixels in that
block. Calculate the average value of the pixel. Now change the values of the remaining pixels in
the block to the average value. We do the same process for the remaining blocks also. Then the
enhanced image is formed. Consider the each pixel in the original image in enhanced image and
corresponding pixel in original image and thus combine these pixels using Weber’s law. Thus a
reconstructed image is obtained. In this way the background lightening can be enhanced.




                                               5
1. INTRODUCTION

                        The world is filled with images, which are representations of objects and
scenes in the real world. Images are represented by an array of pixels, which can represent the
gray levels or colors of the image. There are many aspects of images that are ambiguous and
uncertain. Examples of these vague aspects include determining the border of a blurred object
and determining which gray values of pixels are bright and which are dark Sometimes an image
may be too dark contains blurriness and therefore difficult to recognize the different objects or
scenery contained in the image. Image enhancement algorithms are applied to remotely sensed
data to improve the appearance of an image for human visual analysis or occasionally for
subsequent machine analysis. The objective of image enhancement is dependent on the
application context; criteria for enhancement are often subjective or too complex to be easily
converted to useful objective measures. Image enhancement techniques are widely used in many
fields, where the subjective quality of images is important. Many algorithms for achieving
contrast enhancement have been developed. Those enhancement algorithms can be classified into
two types point operations, which are global and spatial neighborhood techniques, which are
local.
                       In this work, two methodologies to compute the image background are
proposed. Also, some operators to enhance and normalize the contrast in grey level images with
poor lighting are introduced. Contrast operators are based on the logarithm function in a similar
way to Weber’s law. The use of the logarithm function avoids abrupt changes in lighting. Also,
two approximations to compute the background in the processed images are proposed using Mat
lab Simulink. The first proposal consists in an analysis by blocks, whereas in the second
proposal, the opening by reconstruction.
                      Even though morphological contrast has been largely studied, there are no
methodologies, from the point of view MM, capable of simultaneously normalizing and
enhancing the contrast in images with poor lighting. On the other side, one of the most common
techniques in image processing to enhance dark regions is the use of nonlinear functions, such as
logarithm or power functions ; otherwise, a method that works in the frequency domain is the
homomorphic filter . In addition, there are techniques based on data statistical analysis, such as
global and local histogram equalization. During the histogram equalization process, grey level

                                                6
intensities are reordered within the image to obtain a uniform distributed histogram. However,
the main disadvantage of histogram equalization is that the global properties of the image cannot
be properly applied in a local context, frequently producing a poor performance in detail
preservation. In, a method to enhance contrast is proposed; the methodology consists in solving
an optimization problem that maximizes the average local contrast of an image.


1.1 Morphology:
       Morphology is a technique of image processing based on shapes. The value of each pixel
in the output image is based on a comparison of the corresponding pixel in the input image with
its neighbors. By choosing the size and shape of the neighborhood, you can construct a
morphological operation that is sensitive to specific shapes in the input image.
       Mathematical morphology is a set-theoretical approach to multi-dimensional digital
signal or image analysis, based on shape. It is a theory and technique for the analysis and
processing of geometrical structures, based on set theory, lattice theory, topology, and random
functions. It is most commonly applied to digital images, but it can be employed as well on
graphs, surface meshes, solids, and many other spatial structures.

       It is also the foundation of morphological image processing, which consists of a set of
operators that transform images according to the above characterizations.

           Mathematical morphology was originally developed for binary images, and was later
extended to scale functions and images. The subsequent generalization to complete lattices is
widely accepted today as MM's theoretical foundation.


1.2 Morphological transformations:
            Basically morphological transformations such as erosion, dilation, opening & closing
are used to detect the background.
Erosion:
           Erosion is one of the two basic operators in the area of mathematical morphology, the
other being dilation. It is typically applied to binary images, but there are versions that work on
gray scale images. The erosion operator takes two pieces of data as inputs. The first is the image
which is to be eroded. The second is a (usually small) set of coordinate points known as a

                                                 7
structuring element (also known as a kernel). It is this structuring element that determines the
precise effect of the erosion on the input image. In erosion, every object pixel that is touching a
background pixel is changed into a background pixel.
                    Gray scale erosion with a flat disk shaped structuring element will generally
darken the image. Bright regions surrounded by dark regions shrink in size, and dark regions
surrounded by bright regions grow in size. Small bright spots in images will disappear as they
are eroded away down to the surrounding intensity value, and small dark spots will become
larger spots. The effect is most marked at places in the image where the intensity changes
rapidly, and regions of fairly uniform intensity will be left more or less unchanged except at their
edges.
Dilation:
                              Dilation adds pixels to the boundaries of objects in an image. In
dilation, every background pixel that is touching an object pixel is changed into an object pixel.
Note how the function applies the rule to the input pixel's neighborhood and uses the highest
value of all the pixels in the neighborhood as the value of the corresponding pixel in the output
image.




                                                 8
2. PROPOSED METHOD


       In this project there are two approximations to compute the backgrounds in the processed
images are proposed using Matlab simulink. The first proposal consists in an analysis by blocks,
whereas in the second proposal, morphological operators are used.


2.1 Background Detection by Block Analysis:
       In this analysis, first of all we will read an image as input image and divide it into several
blocks and from each block we will determine the background and apply the weber’s law and
thereby we obtain an enhanced image




            Fig. 2.1.1 Block diagram of Background Detection by Block Analysis
                  Let us consider an image which is to be enhanced. The image is divided into n
blocks of size. Each block is a sub image of the original image. As the image is made up of
number of pixels each block consists of number of pixels. Find the maximum and minimum
intensity values of pixels of each block.
                  For each analyzed block, maximum (Mi) and minimum (mi) values are used to
determine the background criteria Ti in the following way:




                                                 9
In the 1-D case, as illustrated in Fig, the following expression is obtained:




                  Fig. 2.1.2: Background criteria obtained by block analysis.

                      Once Ti is calculated, this value is used to select the background parameter
associated with the analyzed block. As follows, an expression to enhance the contrast is
proposed:




                              Note that the background parameter depends on the Ti value. If f<=
Ti(dark region), the background parameter takes the value of the maximum intensity(Mi) within
the analyzed block, and the minimum intensity(mi) value otherwise. Also, the unit was added to
the logarithm function in above equation to avoid indetermination. On the other hand, since grey
level images are used in this work, the constant Ki in above equation is obtained as follows:




                     On the other hand, M i. and mi values are used as background parameters to
improve the contrast depending on the Ti value, due to the background is different for clear and
dark regions. Now an image is formed by applying the above equation. Now consider a pixel in

                                                 10
this image and the corresponding pixel in original image. Combine them using Weber’s law
which can be stated as follows. Thus an enhanced image is formed.
Weber’s Law:
       In psycho-visual studies, the contrast C of an object with luminance Lmax against its
surrounding luminance Lmin is defined as follows
               If L=Lmin and     =Lmax-Lmin so it can be written as follows




In the above Equation indicates that(log L) is proportional to C. Therefore, Weber’s law can be

expressed as
           Where k and b are constants, b being the background. In this case, an approximation
to Weber’s law is considered by taking the luminance L as the grey level intensity of a function
(image); in this way, above expression is written as follows




2.2 Background detection using morphological operators:
                               On the other hand, given that, maximum and minimum values are
analyzed for each block, an extension using morphological operators is presented as follows.




          Fig. 2.2 Block diagram of Background Detection by Erosion & Dilation


                                               11
Morphological operations:
               In a morphological operation, the value of each pixel in the output image is based
on a comparison of the corresponding pixel in the input image with its neighbors. By choosing
the size and shape of the neighborhood, you can construct a morphological operation that is
sensitive to specific shapes in the input image.      Dilation and erosion are two fundamental
morphological operations. Dilation adds pixels to the boundaries of objects in an image, while
erosion removes pixels on object boundaries. The number of pixels added or removed from the
objects in an image depends on the size and shape of the structuring element used to process the
image. In the morphological dilation and erosion operations, the state of any given pixel in the
output image is determined by applying a rule to the corresponding pixel and its neighbors in the
input image. The rule used to process the pixels defines the operation as a dilation or an erosion.




Rules for Dilation and Erosion:


Operation Rule

Dilation       The value of the output pixel is the maximum value of all the pixels in the input
               pixel's neighborhood. In a binary image, if any of the pixels is set to the value 1,
               the output pixel is set to 1.


               The value of the output pixel is the minimum value of all the pixels in the input
Erosion        pixel's neighborhood. In a binary image, if any of the pixels is set to 0, the output
               pixel is set to 0.




                                                12
Erosion:
             Erosion is one of the two basic operators in the area of mathematical morphology,
the other being dilation. It is typically applied to binary images, but there are versions that work
on gray scale images. The erosion operator takes two pieces of data as inputs. The first is the
image which is to be eroded. The second is a (usually small) set of coordinate points known as a
structuring element (also known as a kernel). It is this structuring element that determines the
precise effect of the erosion on the input image. In erosion, every object pixel that is touching a
background pixel is changed into a background pixel.
Dilation:
            Dilation adds pixels to the boundaries of objects in an image. In dilation, every
background pixel that is touching an object pixel is changed into an object pixel. Note how the
function applies the rule to the input pixel's neighborhood and uses the highest value of all the
pixels in the neighborhood as the value of the corresponding pixel in the output image.
               Let Imax(x) and Imin(x) be the maximum and minimum intensity values taken from
one set of pixels contained in a window (B) of elemental size (3 X 3 elements), x belongs to D.
Notice that the window corresponds to the structuring element .A new expression can be derived
as shown:




                        Where Imax(x) and Imin(x) values correspond to the morphological dilation
and erosion defined by the order-statistical filters. Thus, the above expression is expressed as




Finally the proposed transformation is expressed as




                                                13
2.3 Structuring Elements:


                        An essential part of the dilation and erosion operations is the structuring
element used to probe the input image. A structuring element is a matrix consisting of only 0's
and 1's that can have any arbitrary shape and size. The pixels with values of 1 define the
neighborhood.
                   Two-dimensional, or flat, structuring elements are typically much smaller than
the image being processed. The center pixel of the structuring element, called the origin,
identifies the pixel of interest -- the pixel being processed. The pixels in the structuring element
containing 1's define the neighborhood of the structuring element. These pixels are also
considered in dilation or erosion processing.
                     Three-dimensional, or nonflat, structuring elements use 0's and 1's to define
the extent of the structuring element in the x- and y-planes and add height values to define the
third dimension.
 Origin of a Structuring Element:
                         The morphological functions use this code to get the coordinates of the
origin of structuring elements of any size and dimension


                        Origin = floor ((size (nhood) +1)/2)             (1)
        Here nhood is the neighborhood defining the structuring element. Because structuring
elements are MATLAB objects, we cannot use the size of the STREL object itself in this



                                                14
calculation. We must use the STRELgetnhood method to retrieve the neighborhood of the
structuring element from the STREL object.
For example, the following illustrates a diamond-shaped structuring element




                        Fig. 4.3 a diamond-shaped structuring elemen


    Creating a Structuring Element:
                             The toolbox dilation and erosion functions accept structuring element
objects, called STRELs. We use the strel function to create STRELs of any arbitrary size and
shape. The strel function also includes built-in support for many common shapes, such as lines,
diamonds, disks, periodic lines, and balls.
For example, this code creates a flat, diamond-shaped structuring element.
                        se = strel ('diamond', 3)
.                 where 3 specifies the distance from the structuring element origin to the points
of the diamond.
2.4 Histogram Equalization:
                                Histogram equalization is a method in imageprocessing of contrast
adjustment using the image'shistogram. This method usually increases the global contrast of
many images, especially when the usable data of the image is represented by close contrast
values. Through this adjustment, the intensities can be better distributed on the histogram. This
allows for areas of lower local contrast to gain a higher contrast without affecting the global
contrast. Histogram equalization accomplishes this by effectively spreading out the most
frequent intensity values.
                             The method is useful in images with backgrounds and foregrounds that
are both bright or both dark. In particular, the method can lead to better views of bone structure
in x-ray images, and to better detail in photographs that are over or under-exposed.
                                                    15
Histogram equalization often produces unrealistic effects in photographs;
however it is very useful for scientific images like thermal, satellite or x-ray images, often the
same class of images that user would apply false-color to. Also histogram equalization can
produce undesirable effects (like visible image gradient) when applied to images with low color
depth.




                      Figure shows that for any given mapping function y=f(x) between the
input and output Images, the following holds p(y) dy=p(x) dxi.ie., the number of pixels mapped
from x to y is unchanged.




                                               16
3.CODING
Main:
clc
clear all
close all
[file path]=uigetfile('*.jpg');
I=imread([path file]);
eqn10(I); % IMAGE BACKGROUND APPROXIMATION BY BLOCKS
eqn13(I);
% histogram_eq(I); % HISTOGRAM EQUALIZATION


Eqn10:
function eqn10(I)
figure,imshow(I);title('Original Image');
I=imresize(I,[256 256]);
I=rgb2gray(I);
I=double(I);
xw=8;


for i=1:size(I,1)/xw
  for j=1:size(I,2)/xw
      B=I(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw);
      m=min(min(B))/255;
      M=max(max(B))/255;
      t=(m+M)/2;
      BB=blockkk(m,M,t,B,xw);
      I1(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw)=BB;


  end
end
figure,subplot(1,2,1)

                                               17
imshow(I,[]);title('Original Image');
subplot(1,2,2)
imshow(I1,[]);title('Enhanced Image: Eqn 10');




% Histogram
figure,
subplot(1,2,1),imhist(uint8(I))
title('INPUT IMAGE')
axis([0 255 0 8000])
subplot(1,2,2),imhist(uint8(I1))
title('IMAGE EQN10')
axis([0 255 0 8000])


% Disply Graph


figure,plot(I(25,:),'r'),hold on
plot(I1(size(I,1)/2,:),'g')
% axis([0 255 0 260])
legend('Input Image','Out put Image')
xlabel('Intensity level')
ylabel('Image Values')
title('IMAGE BACKGROUND APPROXIMATION BY BLOCKS EQN10')




function BB=blockkk(m,M,t,B,xw)
BB=zeros(xw);
for i=1:xw
  for j=1:xw
     f=B(i,j);
     if f > t

                                                 18
mm=m;
       else
         mm=M;
       end
       k=(255-mm)/log(256);
       if f<=t
         BB(i,j)=k*log(f+1)+M;
       else
         BB(i,j)=k*log(f+1)+m;
       end
  end
end


Eqn13:
function eqn13(I)
I=imresize(I,[256 256]);
I=rgb2gray(I);
I=double(I);
u=1;
radious=2*u+1;
se=strel('square',radious);
xw=8;
for i=1:size(I,1)/xw
  for j=1:size(I,2)/xw
       B=I(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw);
       BB=formula(B,se);
       I1(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw)=BB;
  end
end
figure,subplot(1,2,1)
imshow(I,[]),title('Original Image')

                                              19
subplot(1,2,2)
imshow(I1,[]);title('eqn13 Image')


% Histogram
figure,
subplot(1,2,1),imhist(uint8(I))
title('INPUT IMAGE')
axis([0 255 0 8000])
subplot(1,2,2),imhist(uint8(I1))
title('IMAGE EQN13')
axis([0 255 0 8000])


% Disply Graph
figure,plot(I(size(I,1)/2,:),'r'),hold on
plot(I1(size(I,1)/2,:),'g'),axis([0 255 0 260])
legend('Input Image','Out put Image')
xlabel('Intensity level')
ylabel('Image Values')
title('IMAGE BACKGROUND APPROXIMATION BY BLOCKS EQN13')


function I1=formula(I,se)
I1=zeros(size(I,1));
E=imerode(I,se);
D=imdilate(I,se);
for i=1:size(I,1)
  for j=1:size(I,2)
     e=E(i,j);
     d=D(i,j);
     f=I(i,j);
     t=(e+d)/2;
     k=(255-t)/log(256);

                                                  20
if f<=t
        I1(i,j)=k*log2(f+1)+d;
      else
        I1(i,j)=k*log2(f+1)+e;
      end
  end
end


Histogram eqn:
function histogram_eq(I)
I=imresize(I,[256 256]);
I=rgb2gray(I);
I1=histeq(I);
figure,subplot(1,2,1)
imshow(I,[]),title('Original Image')
subplot(1,2,2)
imshow(I1,[]),title('Histogram Equalization')
% Histogram
figure, subplot(1,2,1),imhist(uint8(I))
title('INPUT IMAGE')
axis([0 255 0 8000])
subplot(1,2,2),imhist(uint8(I1))
title('HIST EQUAIZATION')
axis([0 255 0 8000])
% Disply Graph
figure,plot(I(size(I,1)/2,:),'r'),hold on
plot(I1(size(I,1)/2,:),'g'),axis([0 255 0 260])
legend('Input Image','Out put Image')
xlabel('Intensity level')
ylabel('Image Values')
title('HISTOGRAM EQUALIZATION')

                                                  21
4. RESULT & CONCLUSION
              This project presents a study to detect the image background and to enhance the
contrast in binary images with poor lighting. First, a methodology was introduced to compute
an approximation to the background using blocks analysis. This proposal was subsequently
extended using mathematical morphology operators.
                         Let us consider the input image as shown in fig (a) and the obtained
enhanced image which is shown in the fig (b)




                                    Fig (a) Original image




                                   Fig (b) Enhanced image




                                               22
23

More Related Content

What's hot

An application of morphological
An application of morphologicalAn application of morphological
An application of morphological
Naresh Chilamakuri
 
MULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDING
MULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDINGMULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDING
MULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDING
ijistjournal
 
QUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGIC
QUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGICQUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGIC
QUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGIC
ijsc
 
Image compression and reconstruction using a new approach by artificial neura...
Image compression and reconstruction using a new approach by artificial neura...Image compression and reconstruction using a new approach by artificial neura...
Image compression and reconstruction using a new approach by artificial neura...
Hưng Đặng
 

What's hot (19)

IRJET - Review of Various Multi-Focus Image Fusion Methods
IRJET - Review of Various Multi-Focus Image Fusion MethodsIRJET - Review of Various Multi-Focus Image Fusion Methods
IRJET - Review of Various Multi-Focus Image Fusion Methods
 
Property based fusion for multifocus images
Property based fusion for multifocus imagesProperty based fusion for multifocus images
Property based fusion for multifocus images
 
Fpga implementation of image segmentation by using edge detection based on so...
Fpga implementation of image segmentation by using edge detection based on so...Fpga implementation of image segmentation by using edge detection based on so...
Fpga implementation of image segmentation by using edge detection based on so...
 
Fpga implementation of image segmentation by using edge detection based on so...
Fpga implementation of image segmentation by using edge detection based on so...Fpga implementation of image segmentation by using edge detection based on so...
Fpga implementation of image segmentation by using edge detection based on so...
 
Deep Neural NEtwork
Deep Neural NEtworkDeep Neural NEtwork
Deep Neural NEtwork
 
IRJET- Comparison and Simulation based Analysis of an Optimized Block Mat...
IRJET-  	  Comparison and Simulation based Analysis of an Optimized Block Mat...IRJET-  	  Comparison and Simulation based Analysis of an Optimized Block Mat...
IRJET- Comparison and Simulation based Analysis of an Optimized Block Mat...
 
649 652
649 652649 652
649 652
 
2018 09
2018 092018 09
2018 09
 
An application of morphological
An application of morphologicalAn application of morphological
An application of morphological
 
A Combined Model for Image Inpainting
A Combined Model for Image InpaintingA Combined Model for Image Inpainting
A Combined Model for Image Inpainting
 
COMPRESSION BASED FACE RECOGNITION USING DWT AND SVM
COMPRESSION BASED FACE RECOGNITION USING DWT AND SVMCOMPRESSION BASED FACE RECOGNITION USING DWT AND SVM
COMPRESSION BASED FACE RECOGNITION USING DWT AND SVM
 
J25043046
J25043046J25043046
J25043046
 
An ensemble classification algorithm for hyperspectral images
An ensemble classification algorithm for hyperspectral imagesAn ensemble classification algorithm for hyperspectral images
An ensemble classification algorithm for hyperspectral images
 
MULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDING
MULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDINGMULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDING
MULTIPLE CAUSAL WINDOW BASED REVERSIBLE DATA EMBEDDING
 
Extended Fuzzy Hyperline Segment Neural Network for Fingerprint Recognition
Extended Fuzzy Hyperline Segment Neural Network for Fingerprint RecognitionExtended Fuzzy Hyperline Segment Neural Network for Fingerprint Recognition
Extended Fuzzy Hyperline Segment Neural Network for Fingerprint Recognition
 
QUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGIC
QUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGICQUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGIC
QUALITY ASSESSMENT OF PIXEL-LEVEL IMAGE FUSION USING FUZZY LOGIC
 
Image compression and reconstruction using a new approach by artificial neura...
Image compression and reconstruction using a new approach by artificial neura...Image compression and reconstruction using a new approach by artificial neura...
Image compression and reconstruction using a new approach by artificial neura...
 
Review on Optimal image fusion techniques and Hybrid technique
Review on Optimal image fusion techniques and Hybrid techniqueReview on Optimal image fusion techniques and Hybrid technique
Review on Optimal image fusion techniques and Hybrid technique
 
1705.07543
1705.075431705.07543
1705.07543
 

Similar to Morpho

PS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958H
PS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958HPS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958H
PS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958H
Saurabh Kumar
 
IJARCCE 22
IJARCCE 22IJARCCE 22
IJARCCE 22
Prasad K
 

Similar to Morpho (20)

Analysis of Multi-focus Image Fusion Method Based on Laplacian Pyramid
Analysis of Multi-focus Image Fusion Method Based on Laplacian PyramidAnalysis of Multi-focus Image Fusion Method Based on Laplacian Pyramid
Analysis of Multi-focus Image Fusion Method Based on Laplacian Pyramid
 
557 480-486
557 480-486557 480-486
557 480-486
 
B42020710
B42020710B42020710
B42020710
 
A Review on Deformation Measurement from Speckle Patterns using Digital Image...
A Review on Deformation Measurement from Speckle Patterns using Digital Image...A Review on Deformation Measurement from Speckle Patterns using Digital Image...
A Review on Deformation Measurement from Speckle Patterns using Digital Image...
 
Review of Image Segmentation Techniques based on Region Merging Approach
Review of Image Segmentation Techniques based on Region Merging ApproachReview of Image Segmentation Techniques based on Region Merging Approach
Review of Image Segmentation Techniques based on Region Merging Approach
 
IRJET- Multi Image Morphing: A Review
IRJET- Multi Image Morphing: A ReviewIRJET- Multi Image Morphing: A Review
IRJET- Multi Image Morphing: A Review
 
IRJET- Retinal Fundus Image Segmentation using Watershed Algorithm
IRJET-  	  Retinal Fundus Image Segmentation using Watershed AlgorithmIRJET-  	  Retinal Fundus Image Segmentation using Watershed Algorithm
IRJET- Retinal Fundus Image Segmentation using Watershed Algorithm
 
Survey on Image Integration of Misaligned Images
Survey on Image Integration of Misaligned ImagesSurvey on Image Integration of Misaligned Images
Survey on Image Integration of Misaligned Images
 
Ijartes v1-i2-008
Ijartes v1-i2-008Ijartes v1-i2-008
Ijartes v1-i2-008
 
International Journal of Computational Engineering Research(IJCER)
 International Journal of Computational Engineering Research(IJCER)  International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Identik Problem
Identik ProblemIdentik Problem
Identik Problem
 
Rotation Invariant Face Recognition using RLBP, LPQ and CONTOURLET Transform
Rotation Invariant Face Recognition using RLBP, LPQ and CONTOURLET TransformRotation Invariant Face Recognition using RLBP, LPQ and CONTOURLET Transform
Rotation Invariant Face Recognition using RLBP, LPQ and CONTOURLET Transform
 
PS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958H
PS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958HPS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958H
PS1_2014_2012B5A7521P_2012B5A7848P_2012B4A7958H
 
Ijetr021113
Ijetr021113Ijetr021113
Ijetr021113
 
Ijetr021113
Ijetr021113Ijetr021113
Ijetr021113
 
Different Image Fusion Techniques –A Critical Review
Different Image Fusion Techniques –A Critical ReviewDifferent Image Fusion Techniques –A Critical Review
Different Image Fusion Techniques –A Critical Review
 
IJARCCE 22
IJARCCE 22IJARCCE 22
IJARCCE 22
 
Effective segmentation of sclera, iris and pupil in noisy eye images
Effective segmentation of sclera, iris and pupil in noisy eye imagesEffective segmentation of sclera, iris and pupil in noisy eye images
Effective segmentation of sclera, iris and pupil in noisy eye images
 
Fd36957962
Fd36957962Fd36957962
Fd36957962
 
Recognition of optical images based on the
Recognition of optical images based on theRecognition of optical images based on the
Recognition of optical images based on the
 

Recently uploaded

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 

Morpho

  • 1. MORPHOLOGICAL BACKGROUND DETECTION & ENHANCEMENT OF IMAGES WITH POOR LIGHTING An industry Oriented Mini Project submitted to the Jawaharlal Nehru Technology University in partial fulfillment of the requirements for the award of the Degree of BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION AND ENGINEERING Submitted By K.Sindhu G.V.Charan Tej M.Srinivasulu 07AJ1A0444 07AJ1A0412 07AJ1A0423 DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING AMRITA SAI INSTITUTE OF SCIENCE AND TECHNOLOGY (APPROVED BY AICTE, NEW DELHI; AFFILIATED TO JNTU, KAKINADA) PARITALA, KRISHNA DISTRICT – 521 180 (A. P.) NOV-DEC 2010 1
  • 2. CERTIFICATE This is to certify that K.Sindhu(07AJ1A0444), G.V.Charan tej(07AJ1A0412), M.Srinivasulu(07AJ1A0423) Students of B.Tech (Electronics And Communication Engineering) IV-I Semester have successfully completed their project work, titled “MORPHOLOGICAL BACKGROUND DETECTION & ENHANCEMENT OF IMAGES WITH POOR LIGHTING” at AMRITA SAI INSTITUTE OF SCIENCE AND TECHNOLOGY during the Academic year 2009-2010. This is submitted as a partial fulfillment for the award of the Degree B.Tech( Electronics And Communication Engineering) and is not submitted else where. Head of the Department (Mr.B.RamaRao) 2
  • 3. ACKNOWLEDGEMENTS We would like to express our deepest gratitude to Dr. P. V. SUBBAIAH Principal, Amrita Sai Institute of science and Technology. We are grateful to the Head of the Department of ECE Mr.B.RamaRao, under the supervision of their assistance and encouragement in carrying out the project. We sincerely thank all the faculty and staff members of the Department of ECE for their kind co-operation. Finally we thank one and all who directly or indirectly helped us to complete our mini project successfully. Yours Sincerely, K.Sindhu G.V.Charan tej M.Srinivasulu 3
  • 4. CONTENTS ABSTRACT 1. INTRODUCTION 1.1 Morphology 1.2 Morphological Transformations 2. PROPOSED METHOD 2.1 Background detection by block analysis 2.2 Background detection using morphological operations 2.3 Structuring element 2.4 Histogram equalization 3. CODING 4. RESULT & CONCLUSION 4
  • 5. ABSTRACT: In this project, some morphological transformations are used to detect the background in images characterized by poor lighting. Lately, contrast image enhancement has been carried out by the application of two operators based on the Weber’s law notion. The first operator employs information from block analysis, while the second transformation utilizes the opening by reconstruction, which is employed to define the multi background notion. When we are taking the image, the flash will fall on the target and reflects back to the lens. Then the monochrome image will be formed. The image may be dark or poor lightening. Due poor lightening the background of the image is not clear. This image can be enhanced by lightening the back ground. It employs the division of whole image of into several blocks. Each block consists of pixels. Find out the minimum and the maximum values of the pixels in that block. Calculate the average value of the pixel. Now change the values of the remaining pixels in the block to the average value. We do the same process for the remaining blocks also. Then the enhanced image is formed. Consider the each pixel in the original image in enhanced image and corresponding pixel in original image and thus combine these pixels using Weber’s law. Thus a reconstructed image is obtained. In this way the background lightening can be enhanced. 5
  • 6. 1. INTRODUCTION The world is filled with images, which are representations of objects and scenes in the real world. Images are represented by an array of pixels, which can represent the gray levels or colors of the image. There are many aspects of images that are ambiguous and uncertain. Examples of these vague aspects include determining the border of a blurred object and determining which gray values of pixels are bright and which are dark Sometimes an image may be too dark contains blurriness and therefore difficult to recognize the different objects or scenery contained in the image. Image enhancement algorithms are applied to remotely sensed data to improve the appearance of an image for human visual analysis or occasionally for subsequent machine analysis. The objective of image enhancement is dependent on the application context; criteria for enhancement are often subjective or too complex to be easily converted to useful objective measures. Image enhancement techniques are widely used in many fields, where the subjective quality of images is important. Many algorithms for achieving contrast enhancement have been developed. Those enhancement algorithms can be classified into two types point operations, which are global and spatial neighborhood techniques, which are local. In this work, two methodologies to compute the image background are proposed. Also, some operators to enhance and normalize the contrast in grey level images with poor lighting are introduced. Contrast operators are based on the logarithm function in a similar way to Weber’s law. The use of the logarithm function avoids abrupt changes in lighting. Also, two approximations to compute the background in the processed images are proposed using Mat lab Simulink. The first proposal consists in an analysis by blocks, whereas in the second proposal, the opening by reconstruction. Even though morphological contrast has been largely studied, there are no methodologies, from the point of view MM, capable of simultaneously normalizing and enhancing the contrast in images with poor lighting. On the other side, one of the most common techniques in image processing to enhance dark regions is the use of nonlinear functions, such as logarithm or power functions ; otherwise, a method that works in the frequency domain is the homomorphic filter . In addition, there are techniques based on data statistical analysis, such as global and local histogram equalization. During the histogram equalization process, grey level 6
  • 7. intensities are reordered within the image to obtain a uniform distributed histogram. However, the main disadvantage of histogram equalization is that the global properties of the image cannot be properly applied in a local context, frequently producing a poor performance in detail preservation. In, a method to enhance contrast is proposed; the methodology consists in solving an optimization problem that maximizes the average local contrast of an image. 1.1 Morphology: Morphology is a technique of image processing based on shapes. The value of each pixel in the output image is based on a comparison of the corresponding pixel in the input image with its neighbors. By choosing the size and shape of the neighborhood, you can construct a morphological operation that is sensitive to specific shapes in the input image. Mathematical morphology is a set-theoretical approach to multi-dimensional digital signal or image analysis, based on shape. It is a theory and technique for the analysis and processing of geometrical structures, based on set theory, lattice theory, topology, and random functions. It is most commonly applied to digital images, but it can be employed as well on graphs, surface meshes, solids, and many other spatial structures. It is also the foundation of morphological image processing, which consists of a set of operators that transform images according to the above characterizations. Mathematical morphology was originally developed for binary images, and was later extended to scale functions and images. The subsequent generalization to complete lattices is widely accepted today as MM's theoretical foundation. 1.2 Morphological transformations: Basically morphological transformations such as erosion, dilation, opening & closing are used to detect the background. Erosion: Erosion is one of the two basic operators in the area of mathematical morphology, the other being dilation. It is typically applied to binary images, but there are versions that work on gray scale images. The erosion operator takes two pieces of data as inputs. The first is the image which is to be eroded. The second is a (usually small) set of coordinate points known as a 7
  • 8. structuring element (also known as a kernel). It is this structuring element that determines the precise effect of the erosion on the input image. In erosion, every object pixel that is touching a background pixel is changed into a background pixel. Gray scale erosion with a flat disk shaped structuring element will generally darken the image. Bright regions surrounded by dark regions shrink in size, and dark regions surrounded by bright regions grow in size. Small bright spots in images will disappear as they are eroded away down to the surrounding intensity value, and small dark spots will become larger spots. The effect is most marked at places in the image where the intensity changes rapidly, and regions of fairly uniform intensity will be left more or less unchanged except at their edges. Dilation: Dilation adds pixels to the boundaries of objects in an image. In dilation, every background pixel that is touching an object pixel is changed into an object pixel. Note how the function applies the rule to the input pixel's neighborhood and uses the highest value of all the pixels in the neighborhood as the value of the corresponding pixel in the output image. 8
  • 9. 2. PROPOSED METHOD In this project there are two approximations to compute the backgrounds in the processed images are proposed using Matlab simulink. The first proposal consists in an analysis by blocks, whereas in the second proposal, morphological operators are used. 2.1 Background Detection by Block Analysis: In this analysis, first of all we will read an image as input image and divide it into several blocks and from each block we will determine the background and apply the weber’s law and thereby we obtain an enhanced image Fig. 2.1.1 Block diagram of Background Detection by Block Analysis Let us consider an image which is to be enhanced. The image is divided into n blocks of size. Each block is a sub image of the original image. As the image is made up of number of pixels each block consists of number of pixels. Find the maximum and minimum intensity values of pixels of each block. For each analyzed block, maximum (Mi) and minimum (mi) values are used to determine the background criteria Ti in the following way: 9
  • 10. In the 1-D case, as illustrated in Fig, the following expression is obtained: Fig. 2.1.2: Background criteria obtained by block analysis. Once Ti is calculated, this value is used to select the background parameter associated with the analyzed block. As follows, an expression to enhance the contrast is proposed: Note that the background parameter depends on the Ti value. If f<= Ti(dark region), the background parameter takes the value of the maximum intensity(Mi) within the analyzed block, and the minimum intensity(mi) value otherwise. Also, the unit was added to the logarithm function in above equation to avoid indetermination. On the other hand, since grey level images are used in this work, the constant Ki in above equation is obtained as follows: On the other hand, M i. and mi values are used as background parameters to improve the contrast depending on the Ti value, due to the background is different for clear and dark regions. Now an image is formed by applying the above equation. Now consider a pixel in 10
  • 11. this image and the corresponding pixel in original image. Combine them using Weber’s law which can be stated as follows. Thus an enhanced image is formed. Weber’s Law: In psycho-visual studies, the contrast C of an object with luminance Lmax against its surrounding luminance Lmin is defined as follows If L=Lmin and =Lmax-Lmin so it can be written as follows In the above Equation indicates that(log L) is proportional to C. Therefore, Weber’s law can be expressed as Where k and b are constants, b being the background. In this case, an approximation to Weber’s law is considered by taking the luminance L as the grey level intensity of a function (image); in this way, above expression is written as follows 2.2 Background detection using morphological operators: On the other hand, given that, maximum and minimum values are analyzed for each block, an extension using morphological operators is presented as follows. Fig. 2.2 Block diagram of Background Detection by Erosion & Dilation 11
  • 12. Morphological operations: In a morphological operation, the value of each pixel in the output image is based on a comparison of the corresponding pixel in the input image with its neighbors. By choosing the size and shape of the neighborhood, you can construct a morphological operation that is sensitive to specific shapes in the input image. Dilation and erosion are two fundamental morphological operations. Dilation adds pixels to the boundaries of objects in an image, while erosion removes pixels on object boundaries. The number of pixels added or removed from the objects in an image depends on the size and shape of the structuring element used to process the image. In the morphological dilation and erosion operations, the state of any given pixel in the output image is determined by applying a rule to the corresponding pixel and its neighbors in the input image. The rule used to process the pixels defines the operation as a dilation or an erosion. Rules for Dilation and Erosion: Operation Rule Dilation The value of the output pixel is the maximum value of all the pixels in the input pixel's neighborhood. In a binary image, if any of the pixels is set to the value 1, the output pixel is set to 1. The value of the output pixel is the minimum value of all the pixels in the input Erosion pixel's neighborhood. In a binary image, if any of the pixels is set to 0, the output pixel is set to 0. 12
  • 13. Erosion: Erosion is one of the two basic operators in the area of mathematical morphology, the other being dilation. It is typically applied to binary images, but there are versions that work on gray scale images. The erosion operator takes two pieces of data as inputs. The first is the image which is to be eroded. The second is a (usually small) set of coordinate points known as a structuring element (also known as a kernel). It is this structuring element that determines the precise effect of the erosion on the input image. In erosion, every object pixel that is touching a background pixel is changed into a background pixel. Dilation: Dilation adds pixels to the boundaries of objects in an image. In dilation, every background pixel that is touching an object pixel is changed into an object pixel. Note how the function applies the rule to the input pixel's neighborhood and uses the highest value of all the pixels in the neighborhood as the value of the corresponding pixel in the output image. Let Imax(x) and Imin(x) be the maximum and minimum intensity values taken from one set of pixels contained in a window (B) of elemental size (3 X 3 elements), x belongs to D. Notice that the window corresponds to the structuring element .A new expression can be derived as shown: Where Imax(x) and Imin(x) values correspond to the morphological dilation and erosion defined by the order-statistical filters. Thus, the above expression is expressed as Finally the proposed transformation is expressed as 13
  • 14. 2.3 Structuring Elements: An essential part of the dilation and erosion operations is the structuring element used to probe the input image. A structuring element is a matrix consisting of only 0's and 1's that can have any arbitrary shape and size. The pixels with values of 1 define the neighborhood. Two-dimensional, or flat, structuring elements are typically much smaller than the image being processed. The center pixel of the structuring element, called the origin, identifies the pixel of interest -- the pixel being processed. The pixels in the structuring element containing 1's define the neighborhood of the structuring element. These pixels are also considered in dilation or erosion processing. Three-dimensional, or nonflat, structuring elements use 0's and 1's to define the extent of the structuring element in the x- and y-planes and add height values to define the third dimension. Origin of a Structuring Element: The morphological functions use this code to get the coordinates of the origin of structuring elements of any size and dimension Origin = floor ((size (nhood) +1)/2) (1) Here nhood is the neighborhood defining the structuring element. Because structuring elements are MATLAB objects, we cannot use the size of the STREL object itself in this 14
  • 15. calculation. We must use the STRELgetnhood method to retrieve the neighborhood of the structuring element from the STREL object. For example, the following illustrates a diamond-shaped structuring element Fig. 4.3 a diamond-shaped structuring elemen Creating a Structuring Element: The toolbox dilation and erosion functions accept structuring element objects, called STRELs. We use the strel function to create STRELs of any arbitrary size and shape. The strel function also includes built-in support for many common shapes, such as lines, diamonds, disks, periodic lines, and balls. For example, this code creates a flat, diamond-shaped structuring element. se = strel ('diamond', 3) . where 3 specifies the distance from the structuring element origin to the points of the diamond. 2.4 Histogram Equalization: Histogram equalization is a method in imageprocessing of contrast adjustment using the image'shistogram. This method usually increases the global contrast of many images, especially when the usable data of the image is represented by close contrast values. Through this adjustment, the intensities can be better distributed on the histogram. This allows for areas of lower local contrast to gain a higher contrast without affecting the global contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values. The method is useful in images with backgrounds and foregrounds that are both bright or both dark. In particular, the method can lead to better views of bone structure in x-ray images, and to better detail in photographs that are over or under-exposed. 15
  • 16. Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like thermal, satellite or x-ray images, often the same class of images that user would apply false-color to. Also histogram equalization can produce undesirable effects (like visible image gradient) when applied to images with low color depth. Figure shows that for any given mapping function y=f(x) between the input and output Images, the following holds p(y) dy=p(x) dxi.ie., the number of pixels mapped from x to y is unchanged. 16
  • 17. 3.CODING Main: clc clear all close all [file path]=uigetfile('*.jpg'); I=imread([path file]); eqn10(I); % IMAGE BACKGROUND APPROXIMATION BY BLOCKS eqn13(I); % histogram_eq(I); % HISTOGRAM EQUALIZATION Eqn10: function eqn10(I) figure,imshow(I);title('Original Image'); I=imresize(I,[256 256]); I=rgb2gray(I); I=double(I); xw=8; for i=1:size(I,1)/xw for j=1:size(I,2)/xw B=I(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw); m=min(min(B))/255; M=max(max(B))/255; t=(m+M)/2; BB=blockkk(m,M,t,B,xw); I1(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw)=BB; end end figure,subplot(1,2,1) 17
  • 18. imshow(I,[]);title('Original Image'); subplot(1,2,2) imshow(I1,[]);title('Enhanced Image: Eqn 10'); % Histogram figure, subplot(1,2,1),imhist(uint8(I)) title('INPUT IMAGE') axis([0 255 0 8000]) subplot(1,2,2),imhist(uint8(I1)) title('IMAGE EQN10') axis([0 255 0 8000]) % Disply Graph figure,plot(I(25,:),'r'),hold on plot(I1(size(I,1)/2,:),'g') % axis([0 255 0 260]) legend('Input Image','Out put Image') xlabel('Intensity level') ylabel('Image Values') title('IMAGE BACKGROUND APPROXIMATION BY BLOCKS EQN10') function BB=blockkk(m,M,t,B,xw) BB=zeros(xw); for i=1:xw for j=1:xw f=B(i,j); if f > t 18
  • 19. mm=m; else mm=M; end k=(255-mm)/log(256); if f<=t BB(i,j)=k*log(f+1)+M; else BB(i,j)=k*log(f+1)+m; end end end Eqn13: function eqn13(I) I=imresize(I,[256 256]); I=rgb2gray(I); I=double(I); u=1; radious=2*u+1; se=strel('square',radious); xw=8; for i=1:size(I,1)/xw for j=1:size(I,2)/xw B=I(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw); BB=formula(B,se); I1(((i-1)*xw)+1:i*xw,(((j-1)*xw))+1:j*xw)=BB; end end figure,subplot(1,2,1) imshow(I,[]),title('Original Image') 19
  • 20. subplot(1,2,2) imshow(I1,[]);title('eqn13 Image') % Histogram figure, subplot(1,2,1),imhist(uint8(I)) title('INPUT IMAGE') axis([0 255 0 8000]) subplot(1,2,2),imhist(uint8(I1)) title('IMAGE EQN13') axis([0 255 0 8000]) % Disply Graph figure,plot(I(size(I,1)/2,:),'r'),hold on plot(I1(size(I,1)/2,:),'g'),axis([0 255 0 260]) legend('Input Image','Out put Image') xlabel('Intensity level') ylabel('Image Values') title('IMAGE BACKGROUND APPROXIMATION BY BLOCKS EQN13') function I1=formula(I,se) I1=zeros(size(I,1)); E=imerode(I,se); D=imdilate(I,se); for i=1:size(I,1) for j=1:size(I,2) e=E(i,j); d=D(i,j); f=I(i,j); t=(e+d)/2; k=(255-t)/log(256); 20
  • 21. if f<=t I1(i,j)=k*log2(f+1)+d; else I1(i,j)=k*log2(f+1)+e; end end end Histogram eqn: function histogram_eq(I) I=imresize(I,[256 256]); I=rgb2gray(I); I1=histeq(I); figure,subplot(1,2,1) imshow(I,[]),title('Original Image') subplot(1,2,2) imshow(I1,[]),title('Histogram Equalization') % Histogram figure, subplot(1,2,1),imhist(uint8(I)) title('INPUT IMAGE') axis([0 255 0 8000]) subplot(1,2,2),imhist(uint8(I1)) title('HIST EQUAIZATION') axis([0 255 0 8000]) % Disply Graph figure,plot(I(size(I,1)/2,:),'r'),hold on plot(I1(size(I,1)/2,:),'g'),axis([0 255 0 260]) legend('Input Image','Out put Image') xlabel('Intensity level') ylabel('Image Values') title('HISTOGRAM EQUALIZATION') 21
  • 22. 4. RESULT & CONCLUSION This project presents a study to detect the image background and to enhance the contrast in binary images with poor lighting. First, a methodology was introduced to compute an approximation to the background using blocks analysis. This proposal was subsequently extended using mathematical morphology operators. Let us consider the input image as shown in fig (a) and the obtained enhanced image which is shown in the fig (b) Fig (a) Original image Fig (b) Enhanced image 22
  • 23. 23