image segmentation digital image processing

Upload: naveednad2003556

Post on 14-Apr-2018

252 views

Category:

Documents


1 download

TRANSCRIPT

  • 7/30/2019 Image Segmentation Digital Image Processing

    1/44

    Image Segmentation

    CIS 601 Fall 2004

    Longin Jan Latecki

  • 7/30/2019 Image Segmentation Digital Image Processing

    2/44

    Image Segmentation

    Segmentation divides an image into its

    constituent regions or objects.

    Segmentation of images is a difficult task in

    image processing. Still under research.

    Segmentation allows to extract objects in

    images.

    Segmentation is unsupervised learning.

    Model based object extraction, e.g.,

    template matching, is supervised learning.

  • 7/30/2019 Image Segmentation Digital Image Processing

    3/44

    What it is useful for

    After a successfulsegmenting the image, the contours of

    objects can be extracted using edge detection and/or

    border following techniques.

    Shape of objects can be described.

    Based on shape, texture, and color objects can be

    identified.

    Image segmentation techniques are extensively used in

    similarity searches, e.g.:

    http://elib.cs.berkeley.edu/photos/blobworld/

    http://elib.cs.berkeley.edu/photos/blobworld/http://elib.cs.berkeley.edu/photos/blobworld/
  • 7/30/2019 Image Segmentation Digital Image Processing

    4/44

    Segmentation Algorithms

    Segmentation algorithms are based on one oftwo basic properties of color, gray values, ortexture: discontinuity and similarity.

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

    Second category are based on partitioning an

    image into regions that are similar according to apredefined criteria. Histogram thresholdingapproach falls under this category.

  • 7/30/2019 Image Segmentation Digital Image Processing

    5/44

    Domain spaces

    spatial domain (row-column (rc) space)histogram spaces

    color space

    texture space

    other complex feature space

  • 7/30/2019 Image Segmentation Digital Image Processing

    6/44

    Clustering in Color Space

    1. Each image point is mapped to a point in a color

    space, e.g.:

    Color(i, j) = (R (i, j), G(i, j), B(i, j))

    It is many to one mapping.

    2. The points in the color space are grouped to clusters.

    3. The clusters are then mapped back to regions in the

    image.

  • 7/30/2019 Image Segmentation Digital Image Processing

    7/44

    Examples

    Mnp: 30, percent 0.05, cluster number 4

    Mnp : 20, percent 0.05, cluster number 7

    Original pictures segmented pictures

  • 7/30/2019 Image Segmentation Digital Image Processing

    8/44

    Displaying objects in the

    Segmented Image

    The objects can be distinguished by

    assigning an arbitrary pixel value or

    average pixel value to the pixels belonging

    to the same clusters.

  • 7/30/2019 Image Segmentation Digital Image Processing

    9/44

    Thus, one needs clustering algorithms

    for image segmentation.

    Homework 8:

    Implement in Matlab and test on some example images

    the clustering in the color space.

    Use Euclidean distance in RGB color space.You can use k-means, PAM, or some other clustering

    algorithm.

    Links to k-means, PAM, data normalization

    Test images: rose, plane, car, tiger, landscape

    http://localhost/var/www/apps/conversion/tmp/DemoProg/kmeans1.mhttp://localhost/var/www/apps/conversion/tmp/DemoProg/K_Medoids.mhttp://localhost/var/www/apps/conversion/tmp/DemoProg/normalize.mhttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/rose.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/plane.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/car.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/tiger.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/landscape.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/landscape.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/tiger.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/car.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/plane.jpghttp://localhost/var/www/apps/conversion/tmp/scratch_5/Images/rose.jpghttp://localhost/var/www/apps/conversion/tmp/DemoProg/normalize.mhttp://localhost/var/www/apps/conversion/tmp/DemoProg/K_Medoids.mhttp://localhost/var/www/apps/conversion/tmp/DemoProg/kmeans1.mhttp://localhost/var/www/apps/conversion/tmp/DemoProg/kmeans1.mhttp://localhost/var/www/apps/conversion/tmp/DemoProg/kmeans1.m
  • 7/30/2019 Image Segmentation Digital Image Processing

    10/44

    Segmentation by Thresholding

    Suppose that the gray-level histogramcorresponds to an image f(x,y) composed ofdark objects on the light background, in such away that object and background pixels havegray levels grouped into two dominant modes.One obvious way to extract the objects from thebackground is to select a threshold T thatseparates these modes.

    Then any point (x,y) for which f(x,y) < T is calledan object point, otherwise, the point is called abackground point.

  • 7/30/2019 Image Segmentation Digital Image Processing

    11/44

    Gray Scale Image Example

    Image of a Finger Print with light background

  • 7/30/2019 Image Segmentation Digital Image Processing

    12/44

    Histogram

  • 7/30/2019 Image Segmentation Digital Image Processing

    13/44

    Segmented Image

    Image after Segmentation

  • 7/30/2019 Image Segmentation Digital Image Processing

    14/44

    In Matlab histograms for images can be

    constructed using the imhist command.

    I = imread('pout.tif');

    figure, imshow(I);

    figure, imhist(I) %look at the hist to get a threshold, e.g., 110

    BW=roicolor(I, 110, 255); % makes a binary image

    figure, imshow(BW) % all pixels in (110, 255) will be 1 and white

    % the rest is 0 which is black

    roicolor returns a region of interest selected as those pixels in Ithatmatch the values in the gray level interval.

    BW is a binary image with 1's where the values ofImatch the values

    of the interval.

  • 7/30/2019 Image Segmentation Digital Image Processing

    15/44

    Thresholding Bimodal Histograms

    Basic Global Thresholding:

    1)Select an initial estimate for T

    2)Segment the image using T. This will produce twogroups of pixels. G1 consisting of all pixels with gray

    level values >T and G2 consisting of pixels with values

  • 7/30/2019 Image Segmentation Digital Image Processing

    16/44

    Gray Scale Image - bimodal

    Image of rice with black background

  • 7/30/2019 Image Segmentation Digital Image Processing

    17/44

    Segmented Image

    Image after segmentationImage histogram of rice

  • 7/30/2019 Image Segmentation Digital Image Processing

    18/44

    Basic Adaptive Thresholding:

    Images having uneven illumination makes it difficultto segment using histogram,

    this approach is to divide the original image

    into sub images

    and use the thresholding process

    to each of the sub images.

  • 7/30/2019 Image Segmentation Digital Image Processing

    19/44

    Multimodal Histogram

    If there are three or more dominant modes in theimage histogram, the histogram has to bepartitioned by multiple thresholds.

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

    if T1 < (x,y) T2

    and to the background

    if f(x,y)

  • 7/30/2019 Image Segmentation Digital Image Processing

    20/44

    Thresholding multimodal histograms

    A method based on

    Discrete Curve Evolution

    to find thresholds in the histogram.

    The histogram is treated as a polyline

    and is simplified until a few vertices remain.

    Thresholds are determined by vertices that are local

    minima.

  • 7/30/2019 Image Segmentation Digital Image Processing

    21/44

    Discrete Curve Evolution (DCE)

    u

    v

    wu

    v

    w

    It yields a sequence: P=P0, ..., Pm

    Pi+1 is obtained from Pi by deleting the vertices of Pithat have minimal relevance measure

    K(v, Pi) = |d(u,v)+d(v,w)-d(u,w)|

    >

  • 7/30/2019 Image Segmentation Digital Image Processing

    22/44

    Gray Scale Image - Multimodal

    Original Image of lena

  • 7/30/2019 Image Segmentation Digital Image Processing

    23/44

    Multimodal Histogram

    Histogram of lena

  • 7/30/2019 Image Segmentation Digital Image Processing

    24/44

    Segmented Image

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

  • 7/30/2019 Image Segmentation Digital Image Processing

    25/44

    Color Image - bimodal

    Colour Image having a bimodal histogram

  • 7/30/2019 Image Segmentation Digital Image Processing

    26/44

    Histogram

    Histograms for the three colour spaces

  • 7/30/2019 Image Segmentation Digital Image Processing

    27/44

    Segmented Image

    Segmented image, skin color is shown

  • 7/30/2019 Image Segmentation Digital Image Processing

    28/44

    Split and Merge

    The goal of Image Segmentation is to findregions that represent objects ormeaningful parts of objects. Major

    problems of image segmentation are resultof noise in the image.

    An image domain X must be segmented inN different regions R(1),,R(N)

    The segmentation rule is a logicalpredicate of the form P(R)

  • 7/30/2019 Image Segmentation Digital Image Processing

    29/44

    Introduction

    Image segmentation with respect to

    predicate P partitions the image X into

    subregions R(i), i=1,,N such that

    X = i=1,..N U R(i)

    R(i) R(j) = 0 for I j

    P(R(i)) = TRUE for i = 1,2,,N

    P(R(i) U R(j)) = FALSE for i j

  • 7/30/2019 Image Segmentation Digital Image Processing

    30/44

    Introduction

    The segmentation property is a logical

    predicate of the form P(R,x,t)

    x is a feature vector associated with region

    R

    t is a set of parameters (usually

    thresholds). A simple segmentation rule

    has the form:

    P(R) : I(r,c) < T for all (r,c) in R

  • 7/30/2019 Image Segmentation Digital Image Processing

    31/44

    Introduction

    In the case of color images the feature

    vector x can be three RGB image

    components (R(r,c),G(r,c),B(r,c))

    A simple segmentation rule may have the

    form:

    P(R) : (R(r,c)

  • 7/30/2019 Image Segmentation Digital Image Processing

    32/44

    Region Growing (Merge)

    A simple approach to image segmentation

    is to start from some pixels (seeds)

    representing distinct image regions and to

    grow them, until they cover the entireimage

    For region growing we need a rule

    describing a growth mechanism and a rulechecking the homogeneity of the regions

    after each growth step

  • 7/30/2019 Image Segmentation Digital Image Processing

    33/44

    Region Growing

    The growth mechanism at each stage k

    and for each region Ri(k), i = 1,,N, we

    check if there are unclassified pixels in the

    8-neighbourhood of each pixel of theregion border

    Before assigning such a pixel x to a region

    Ri(k),we check if the region homogeneity:P(Ri(k) U {x}) = TRUE , is valid

  • 7/30/2019 Image Segmentation Digital Image Processing

    34/44

    Region Growing Predicate

    The predicate

    P: |m(R1)

    m(R2)| < k*min{std(R1), std(R2)},is used to decide if the merging

    of the two regions R1, R2is allowed, i.e.,

    if|m(R1) m(R2)| < k*min{std(R1), std(R2)},

    two regions R1, R2are merged.

    Rcr

    crIn

    Rm),(

    ),(1)(

    The arithmetic mean m and standard deviation stdof a

    region Rhaving n =|R| pixels:

    Rcr

    RmcrIn

    Rstd),(

    2))(),((1

    1)(

  • 7/30/2019 Image Segmentation Digital Image Processing

    35/44

    Split

    The opposite approach to region growing is

    region splitting.

    It is a top-down approach and it starts with the

    assumption that the entire image ishomogeneous

    If this is not true, the image is split into four sub

    images

    This splitting procedure is repeated recursively

    until we split the image into homogeneous

    regions

  • 7/30/2019 Image Segmentation Digital Image Processing

    36/44

    Split

    If the original image is square N x N, having

    dimensions that are powers of 2(N = 2n):

    All regions produced but the splitting algorithm

    are squares having dimensions M x M , whereM is a power of 2 as well.

    Since the procedure is recursive, it produces an

    image representation that can be described by a

    tree whose nodes have four sons each

    Such a tree is called a Quadtree.

  • 7/30/2019 Image Segmentation Digital Image Processing

    37/44

    Split

    Quadtree

    R0 R1

    R2 R3

    R0

    R1

    R00 R01 R02 R04

  • 7/30/2019 Image Segmentation Digital Image Processing

    38/44

    Split

    Splitting techniques disadvantage, they

    create regions that may be adjacent and

    homogeneous, but not merged.

    Split and Merge method is an iterative

    algorithm that includes both splitting and

    merging at each iteration:

  • 7/30/2019 Image Segmentation Digital Image Processing

    39/44

    Split / Merge

    If a region R is inhomogeneous

    (P(R)= False) then is split into four sub

    regions

    If two adjacent regions Ri,Rj are

    homogeneous (P(Ri U Rj) = TRUE), they

    are merged

    The algorithm stops when no furthersplitting or merging is possible

  • 7/30/2019 Image Segmentation Digital Image Processing

    40/44

    Split / Merge

    The split and merge algorithm produces

    more compact regions than the pure

    splitting algorithm

  • 7/30/2019 Image Segmentation Digital Image Processing

    41/44

    Applications

    3D Imaging : A basic task in 3-D image

    processing is the segmentation of an image

    which classifies voxels/pixels into objects or

    groups. 3-D image segmentation makes itpossible to create 3-D rendering for multiple

    objects and perform quantitative analysis for the

    size, density and other parameters of detected

    objects. Several applications in the field of Medicine like

    magnetic resonance imaging (MRI).

  • 7/30/2019 Image Segmentation Digital Image Processing

    42/44

    Results Region grow

  • 7/30/2019 Image Segmentation Digital Image Processing

    43/44

    Results Region Split

    R lt R i S lit d

  • 7/30/2019 Image Segmentation Digital Image Processing

    44/44

    Results Region Split and

    Merge