digital image processing lecture segmentation

40
  Digital Image Processing Segmentation

Upload: parth-chona

Post on 01-Nov-2015

228 views

Category:

Documents


0 download

DESCRIPTION

DIP

TRANSCRIPT

  • Digital Image Processing

    Segmentation

  • Digital Image Processing

    Segmentation Statistical methods Edge-based methods Region based methods

    Tresholding Growing regions Clustering Split/Merge

    Morphological methods watershed Knowledge-based Template matching....

  • Digital Image Processing

    Segmentation is a complex task... Different tasks specifics methods No universal method for all tasks ! Example features which make it difficult:

    Important factor quality of the image Complex shapes of the objects Overlapping objects Shadows Pre-processing could be necessary

  • Digital Image Processing

    Thresholding

    ? Threshold value?

    Bimodal histogram

  • Digital Image Processing

    Thresholding

    Multimodal Histogram

  • Digital Image Processing

    Otsu's method

    Otsus thresholding chooses the threshold to minimize the intraclass variance and maximize the interclass variance between a segmented-foreground object and background

    All possible thresholds (0-255..) are evaluated in this way, and that one that maximises the criterion is chosen as the optimal threshold

    Recurcive method

  • Digital Image Processing

    Global / local / adaptive thresholding In global thresholding, the threshold value is

    held constant throughout the image Global thresholding is of the form:

    Local threshold > eliminate changes in illumination

    Adaptive thresholding - technique in which the threshold level is variable.

    g(x,y) = 0 f(x,y) < Threshold

    1 f(x,y) >= Threshold

  • Digital Image Processing

    Global binary threshold versus adaptive binary threshold

  • Digital Image Processing 9

    Segmentation based on edge detection

    Segmentation based on edge detection Determination of object boundaries from a edge

    image (Sobel, Laplace, Canny detector...) Problems:

    Edges are overlapped, not continuous... Non relevant edges have to be avoid

    Pre-processing and post-processing could be necessary...

  • Digital Image Processing 10

    Gray level profile

    The 1st derivative

    -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-0.20

    0.20.40.60.8

    11.2

    -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-0.06-0.04-0.02

    00.020.040.06

    -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-5-4-3-2-1012345 x 10

    -3

    Edge Edge

    Minimum point

    Maximumpoint

    + +- -

    Zero crossing

    Inte

    nsity

    The 2nd derivative

    Edge detection

  • Digital Image Processing 11

    An Example - Results of Canny edge detection

  • Digital Image Processing 12

    Active contour model- snake

    The active contour model, or snake, is defined as an energy minimizing spline - the snake's energy depends on its shape and location within the image.

    Local minima of this energy then correspond to desired image properties.

    a) initial snake position

    b-c) iteration steps of snake energy minimization

  • Digital Image Processing 13

    Growing regions Select a start (seed) point Grow the point based on a certain property of

    homogeneity (Connectivity should be considered) Seed point selection:

    ..for example - highlighted point (Due to specific property) ...

    . (cvFloodFill)

  • Digital Image Processing 14

    An example of growing regions

  • Digital Image Processing 15

    Clustering

    Consider segmentation as a classification problem : An image consists of K regions. Each pixel have to be classified into the one of

    this regions. K-Means algorithms Mean Shift algorithms Fuzzy C-Means Gaussian Mixture Models and much more...

  • Digital Image Processing 16

    K-Means Algorithm

    Each region is represented by a mean value j. Minimum distance classification

    1D

    2D

  • Digital Image Processing 17

    K-Means Algorithm

    Assume a fixed number k of segments/clusters. Represent each pixel in a 1D [luminance] or 3D

    [luminance, x, y] vector space. Step 1. random initialisation of k mean values j. Step 2. Classify pixels into the regions using the

    minimum distance criterion Step 3. Calculate new mean values of the

    regions Repeat 2 and 3 until the mean values are stable

  • Digital Image Processing 18

    Example of K-Means Algorithm

    2 regions2 regions

    3 regions

  • Digital Image Processing 19

    K-Means Algorithm

    If the K-means algorithm use only 1 feature (lightness), than is this operation only a modification of the thresholding method

    Modifikation -> extended feature vector: Colour information Position of the pixel Texture description etc.

  • Digital Image Processing 20

    Mean Shift Algorithm

    Choose a search window size. Choose the initial location of

    the search window. Compute the mean location

    (centroid of the data) in the search window.

    Center the search window at the mean location computed in Step 3.

    Repeat Steps 3 and 4 until convergence.

  • Digital Image Processing 21

    Mean Shift Algorithm

  • Digital Image Processing 22

    Mean Shift Segmentation Algorithm 1. Convert the image into the features ( color,

    gradients, texture measures etc). 2. Choose initial search window locations

    uniformly in the data. 3.Compute the mean shift window location for

    each initial position. 4.Merge windows that end up on the same peak

    or mode. 5.The data these merged windows traversed are

    clustered together.

  • Digital Image Processing 23

    Mean Shift Algorithm(Features: L*u*)

  • Digital Image Processing 24

    Mean shift segmentation example

  • Digital Image Processing 25

    Split & Merge AlgorithmStep 1 SPLIT Recursively splits an image region (which starts

    out as the entire image) by dividing it into quarters. Feature vectors are computed for each block.

    If the four blocks are judged to be similar, they are grouped back together and the process ends.

    If not, each of the blocks are recursively divided and analyzed using the same procedure.

  • Digital Image Processing 26

    Split & Merge Algorithm

    When we are finished, there will be many different sized blocks, each of which has a homogeneous texture according to our model.

    However, the arbitrary division of the image into rectangles (called a quad-tree'' decomposition) might have accidentally split up regions of homogeneous texture.

    The merge step, then, tries to fix this by looking at adjacent regions that were not compared to each other during the split phase, and merging recursively splits an image region (which starts out as the entire image) by dividing it into quarters.

  • Digital Image Processing 27

    Split & Merge AlgorithmStep 2 - MERGE Feature vectors are computed for each block. If the four blocks are judged to be similar, they are

    grouped back together and the process ends. If not, each of the blocks are recursively divided

    and analyzed using the same procedure.

  • Digital Image Processing

    Split & Merge -Example

  • Digital Image Processing 29

    Synthetically generated image of two dark blobs

    Watershed Segmentation The watershed transform treats the intensity as a

    function defining 'hills' and 'valleys' and attempts to detect the valleys.

  • Digital Image Processing 30

    Watershed Segmentation

    B Distance transform

    D Watershed

    C Image's complement

    ://httpwww.mathworks.de/company/newsletters/news_notes/win02/watershed.html

  • Digital Image Processing 31

    Watershed Segmentation on image gradient

  • Digital Image Processing 32

    Over-segmentation may occur, especially in noisy images (gradient enhances the high frequencies!)

    A preprocessing with a smoothing filter can reduce noise and remove small details

    Watershed Segmentation

  • Digital Image Processing

    Match-based segmentationTemplate segmentation

    Evaluate a match criterion for each location and rotation of the pattern in the image

    Local maxima of this criterion exceeding a present threshold represent pattern location in the image Matching criteria can be defined in many

    ways; in particular, correlation between a pattern and the searched image data is a general matching criterion.

  • Digital Image Processing 34

    Template matchingCorrelation

    The operation called correlation is closely related to convolution.

  • Digital Image Processing 35

    Template matching by correlation

  • Digital Image Processing 36

    Demo of template matching using correlation

  • Digital Image Processing

    Demo of template matching using correlation

    http://bigwww.epfl.ch/demo/templatematching/tm_correlation/demo.html

  • Digital Image Processing

    Other Features-based Segmentation

    Frequency features ... successful in the tasks of texture

    segmentation ....

    PCA - Principal component analysis SIFT - Scale-invariant feature transform

  • Digital Image Processing

    Segmentation in Video-sequences

    Background Subtraction first must be learned a model of the

    background this background model is compared against

    the current image and then the known background parts are subtracted away.

    The objects left after subtraction are presumably new foreground objects.

  • Digital Image Processing 40

    Establishing a Reference Images

    Establishing a Reference Images: Difference will erase static object: When a dynamic object move out completely from its

    position, the back ground in replaced.

    SegmentationFolie 2Folie 3 ThresholdingFolie 5Folie 6Folie 7Folie 8Edge DetectionSlide 4Folie 11Folie 12Folie 13An example of growing regionsFolie 15Folie 16Folie 17Folie 18Folie 19Folie 20Folie 21Folie 22Folie 23Folie 24Folie 25Folie 26Folie 27Split & Merge -ExampleFolie 29Folie 30Slide 32Slide 33Folie 33Object recognition CorrelationMatching by correlationFolie 36Folie 37Folie 38Folie 39Establishing a Reference Images