image segmentation by histogram thresholding venugopal rajagopal cis 581 instructor: longin jan...

33
Image Segmentation by Image Segmentation by Histogram Thresholding Histogram Thresholding Venugopal Rajagopal Venugopal Rajagopal CIS 581 CIS 581 Instructor: Longin Jan Instructor: Longin Jan Latecki Latecki

Upload: norman-murphy

Post on 18-Jan-2016

258 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Image Segmentation by Image Segmentation by Histogram ThresholdingHistogram Thresholding

Venugopal RajagopalVenugopal Rajagopal

CIS 581CIS 581

Instructor: Longin Jan LateckiInstructor: Longin Jan Latecki

Page 2: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Image SegmentationImage Segmentation

Segmentation divides an image into its constituent Segmentation divides an image into its constituent regions or objects.regions or objects.Segmentation of non trivial images is one of the Segmentation of non trivial images is one of the difficult task in image processing. Still under difficult task in image processing. Still under research.research.Segmentation accuracy determines the eventual Segmentation accuracy determines the eventual success or failure of computerized analysis success or failure of computerized analysis procedure.procedure.Example Application: Automated inspection of Example Application: Automated inspection of electronic assemblies. (mother boards)electronic assemblies. (mother boards)

Page 3: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmentation AlgorithmsSegmentation Algorithms

Segmentation algorithms are based on one of Segmentation algorithms are based on one of two basic properties of intensity values two basic properties of intensity values discontinuity and similarity.discontinuity and similarity.

First category is to partition an image based on First category is to partition an image based on abrupt changes in intensity, such as edges in an abrupt changes in intensity, such as edges in an image.image.

Second category are based on partitioning an Second category are based on partitioning an image into regions that are similar according to a image into regions that are similar according to a predefined criteria. Histogram Thresholding predefined criteria. Histogram Thresholding approach falls under this category.approach falls under this category.

Page 4: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

HistogramsHistograms

Histogram are constructed by splitting the range Histogram are constructed by splitting the range of the data into equal-sized bins (called classes). of the data into equal-sized bins (called classes). Then for each bin, the number of points from the Then for each bin, the number of points from the data set that fall into each bin are counted. data set that fall into each bin are counted. Vertical axis: Frequency (i.e., counts for each Vertical axis: Frequency (i.e., counts for each bin) bin) Horizontal axis: Response variableHorizontal axis: Response variableIn image histograms the pixels form the In image histograms the pixels form the horizontal axis horizontal axis In Matlab histograms for images can be In Matlab histograms for images can be constructed using the imhist command.constructed using the imhist command.

Page 5: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Thresholding - FoundationThresholding - Foundation

Suppose that the gray-level histogram Suppose that the gray-level histogram corresponds to an image, f(x,y), composed of corresponds to an image, f(x,y), composed of dark objects in a light background, in such a way dark objects in a light background, in such a way that object and background pixels have gray that object and background pixels have gray levels grouped into two dominant modes. One levels grouped into two dominant modes. One obvious way to extract the objects from the obvious way to extract the objects from the background is to select a threshold ‘T’ that background is to select a threshold ‘T’ that separates these modes. Then any point (x,y) for separates these modes. Then any point (x,y) for which f(x,y) > T is called an object point, which f(x,y) > T is called an object point, otherwise, the point is called a background point.otherwise, the point is called a background point.

Page 6: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Example Example

Page 7: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Foundation (contd.)Foundation (contd.)

If two dominant modes characterize the If two dominant modes characterize the image histogram, it is called a bimodal image histogram, it is called a bimodal histogram. Only one threshold is enough histogram. Only one threshold is enough for partitioning the image.for partitioning the image.

If for example an image is composed of If for example an image is composed of two types of light objects on a dark two types of light objects on a dark background, three or more dominant background, three or more dominant modes characterize the image histogram.modes characterize the image histogram.

Page 8: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Foundation (contd.)Foundation (contd.)

In such a case the histogram has to be In such a case the histogram has to be partitioned by multiple thresholds.partitioned by multiple thresholds.

Multilevel thresholding classifies a point (x,y) as Multilevel thresholding classifies a point (x,y) as belonging to one object class belonging to one object class

if T1 < (x,y) <= T2, if T1 < (x,y) <= T2,

to the other object class to the other object class

if f(x,y) > T2 if f(x,y) > T2

and to the background and to the background

if f(x,y) <= T1.if f(x,y) <= T1.

Page 9: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

ThresholdingThresholding

Basic Global Thresholding: Basic Global Thresholding: 1)Select an initial estimate for T1)Select an initial estimate for T 2)Segment the image using T. This will produce two groups of pixels. 2)Segment the image using T. This will produce two groups of pixels.

G1 consisting of all pixels with gray level values >T and G2 G1 consisting of all pixels with gray level values >T and G2 consisting of pixels with values <=T.consisting of pixels with values <=T.

3)Compute the average gray level values mean1 and mean2 for the 3)Compute the average gray level values mean1 and mean2 for the pixels in regions G1 and G2.pixels in regions G1 and G2.

4)Compute a new threshold value 4)Compute a new threshold value T=(1/2)(mean1 +mean2)T=(1/2)(mean1 +mean2) 5)Repeat steps 2 through 4 until difference in T in successive 5)Repeat steps 2 through 4 until difference in T in successive

iterations is smaller than a predefined parameter T0.iterations is smaller than a predefined parameter T0.

Basic Adaptive Thresholding: Images having uneven illumination Basic Adaptive Thresholding: Images having uneven illumination makes it difficult to segment using histogram, this approach is to makes it difficult to segment using histogram, this approach is to divide the original image into sub images and use the above said divide the original image into sub images and use the above said thresholding process to each of the sub images. thresholding process to each of the sub images.

Page 10: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Thresholding (contd.)Thresholding (contd.)

In this project we have used a different In this project we have used a different method based on “method based on “Discrete Curve EvolutionDiscrete Curve Evolution” ” to find thresholds in the histogram.to find thresholds in the histogram.

Page 11: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Thresholding – Colour ImagesThresholding – Colour Images

In colour images each pixel is In colour images each pixel is characterized by three RGB values.characterized by three RGB values.

Here we construct a 3D histogram, and Here we construct a 3D histogram, and the basic procedure is analogous to the the basic procedure is analogous to the method used for one variable.method used for one variable.

Histograms plotted for each of the colour Histograms plotted for each of the colour values and threshold points are found.values and threshold points are found.

Page 12: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Displaying objects in the Displaying objects in the Segmented ImageSegmented Image

The objects can be distinguished by The objects can be distinguished by assigning a arbitrary pixel value or assigning a arbitrary pixel value or average pixel value to the regions average pixel value to the regions separated by thresholds.separated by thresholds.

Page 13: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

ExperimentsExperiments

Type of images used:Type of images used: 1) Two Gray scale image having bimodal 1) Two Gray scale image having bimodal

histogram structure.histogram structure. 2) Gray scale image having multi-modal 2) Gray scale image having multi-modal

histogram structure.histogram structure. 3) Colour image having bimodal histogram 3) Colour image having bimodal histogram

structure.structure. 4) Colour image having multi-modal 4) Colour image having multi-modal

histogram structure.histogram structure.

Page 14: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Gray Scale Image - bimodalGray Scale Image - bimodal

Image of a Finger Print with light background

Page 15: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Bimodal - HistogramBimodal - Histogram

Image Histogram of finger print

Page 16: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented ImageSegmented Image

Image after Segmentation

Page 17: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Gray Scale Image (2) - bimodalGray Scale Image (2) - bimodal

Image of rice with black background

Page 18: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

HistogramHistogram

Image histogram of rice

Page 19: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented ImageSegmented Image

Image after segmentation

Page 20: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Gray Scale Image - MultimodalGray Scale Image - Multimodal

Original Image of lena

Page 21: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Multimodal HistogramMultimodal Histogram

Histogram of lena

Page 22: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented ImageSegmented Image

Image after segmentation – we get a outline of her face, hat, shadow etc

Page 23: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Colour Image - bimodalColour Image - bimodal

Colour Image having a bimodal histogram

Page 24: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

HistogramHistogram

Histograms for the three colour spaces

Page 25: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented ImageSegmented Image

Segmented image – giving us the outline of her face, hand etc

Page 26: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Colour Image - MultimodalColour Image - Multimodal

Colour Image having multi-modal histogram

Page 27: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

HistogramHistogram

Image Histogram for the three colour spaces

Page 28: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented ImageSegmented Image

Page 29: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Experiments (contd.)Experiments (contd.)

Original Image, objective is to extract a line

Page 30: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

HistogramHistogram

Histogram giving us the six thresholds points, by plotting rows

Page 31: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented ImageSegmented Image

Page 32: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

Segmented Image (contd.)Segmented Image (contd.)

Page 33: Image Segmentation by Histogram Thresholding Venugopal Rajagopal CIS 581 Instructor: Longin Jan Latecki

ConclusionConclusion

After segmenting the image, the objects After segmenting the image, the objects can be extracted using edge detection can be extracted using edge detection techniques. techniques.

Image segmentation techniques are Image segmentation techniques are extensively used in Similarity Searches. extensively used in Similarity Searches. (IDB)(IDB)

Thank YouThank You