Kuliah 10 - (New) Image...

download Kuliah 10 - (New) Image Segmentationstaff.ui.ac.id/.../dodi.sudiana/material/kuliah09-segmentasicitra.pdf · 10/16/2009 2 Example Illustration of line detection (a) Binary wire-bond

If you can't read please download the document

Transcript of Kuliah 10 - (New) Image...

  • 10/16/2009

    1

    Lecture 9Program Studi S1 Reguler DTE FTUISlides 2009

    IMAGE SEGMENTATIONIMAGE SEGMENTATION

    PreviewPreviewSubdivide an image into its constituent regions or objectsProcess stop when the objects of interest have been isolatedAccuracy -- determine the eventual success or failure of computerized analysis procedure

    2 Image SegmentationImage Segmentation

    Based on one of the two properties of intensity values --discontinuity (edge-based) and similarity (region-based) gray level discontinuities (abrupt changes): point , line

    and edges assemble edges into region boundary (edge linking)

    region-oriented segmentation: watershed segmentation Similarity (according to a set of criteria): region

    growing, split and merge

    Region-based, edge based and boundary based or threshold-based

    Detection of discontinuities For 33 mask, the response of the mask at any point

    in the image below Point detection of isolated points is determined if

    |R|T then a point has been detected Def. of isolated point: a point whose gray level is

    significantly different from its background

    3 Image SegmentationImage Segmentation

    significantly different from its background

    Line detection Move a specific mask around an image Preferred direction of each mask is weighted with a

    large coefficient than other possible direction Use the mask associated with one direction and

    thresholds its output |Ri| > |Rj|Horizontal, vertical, and diagonal line

    General mask

    4

    A general 3x3 mask

    Point detection maskPoint detection mask

    (a) Point detection mask

    (b) X-ray image of

    5 Image SegmentationImage Segmentation

    a turbine blade with a porosity

    (c) Result of point detection

    (d) Result of using eq. (10.1-2)

    Line masks (with angle)Line masks (with angle)

    6 Image SegmentationImage Segmentation

  • 10/16/2009

    2

    ExampleExampleIllustration of line detection(a) Binary wire-

    bond mask(b) Absolute value

    7 Image SegmentationImage Segmentation

    (b) Absolute value of result after processing with -45 line detector

    (c) Result of thresholding image (b)

    Edge detectionthe most common approach for detecting meaningful discontinuities in gray level Basic formulation The difference between an edge (local) and

    boundary (global)Edge: ability to measure gray-level transitions

    8 Image SegmentationImage Segmentation

    an ideal edge: a set of connected pixels Models of step edge, ramp edge, roof

    edgeRamp edge: Edge blurring problem cause by: optics, sampling, and other image acquisition ramp-like profileThe thickness of the ramp edge determined by the length of the ramp

    Ideal digital & ramp edgeIdeal digital & ramp edge(a) Model of an

    ideal digital edge

    (b) Model of a ramp edge

    9 Image SegmentationImage Segmentation

    ramp edge. The slope of the ramp is proportional to the degree of blurring in the edge

    ExampleExample(a) Two regions

    separated by a vertical edge

    (b) Detail near the edge

    10 Image SegmentationImage Segmentation

    the edge, showing a gray-level profile, and the first and second derivatives of the profile

    Random Gaussian noise:Mean = 0

    (a) =0

    (b) =0.1

    11 Image SegmentationImage Segmentation11 Image SegmentationImage Segmentation

    (c) =1.0

    (d) =10.0

    the magnitude of the first derivative can be used to detect the presence of an edge at a point in an image the sign of the second derivative can be used to

    determine whether an edge pixel lies on the dark or light side of an image

    two additional properties: (1) double edges (2) zero-crossing properties: useful for locating the centers of thick edges

    Gradient operators First derivative operator based on approximation of 2-D

    gradient operator

    12 Image SegmentationImage Segmentation

    gradient operator The gradient of an image f(x,y) at location (x,y) is defined

    as

    The magnitude of this vector is denoted as The direction of this is perpendicular to the direction of

    an edge direction

    =

    =

    yfxf

    GG

    fy

    x

    2/122 ][)( yx GGfmagf +==

    =

    x

    y

    GG

    yx 1tan),(

  • 10/16/2009

    3

    Robert cross-gradient operator First order derivative

    Prewitt operator Sobel operator Use a weight of 2 in the center coefficient to achieve smoothing

    by giving more important to the center point

    Have superior noise suppression to Prewitt operator Harder to implement than Prewitt operator yx GGf +

    13 Image SegmentationImage Segmentation

    Approximate the gradient operator by absolute vales The approximation will not be isotropic (invariant to rotation)

    The Laplacian operator Is a second-order derivative defined as

    For a 33 region A digital approximation including the diagonal neighbor is given

    by

    yf

    xff 2

    2

    2

    22

    +

    =

    )(4 864252 zzzzzf +++=

    )......(8 9152 zzzf ++=

    Edge detector masksEdge detector masks

    14 Image SegmentationImage Segmentation14 Image SegmentationImage Segmentation

    Prewitt and Sobel masks for Prewitt and Sobel masks for diagonal edgesdiagonal edges

    15 Image SegmentationImage Segmentation15 Image SegmentationImage Segmentation

    Gradient operatorsGradient operators

    16 Image SegmentationImage Segmentation16 Image SegmentationImage Segmentation

    With smoothing (5With smoothing (55) averaging5) averaging

    17 Image SegmentationImage Segmentation17 Image SegmentationImage Segmentation

    Diagonal edge detectionDiagonal edge detection

    18 Image SegmentationImage Segmentation18 Image SegmentationImage Segmentation

  • 10/16/2009

    4

    Is not used in its original form for edge detectionIs unacceptably sensitive to noiseProduces double edges, complicate segmentation Is unable to detect edge directionConsists of: use its zero crossing for edge location use it for the complementary purpose of establishing whether a pixel is

    on the dark or light region of an edge

    The Laplacian operator is combined with smoothing

    19 Image SegmentationImage Segmentation

    The Laplacian operator is combined with smoothing as precursor to finding edge via zero crossingConsider the function (Laplacian Gaussian) This approximation is not unique Capture the essential shape of Smooth the image, and provide an image with zero

    crossing Sometime it is called the Mexican hat functions

    2

    2

    2

    2

    24

    2222 ][)( )(

    rr

    er

    rrhthenerh ==

    Zero crossing image are thinner than the gradient edges

    Drawbacks:Form numerous closed loops (Spaghettis effect in Fig. 10.15.g)The computation

    Advantages: noise reduction and strong/tough performance

    20 Image SegmentationImage Segmentation

    noise reduction and strong/tough performanceEdge-finding based on gradient still are used

    LoG LoG

    21 Image SegmentationImage Segmentation21 Image SegmentationImage Segmentation

    ExampleExample

    (a) Original image(b) Sobel gradient

    (shown for compariton)S i l G i

    22 Image SegmentationImage Segmentation

    (c) Spatial Gaussian smoothing function

    (d)Lapacian mask(e) LoG(f) Thresholded LoG(g) Zero crossings

    Edge linking and boundary detectionCharacterize an edge completely because of noise, break in the edge from non-uniform illumination, and other effects that introduce spurious intensity discontinuities Edge detection operators are followed by linking procedures to

    assemble pixels into meaningful edges or contours

    Local processing Analyze the characteristics of pixels in a small neighborhood about

    23 Image SegmentationImage Segmentation

    every point (x,y) in a small neighborhood All points that are similar according to a set of criteria: (1) the

    strength of the response of the gradient operator; (2) the direction of the gradient operator

    Similar in magnitude to the pixel at (x,y) if The predefined neighbor of (x,y) is similar in edge direction to the

    pixel at (x,y) if A point in the neighborhood of (x,y) is linked to the pixel (x,y) if

    both magnitude and direction are satisfied

    Eyxfyxf ),(),( 00

    0 0( , ) ( , )x y x y A

    =TyxfifTyxfif

    yxg),( 0),( 1

    ),(

    ExampleExample

    39 Image SegmentationImage Segmentation39 Image SegmentationImage Segmentation

    1. Object and background occupy comparable areas, then T is the average gray value of the image

    2. Object are small comparable to background, then the average value is not a good estimate, T is a midway between the maximum and minimum gray levels.

    the distorted histogram f(x,y)=i(x,y) r(x,y)

    40 Image SegmentationImage Segmentation

    then z(x,y)=ln f(x,y)=ln i(x,y)+ln r(x,y) the histogram of z(x,y) is given by the convolution

    of i(x,y) and r(x,y) if i(x,y) were constant, i(x,y) would be constant

    also, its histogram would be a simple spike (impulse) if i(x,y) had a broader histogram (resulting from

    non-uniform illumination), the convolution process would smear the histogram of r(x,y)

    Accessing to illumination source is availablea sol. to compensate for non-uniformity

    Project the illumination pattern onto a constant, white reflective surface (compensate for non-uniformity), g(x,y)=k i(x,y)H(x,y)=f(x,y)/g(x,y)=r(x,y)/k

    Basic global thresholding

    41 Image SegmentationImage Segmentation

    The simplest of thresholding-partition the image histogram by using a global thresholdSegmentation is accomplished by Scanning the image pixel Labeling each pixel depending on whether the gray

    level of that pixel is greater or less than T

    ExampleExample

    42 Image SegmentationImage Segmentation42 Image SegmentationImage Segmentation

  • 10/16/2009

    8

    threshold by using a heuristic approach, based on the visual inspection of the histogram Select an initial estimate for T Segment the image using T(G1, G2) Compute the average gray level values Compute a new threshold: T=1/2(1+2) Repeat steps 2 and 4 until the difference in

    T i ll h d fi d T

    43 Image SegmentationImage Segmentation

    T is smaller than a predefined T0(convergence)In general, a good initial value for T is the average gray level of the imageWhen objects are small compared to the area occupied by the background, average value is not a good initial

    ExampleExample

    44 Image SegmentationImage Segmentation44 Image SegmentationImage Segmentation

    Basic adaptive thresholdinguneven illumination causes a histogram that cannot be partitioned by a global threshold Solution: (1) divide the original image into sub-

    images; (2) utilize a different threshold to segment each sub-image

    45 Image SegmentationImage Segmentation

    g g How to divide an image? and How to estimate the threshold?

    Threshold depends on the location of the pixel in terms of sub-images

    ExampleExample

    do not contain a boundary between object and background: variances < 75 75 100 using the threshold discussed in the

    previous section the initial T was selected at the point

    midway between the minimum and the maximum

    ExampleExample

    47 Image SegmentationImage Segmentation47 Image SegmentationImage Segmentation

    ExampleExample

    48 Image SegmentationImage Segmentation48 Image SegmentationImage Segmentation

  • 10/16/2009

    9

    Optimal global and adaptive Optimal global and adaptive thresholdingthresholding

    A method for estimating thresholds that produce the minimum average segmentation error histogram may be considered as probability density

    function (PDF), p(z) the overall density function is the sum or mixture of

    49 Image SegmentationImage Segmentation

    the overall density function is the sum or mixture of two densities If the form of the densities is known, it is possible to

    determine an optimal threshold the mixture probability density function is

    p(z)=P1p1(z)+ P2p2(z) an image is segmented by classifying as background all

    pixels with gray level is greater than a threshold T Objective: select the value of T that minimize the

    average error

    Determine a given pixel belongs to an object or to the background

    the extreme case: background points are known never to occur (P2=0)differentiate T with respect to T (using Leibneiz rule) to find minimum error; and the optimal threshold

    Three level image based on gradient For a black object on a light background

    50 Image SegmentationImage Segmentation

    For a black object on a light backgroundEstimating these densities is not feasible sol: employ densities whose parameters are reasonably

    simple to obtain One of the principal densities is Gaussian density

    two threshold values may be required to obtain the optimal solutionif the variances are equal, a single threshold is sufficient (10-3.14)If P1=P2, the optimal threshold is the average of the means

    Using measures based on gradient and Laplacianto deep the valley between histogram peak the optimal threshold may be accomplished for

    other densities if the Rayleigh and log-normal densities

    Mean square error may be used to estimate a composite gray-level PDF of an image from the

    51 Image SegmentationImage Segmentation

    image histogram For Example:

    the mean square error p between p(z) and the image histogram

    determine analytically that minimize this mean square error is not a simple matter

    =

    =n

    iiirms zhzpn

    e1

    )]()([1

    GL PDF (2 regions)GL PDF (2 regions)

    52 Image SegmentationImage Segmentation52 Image SegmentationImage Segmentation

    Use of boundary characteristics for histogram improvement and local thresholding good threshold are enhanced considerably if the histogram peaks are tall, narrow, and separated by deep valleysImprove the shape of histogram by considering only those pixels that lie on or near the edges

    If h f h l h d b

    53 Image SegmentationImage Segmentation

    If histogram of the pixel on or near the edge between objects and background were used: improve the symmetry of the histogram peak The histograms have peaks of approximately the same

    height Equal probability: improve the symmetry of the

    histogram peak2

    2

    0( , ) and 0

    and 0

    if f Ts x y if f T f

    if f T f

  • 10/16/2009

    10

    ExamplesExamples

    55 Image SegmentationImage Segmentation55 Image SegmentationImage Segmentation

    ExampleExample

    56 Image SegmentationImage Segmentation56 Image SegmentationImage Segmentation

    Threshold based on several Threshold based on several variablesvariables

    Multi-spectral thresholding 3-D histogram

    Find clusters of points in 3-D space

    ShortcomingCluster seeking becomes an increasingly complex

    57 Image SegmentationImage Segmentation

    Cluster seeking becomes an increasingly complex

    ExampleExample

    58 Image SegmentationImage Segmentation58 Image SegmentationImage Segmentation

    Region-based segmentationBasic formulation

    segmentation must be complete;every pixel must be in a regionpoints in a region must be connectedthe region must be disjointedthe pixels in a segmented region (P(Ri)=TRUE) if all pixel in Ri have the same gray levelP(Ri Rj)= False --Ri an Rj is different

    Region growing

    59 Image SegmentationImage Segmentation

    a procedure that groups pixel or sub-region into larger regions based on predefined start with a set of seed criteria-similar to the seed (specific gray-level or color) points and from these grow regions by appending each seed priori information is not available--compute the same set of

    properties Criteriagray-level, texture, color the selection of similarity

    For Ex: land-use satellite imagery depends on color

    when the images are monochrome, carried out with set of descriptor based on gray levels and spatial properties (such as moments or textures)

    The stopping rule when on more pixels satisfy the criteria additional criteria

    utilize size, likeness between a candidate pixel and the pixels grown so far, and the shape of the region being grown (history of the growth)

    60 Image SegmentationImage Segmentation

    seed points and seed regions (Fig. 10.40)

    If connectivity or adjacency information is not used, descriptor alone can yield misleading result

    Region splitting and mergingSplitting subdivide the entire region successively into smaller and small

    quadrant regions if P(R)=FALSE quad tree -- the root of the tree corresponds to the entire image

    and each node corresponds to a subdivision

  • 10/16/2009

    11

    only splitting causes the final partition would contain adjacent regions with identical properties

    can be solved by mergingMerging Is limited to groups of four blocks the splitting and merging steps

    split into four disjoint quadrants

    61 Image SegmentationImage Segmentation

    split into four disjoint quadrants merge adjacent adjacent regionsstop when no further merging or splitting

    Variations of the schemeSplit the image into a set of blocks

    The advantage: use the same quad-tree for splitting and merging Texture segmentation

    EXAMPLEEXAMPLE(a) Image showing

    defective welds(b) Seed points(c) Result of region

    (a) (b)

    (c) Result of region growing

    (d) Boundaries of segmented defective welds (in black)

    (e) Histogram of (a)

    (c) (d)

    (e)

    QUADTREEQUADTREE(a) Partitioned image(b) Corresponding quadtree

    (a) (b)

    Split & MergeSplit & Merge

    64 Image SegmentationImage Segmentation64 Image SegmentationImage Segmentation

    (a) Original image; (b) Result of split and merge procedure; (c) Result of thresholding (a)

    No further merging The procedure is terminated by one final merging of regions

    satisfying step2 The merged regions may be of different size Texture segmentation is based on the measures of texture

    Segmentation by morphological watershedsAdvantage of global thresholding: speeddisadvantages of traditional segmentation: (1) the need to

    65 Image SegmentationImage Segmentation

    disadvantages of traditional segmentation: (1) the need to post-processing; (2) need edge linking for discontinuity The watershed segmentation often produces stable segmentation results (continuous segmentation boundaries)

    Basic conceptsBased on visualizing an image in three-dimension:two spatial coordinates versus gray levelsTopographic interpretation (three types of points):

    (a) Points belonging to a regional minimum (b) Points at which of a drop of water (catchment

    basin or watershed) (c) Points at which water would be equally likely to

    fall to more than one such minimum (crest line on the topographic surface; divide line or watershed lines)

    66 Image SegmentationImage Segmentation

    The principal objective is to find the watershed linesSuppose that a hole is punched in each regional minimum and the entire topography is flooded Water rise through the holes Rising water in distinct catchment basin is about to

    merge A dam is built to prevent the merging Reach when the tops of the dam are visible

  • 10/16/2009

    12

    Dam constructionDam constructionBased on binary imagesThe simplest way Construct dams separating sets of binary points based on

    morphological operationsUse dilationDef. of catchment basin and the sets of points in two regional

    i i t t 1 C (M ) d C (M )

    67 Image SegmentationImage Segmentation

    minimum at stage n-1: Cn-1(M2) and Cn-1(M2)The two individual components extracted from q by performing the simple AND operation qC[n-1] becomes one connected componentEach of the connected components is dilated by the structuring element, subject to two conditions: The dilation has to be constrained to q The dilation cannot be performed on points that would cause

    the sets being dilated to merge

    FloodingFlooding

    68 Image SegmentationImage Segmentation68 Image SegmentationImage Segmentation

    (a) Original image(b) Topographic view(c) - (d) Two slopes of flooding

    e) Result of further flooding

    f) Beginning of merging of water from two catchment basins (a short dam was built between them)

    69

    Flooding (continued )Flooding (continued )

    g) Longer damsh) Final watershed

    (segmentation)

    Flooding (contd)Flooding (contd)a) Two partially flooded

    catchment basins at stage n 1 of flooding,

    b) Flooding at stage n, showing that water has

    ill d b b i

    70