Image Analysis Image Segmentation (Basic Methods)

Similar documents
EECS490: Digital Image Processing. Lecture #22

Image segmentation. Stefano Ferrari. Università degli Studi di Milano Methods for Image Processing. academic year

Digital Image Analysis and Processing

Region & edge based Segmentation

Digital Image Processing Lecture 7. Segmentation and labeling of objects. Methods for segmentation. Labeling, 2 different algorithms

C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S. Image Operations II

REGION & EDGE BASED SEGMENTATION

Image Segmentation. Selim Aksoy. Bilkent University

Image Segmentation. Selim Aksoy. Bilkent University

Image Analysis. Edge Detection

Today INF How did Andy Warhol get his inspiration? Edge linking (very briefly) Segmentation approaches

Lecture: Segmentation I FMAN30: Medical Image Analysis. Anders Heyden

Image Analysis. Edge Detection

Segmentation

Topic 4 Image Segmentation

ECEN 447 Digital Image Processing

Segmentation

CS 490: Computer Vision Image Segmentation: Thresholding. Fall 2015 Dr. Michael J. Reale

Image Segmentation Based on Watershed and Edge Detection Techniques

EE795: Computer Vision and Intelligent Systems

Image Segmentation! Thresholding Watershed. Hodzic Ernad Seminar Computa9onal Intelligence

Final Review. Image Processing CSE 166 Lecture 18

ECG782: Multidimensional Digital Signal Processing

Chapter 10 Image Segmentation. Yinghua He

Segmentation algorithm for monochrome images generally are based on one of two basic properties of gray level values: discontinuity and similarity.

REGION BASED SEGEMENTATION

Image Analysis. Morphological Image Analysis

Chapter 10: Image Segmentation. Office room : 841

Ψηφιακή Επεξεργασία Εικόνας

Histograms. h(r k ) = n k. p(r k )= n k /NM. Histogram: number of times intensity level rk appears in the image

Image Processing and Image Analysis VU

Ulrik Söderström 16 Feb Image Processing. Segmentation

Processing of binary images

Image Processing. BITS Pilani. Dr Jagadish Nayak. Dubai Campus

Bioimage Informatics

Basic Algorithms for Digital Image Analysis: a course

EECS490: Digital Image Processing. Lecture #19

Biomedical Image Analysis. Mathematical Morphology

CITS 4402 Computer Vision

Binary Image Processing. Introduction to Computer Vision CSE 152 Lecture 5

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

Idea. Found boundaries between regions (edges) Didn t return the actual region

1. What are the derivative operators useful in image segmentation? Explain their role in segmentation.

Content-based Image and Video Retrieval. Image Segmentation

Computer Vision & Digital Image Processing. Image segmentation: thresholding

Image Processing. Bilkent University. CS554 Computer Vision Pinar Duygulu

Chapter 3: Intensity Transformations and Spatial Filtering

Edge detection. Stefano Ferrari. Università degli Studi di Milano Elaborazione delle immagini (Image processing I)

Digital Image Processing. Prof. P.K. Biswas. Department of Electronics & Electrical Communication Engineering

09/11/2017. Morphological image processing. Morphological image processing. Morphological image processing. Morphological image processing (binary)

(10) Image Segmentation

Image Enhancement: To improve the quality of images

Problem definition Image acquisition Image segmentation Connected component analysis. Machine vision systems - 1

REGARDING THE WATERSHED...

Morphological Image Processing

DIGITAL IMAGE ANALYSIS. Image Classification: Object-based Classification

A Proposal for the Implementation of a Parallel Watershed Algorithm

EE 701 ROBOT VISION. Segmentation

Region-based Segmentation

Digital Image Processing

PPKE-ITK. Lecture

Classifying image analysis techniques from their output

Digital Image Processing

Image Segmentation. Schedule. Jesus J Caban 11/2/10. Monday: Today: Image Segmentation Topic : Matting ( P. Bindu ) Assignment #3 distributed

Morphological Image Processing

Image Segmentation Techniques: An Overview

Operators-Based on Second Derivative double derivative Laplacian operator Laplacian Operator Laplacian Of Gaussian (LOG) Operator LOG

EE 584 MACHINE VISION

Part 3: Image Processing

Introduction to Medical Imaging (5XSA0) Module 5

EDGE BASED REGION GROWING

Perception. Autonomous Mobile Robots. Sensors Vision Uncertainties, Line extraction from laser scans. Autonomous Systems Lab. Zürich.

Lecture 6: Edge Detection

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

Object Segmentation. Jacob D. Furst DePaul CTI

IMAGE SEGMENTATION BY REGION BASED AND WATERSHED ALGORITHMS

Image Enhancement in Spatial Domain (Chapter 3)

CHAPTER 3 IMAGE ENHANCEMENT IN THE SPATIAL DOMAIN

Review on Different Segmentation Techniques For Lung Cancer CT Images

Mathematical Morphology and Distance Transforms. Robin Strand

Dr. Ulas Bagci

Contents.

Integrating Intensity and Texture in Markov Random Fields Segmentation. Amer Dawoud and Anton Netchaev. {amer.dawoud*,

ECG782: Multidimensional Digital Signal Processing

Processing and Others. Xiaojun Qi -- REU Site Program in CVMA

EECS490: Digital Image Processing. Lecture #21

MR IMAGE SEGMENTATION

Histogram and watershed based segmentation of color images

Lecture 4 Image Enhancement in Spatial Domain

ECG782: Multidimensional Digital Signal Processing

[ ] Review. Edges and Binary Images. Edge detection. Derivative of Gaussian filter. Image gradient. Tuesday, Sept 16

Image Analysis Lecture Segmentation. Idar Dyrdal

Segmentation. (template) matching

Coarse-to-fine image registration

Schedule for Rest of Semester

Structural Analysis of Aerial Photographs (HB47 Computer Vision: Assignment)

Color Image Segmentation

CS534 Introduction to Computer Vision Binary Image Analysis. Ahmed Elgammal Dept. of Computer Science Rutgers University

Outlines. Medical Image Processing Using Transforms. 4. Transform in image space

Digital Image Processing

Transcription:

Image Analysis Image Segmentation (Basic Methods) Christophoros Nikou cnikou@cs.uoi.gr Images taken from: R. Gonzalez and R. Woods. Digital Image Processing, Prentice Hall, 2008. Computer Vision course by Svetlana Lazebnik, University of North Carolina at Chapel Hill (http://www.cs.unc.edu/~lazebnik/spring0/). University of Ioannina - Department of Computer Science 2 Image Segmentation Obtain a compact representation of the image to be used for further processing. Group together similar pixels Image intensity is not sufficient to perform semantic segmentation Object recognition Decompose objects to simple tokens (line segments, spots, corners) Finding buildings in images Fit polygons and determine surface orientations. Video summarization Shot detection 3 Image Segmentation (cont.) Bottom-up or top-down process? Supervised or unsupervised? image Berkeley segmentation database: human segmentation http://www.eecs.berkeley.edu/research/projects/cs/vision/grouping/segbench/ 4 Image Segmentation (cont.) Goal: separate an image into coherent regions. Major approaches Basic techniques (thresholding, region growing, morphological watersheds). Clustering. Model fitting. Probabilistic methods. Basic techniques also follow a clustering principle. We will examine more advanced clustering methods later. 5 Thresholding Image partitioning into regions directly from their intensity values. 6 Noise in Thresholding Difficulty in determining the threshold due to noise if f ( xy, ) > T g ( x, y ) = 0 if f ( xy, ) T 0 if f( x, y) T g ( x, y ) = if T < f( x, y) T 2 if f( x, y) > T2 2 Noiseless Gaussian (μ=0, σ=0) Gaussian (μ=0, σ=0)

7 Illumination in Thresholding 8 Basic Global Thresholding Difficulty in determining the threshold due to non-uniform illumination Algorithm Select initial threshold estimate T. Segment the image using T Region G (values > T) and region G 2 (values < T). Compute the average intensities m and m 2 of regions G and G 2 respectively. Set T=(m +m 2 )/2 Repeat until the change of T in successive iterations is less than ΔΤ. (a) Noisy image (b) Intensity ramp image Multiplication 9 Basic Global Thresholding (cont.) T=25 0 Optimum Global Thresholding using Otsu s Method The method is based on statistical decision theory. Minimization of the average error of assignment of pixels to two (or more) classes. Bayes decision rule may have a nice closed form solution to this problem provided The pdf of each class. The probability of class occurence. Pdf estimation is not trivial and assumptions are made (Gaussian pdfs). Otsu (979) proposed an attractive alternative maximizing the between-class variance. Only the histogram of the imageis used. Otsu s Method (cont.) Let {0,, 2,, L-} denote the intensities of a MxN image and n i the number of pixels with intensity i. The normalized histogram has components: L ni pi =, pi =, pi 0 MN = 0 i Suppose we choose a threshold k to segment the image into two classes: C with intensities in the range [0, k], C 2 with intensities in the range [k+, L-]. 2 Otsu s Method (cont.) The probabilities of classes C and C 2 : k L = i 2 = i = i= 0 i= k+ Pk ( ) p, Pk ( ) p Pk ( ) The mean intensity of class C : k k k PC ( ipi ) ( ) m( k) = ip( i C) = i = ipi PC ( ) P( k) i= 0 i= 0 i= 0 Intensity i belongs to class C and PC ( i ) = 2

3 Otsu s Method (cont.) Similarly, the mean intensity of class C 2 : PC ( ipi ) ( ) m k ip i C i ip L L L 2 2( ) = ( 2) = = i= k+ i= k+ PC ( 2) P2( k) i= k+ Mean image intensity: i L m = ip= Pkm ( ) ( k) + P( km ) ( k) G i= 0 i 2 2 Cumulative mean image intensity (up to k): k mk ( ) = ip i i= 0 i 4 Otsu s Method (cont.) Between class variance: σ ( k) = P( k)[ m ( k) m ] + P( k)[ m ( k) m ] 2 2 2 B G 2 2 G With some manipulation we get: 2 2 [ mpk G ( ) mk ( )] σ B ( k) = Pk ( )[ Pk ( )] The value of k is selected by sequential search as the one maximazing: * 2 k = max { σ ( k)} 0 k L B 5 Otsu s Method (cont.) 6 Otsu s Method (cont.) Example (no obvious valley in the histogram) Smoothing helps thresholding (may create histogram valley) Image Noisy image Otsu no smoothing Basic method Otsu s method Noisy image smoothed Otsu with smoothing 7 Otsu s Method (cont.) Otsu s method, even with smoothing cannot extract small structures Noisy image, σ=0 Otsu no smoothing Noisy image smoothed Otsu with smoothing 8 Otsu s Method (cont.) Dealing with small structures The histogram is unbalanced The background dominates No valleys indicating the small structure. Idea: consider only the pixels around edges Both structure of interest and background are present equally. More balanced histograms Use gradient magnitude or zero crossings of the Laplacian. Threshold it at a percentage of the maximum value. Use it as a mask on the original image. Only pixels around edges will be employed. 3

9 Otsu s Method (cont.) 20 Otsu s Method (cont.) Noisy image, σ=0 Gradient magnitude mask (at 99.7% of max) Image Otsu on original histogram We wish to extract the bright spots (nuclei) of the cells Multiplication (Mask x Image) Otsu Thresholded absolute Laplacian Otsu 2 Otsu s Method (cont.) The method may be extended to multiple thresholds In practice for more than 2 thresholds (3 segments) more advanced methods are employed. For three classes, the between-class variance is: 2 σ ( k, k ) = P ( k )[ m ( k ) m ] + P ( k, k )[ m ( k, k ) m ] + P( k )[ m ( k ) m ] B 2 G 2 2 2 2 G 3 2 3 2 G The thresholds are computed by searching all pairs for values: ( k, k ) = max { σ ( k, k )} * * 2 2 B 0 k< k2 L 2 22 Otsu s Method (cont.) Image of iceberg segmented into three regions. k =80, k 2 =77 23 Otsu s Method (cont.) 24 Otsu s Method (cont.) Variable thresholding: image partitioning. The image is sub-divided and the method is applied to every sub-image. Useful for illumination non-uniformity correction. Shaded image Simple thresholding Variable thresholding: use of local image properties. Compute a threshold for every single pixel in the image based on its neighborhood (m xy, σ xy, ). Q(local properties) is true gxy (, ) = 0 Q(local properties)isfalse true f ( xy, ) > aσ xy ANDf( xy, ) > bm Q( σ xy, mxy ) = false otherwise xy Otsu Subdivision Otsu at each sub-image 4

25 Otsu s Method (cont.) 26 Otsu s Method (cont.) Image Otsu with 2 thresholds Variable thresholding: moving averages. Generally used along lines, columns or in zigzag. Useful in document image processing. Image of local standard deviations Local Thresholding Let z k+ be the intensity of a pixel in the scanning sequence at step k+. The moving average (mean intensity) at this point is: k + mk ( + ) = z i = mk ( ) + ( z z k+ k n) n i= k+ 2 n n n is the number of points used in the average Subdivision More accurate nuclei extraction than above. Segmentation is then performed at each point comparing the pixel value to a fraction of the moving average. 27 Otsu s Method (cont.) 28 Otsu s Method (cont.) Shaded text images occur typically from photographic flashes Otsu Moving averages Sinusoidal variations (the power supply of the scanner not grounded properly) Otsu Moving averages The moving average works well when the structure of interest is small with respect to image size (handwritten text). 29 Region Growing Start with seed points S(x,y) and grow to larger regions satisfying a predicate. Needs a stopping rule. Algorithm Find all connected components in S(x,y) ) and erode them to pixel. Form image f q (x,y)= if f (x,y) satisfies the predicate. Form image g(x,y)= for all pixels in f q (x,y) that are 8- connected with to any seed point in S(x,y). Label each connected component in g(x,y) with a different label. 30 Region Growing (cont.) X-Ray image of weld with a crack we want to segment. Seed image (99.9% of max value in the initial image). Crack pixels are missing. The weld is very bright. The predicate used for region growing is to compare the absolute difference between a seed point and a pixel to a threshold. If the difference is below it we accept the pixel as crack. 5

3 Region Growing (cont.) 32 Region Growing (cont.) Seed image eroded to pixel regions. Difference between the original image and the initial seed image. The pixels are ready to be compared to the threshold. of the difference image. Two valleys at 68 and 26 provided by Otsu. Otsu thresholding of the difference image to 3 regions (2 thresholds). Thresholding of the difference image with the lowest of the dual thresholds. Notice that the background is also considered as crack. Segmentation result by region growing. The background is not considered as crack. It is removed as it is not 8-connected to the seed pixels. 33 Region Splitting and Merging Based on quadtrees (quadimages). The root of the tree corresponds to the image. Split the image to sub-images that do not satisfy a predicate Q. If only splitting was used, the final partition would contain adjacent regions with identical properties. A merging step follows merging regions satisfying the predicate Q. 34 Region Splitting and Merging (cont.) Algorithm Split into four disjoint quadrants any region R i for which Q(R i )=FALSE. When no further splitting is possible, merge any adjacent regions Ri and Rk for which Q(R i R k )=TRUE. Stop when no further merging is possible. A maximum quadregion size is specified beyond which no further splitting is carried out. Many variations heve been proposed. Merge any adjacent regions if each one satisfies the predicate individually (even if their union does not satisfy it). 35 Region Splitting and Merging (cont.) Quadregions resulted from splitting. Merging examples: R 2 may be merged with R 4. R 4 may be merged with R 42. 36 Region Splitting and Merging (cont.) Image of the Cygnus Loop. We want to segment the outer ring of less dense matter. Characteristics of the region of interest: Standard deviation grater than the background (which h is near zero) and the central region (which is smoother). Mean value greater than the mean of background and less than the mean of the central region. true σ > α AND 0 < m < b Predicate: Q = false otherwise 6

37 Region Splitting and Merging (cont.) 38 Morphological Watersheds Larger quadregions lead to block-like segmentation. Smaller quadregions lead to small black regions. 6x6 seems to be the best result. Varying the size of the smallest allowed quadregion. 6x6 32x32 8x8 Visualize an image topographically in 3D The two spatial coordinates and the intensity (relief representation). Three types of points Points belonging to a regional minimum. Points ta which a drop of water would fall certainly to a regional minimum (catchment basin). Points at which the water would be equally likely to fall to more than one regional minimum (crest lines or watershed lines). Objective: find the watershed lines. 39 Morphological Watersheds (cont.) 40 Morphological Watersheds (cont.) Image Topographic representation. The height is proportional to the image intensity. Backsides of structures are shaded for better visualization. A hole is punched in each regional minimum and the topography is flooded by water from below through the holes. When the rising water is about to merge in catchment basins, a dam is built to prevent merging. There will be a stage where only the tops of the dams will be visible. These continuous and connected boundaries are the result of the segmentation. 4 Morphological Watersheds (cont.) 42 Morphological Watersheds (cont.) Regional minima Topographic representation of the image. A hole is punched in each regional minimum (dark areas) and the topography is flooded by water (at equal rate) from below through the holes. Before flooding. To prevent water from spilling through the image borders, we consider that the image is surrounded by dams of height greater than the maximum image intensity. 7

43 Morphological Watersheds (cont.) 44 Morphological Watersheds (cont.) First stage of flooding. The water covered areas corresponding to the dark background. Next stages of flooding. The water has risen into the other catchment basin. 45 Morphological Watersheds (cont.) 46 Morphological Watersheds (cont.) Short dam Further flooding. The water has risen into the third catchment basin. Further flooding. The water from the left basin overflowed into the right basin. A short dam is constructed to prevent water from merging. 47 Morphological Watersheds (cont.) 48 Morphological Watersheds (cont.) Longer dam New dams Final watershed lines superimposed on the image. Further flooding. The effect is more pronounced. The first dam is now longer. New dams are created. The process continues until the maximum level of flooding is reached. The final dams correspond to the watershed lines which is the result of the segmentation. Important: continuous segment boundaries. 8

49 Morphological Watersheds (cont.) 50 Morphological Watersheds (cont.) Dams are constructed by morphological dilation. C n- (M ) C n- (M 2 ) C n- (M ) C n- (M 2 ) q Flooding step n-. Flooding step n-. Flooding step n. Regional minima: M and M 2. Catchment basins associated: C n- (M ) and C n- (M 2 ). Cn [ ] = C ( M) C ( M ) n n 2 C[n-] has two connected components. If we continue flooding, then we will have one connected component. This indicates that a dam must be constructed. Let q be the merged connected component if we perform flooding a step n. 5 Morphological Watersheds (cont.) 52 Morphological Watersheds (cont.) q Conditions. Center of SE in q. 2. No dilation if merging. Each of the connected components is dilated by the SE shown, subject to:. The center of the SE has to be contained in q. 2. The dilation cannot be performed on points that would cause the sets being dilated to merge. In the first dilation, condition was satisfied by every point and condition 2 did not apply to any point. In the second dilation, several points failed condition while meeting condition 2 (the points in the perimeter which is broken). 53 Morphological Watersheds (cont.) 54 Morphological Watersheds (cont.) Conditions. Center of SE in q. 2. No dilation if merging. The only points in q that satisfied both conditions form the -pixel thick path. This is the dam at step n of the flooding process. The points should satisfy both conditions. A common application is the extraction of nearly uniform, bloblike objects from their background. For this reason it is generally applied to the gradient of the image and the catchment basins correspond to the blob like objects. Image Watersheds Gradient magnitude Watersheds on the image 9

55 Morphological Watersheds (cont.) 56 Morphological Watersheds (cont.) Noise and local minima lead generally to oversegmentation. The result is not useful. Solution: limit the number of allowable regions by additional knowledge. Markers (connected components): internal, associated with the objects external, associated with the background. Here the problem is the large number of local minima. Smoothing may eliminate them. Define an internal marker (after smoothing): Region surrounded by points of higher altitude. They form connected components. All points in the connected component have the same intensity. 57 Morphological Watersheds (cont.) 58 Morphological Watersheds (cont.) After smoothing, the internal markers are shown in light gray. The watershed algorithm is applied and the internal markers are the only allowable regional minima. The resulting watersheds are the external markers (shown in white). Each region defined by the external marker has a single internal marker and part of the background. The problem is to segment each of these regions into two segments: a single object and background. The algorithms we saw in this lecture may be used (including watersheds applied to each individual region). 59 Morphological Watersheds (cont.) 60 Morphological Watersheds (cont.) Image Watersheds Watersheds with markers Final segmentation. 0