L3 Morphology

  • View
    214

  • Download
    0

Embed Size (px)

Text of L3 Morphology

  • 7/31/2019 L3 Morphology

    1/75

    GV12/3072Image Processing.

    1

    Morphological Operations

  • 7/31/2019 L3 Morphology

    2/75

    GV12/3072Image Processing.

    2

    Outline

    Basic concepts: Erode and dilate

    Open and close.

    Granulometry

    Hit and miss transform

    Thinning and thickening

    Skeletonization and the medial axis transform

    Introduction to gray level morphology.

  • 7/31/2019 L3 Morphology

    3/75

    GV12/3072Image Processing.

    3

    What Are Morphological

    Operators? Local pixel transformations for processing

    region shapes

    Most often used on binary images

    Logical transformations based on

    comparison of pixel neighbourhoods with a

    pattern.

  • 7/31/2019 L3 Morphology

    4/75

    GV12/3072Image Processing.

    4

    Simple Operations - Examples

    Eight-neighbour erode

    a.k.a. Minkowsky subtraction

    Erase any foreground pixel that has one

    eight-connected neighbour that is

    background.

  • 7/31/2019 L3 Morphology

    5/75

    GV12/3072Image Processing.

    5

    8-neighbour erode

    Erode 1 Erode 2 Erode 5

    Threshold

  • 7/31/2019 L3 Morphology

    6/75

    GV12/3072Image Processing.

    6

    8-neighbour dilate

    Eight-neighbour dilate

    a.k.a. Minkowsky addition

    Paint any background pixel that has one

    eight-connected neighbour that is foreground.

  • 7/31/2019 L3 Morphology

    7/75

    GV12/3072Image Processing.

    7

    8-neighbour dilate

    Dilate 1 Dilate 2 Dilate 5

  • 7/31/2019 L3 Morphology

    8/75

    GV12/3072Image Processing.

    8

    Why?

    Smooth region boundaries for shape

    analysis.

    Remove noise and artefacts from an

    imperfect segmentation.

    Match particular pixel configurations in an

    image for simple object recognition.

  • 7/31/2019 L3 Morphology

    9/75

    GV12/3072Image Processing.

    9

    Structuring Elements

    Morphological operations take two

    arguments:

    A binary image

    A structuring element.

    Compare the structuring element to the

    neighbourhood of each pixel. This determines the output of the

    morphological operation.

  • 7/31/2019 L3 Morphology

    10/75

    GV12/3072Image Processing.

    10

    Structuring elements

    The structuring element is also a binary

    array.

    A structuring element has an origin.

    1 1 1

    1 1 1

    1 1 1

    0 1 0

    1 1 1

    0 1 0

    0 1 0

    1 0 1

    0 1 0

    1

    1

    0

  • 7/31/2019 L3 Morphology

    11/75

    GV12/3072Image Processing.

    11

    Binary images as sets

    We can think of the binary image and the

    structuring element as sets containing the

    pixels with value 1.

    1 1 1

    0 1 1

    0 0 0

    0

    0

    0

    0

    0

    00 0 0 1 0

    0 0 0 0 0

    I= {(1,1), (2,1), (3,1),

    (2,2), (3,2), (4,4)}

  • 7/31/2019 L3 Morphology

    12/75

    GV12/3072Image Processing.

    12

    Some sets notation

    Union and

    intersection:

    Complement

    Difference

    We use for the

    empty set .

    2121

    2121

    and:or:

    IxIxxIIIxIxxII

    IxxIC :

    2121 and:\ IxIxxII

  • 7/31/2019 L3 Morphology

    13/75

    GV12/3072Image Processing.

    13

    More sets notation

    The symmetrical setofS with respect to

    point o is

    SxxoS :

    1 1 1 1

    1 1 1

    0 1 1

    0 0 0

    0 0 0

    1 1 0

    1 1 1

    0 1 1

    1 1 1

    1 1 1

    1

    1

    1

    0

    1

    1

    1 1 1 1 1

    0 1 1 1 0

    0 1 1

    1 1 11 1 1

    1

    11

    0

    11

    1 1 1 1 1

    0 1 1 1 0

  • 7/31/2019 L3 Morphology

    14/75

    GV12/3072Image Processing.

    14

    Fitting, Hitting and Missing

    S fitsIatx if

    S hitsIatx if

    S missesIatx if

    ISssxyy },:{

    ISssxyy },:{

    ISssxyy },:{

  • 7/31/2019 L3 Morphology

    15/75

    GV12/3072Image Processing.

    15

    Fitting, Hitting and Missing

    0 1 0

    1 0 1

    0 1 1

    1

    1

    1

    1

    1

    0

    1

    1

    0

    1

    1

    0

    1

    1

    0

    0 1 0 0 0 0 1 00 1 0 1 0 1 0 0

    0 1 1 1 1 0 0 0

    0 1 1 1 0 0 0 0

    0 1 0 0 0 0 0 0

    0 1 0

    1 1 10 1 0

    Image Structuring

    element

  • 7/31/2019 L3 Morphology

    16/75

    GV12/3072Image Processing.

    16

    Erosion

    The imageE=I S is the erosion of

    imageIby structuring element S.

    otherwise0

    atfitsif1)(

    xISxE

    SsIsxxE everyfor:

  • 7/31/2019 L3 Morphology

    17/75

    GV12/3072Image Processing.

    17

    Implementation (nave)% I is the input image, S is a structuring element

    % with origin (ox, oy). E is the output image.

    function E = erode(I, S, ox, oy)

    [X,Y] = size(I);

    [SX, SY] = size(S);

    E = ones(X, Y);

    for x=1:X; for y=1:Y

    for i=1:SX; for j=1:SY

    if(S(i,j))

    E(x,y) = E(x,y) & ImageEntry(I, x+i-ox, y+j-oy);

    end

    end; end

    end; end

  • 7/31/2019 L3 Morphology

    18/75

    GV12/3072Image Processing.

    18

    Example

    Structuring

    element

    1 1 1

    1 1 1

    1 1 1

    1

    1

    1

    1

    1

    1

    1 1 1 1 1

    1 1 1 1 1

  • 7/31/2019 L3 Morphology

    19/75

    GV12/3072Image Processing.

    19

    Example

    Structuring

    element

    0 1 1

    1 1 1

    1 1 1

    1

    1

    1

    0

    1

    1

    1 1 1 1 1

    0 1 1 1 0

  • 7/31/2019 L3 Morphology

    20/75

    GV12/3072Image Processing.

    20

    Example

    Structuring

    element

    1 0 0

    0 1 0

    0 0 1

    0

    0

    0

    0

    0

    0

    0 0 0 1 0

    0 0 0 0 1

  • 7/31/2019 L3 Morphology

    21/75

    GV12/3072Image Processing.

    21

    Dilation

    The imageD =I S is the dilation of

    imageIby structuring element S.

    otherwise0

    athitsif1)(

    xISxD

    SsIysxxD and,:

  • 7/31/2019 L3 Morphology

    22/75

    GV12/3072Image Processing.

    23

    Example

    Structuring

    element

    1 1 1

    1 1 1

    1 1 1

    1

    1

    1

    1

    1

    1

    1 1 1 1 1

    1 1 1 1 1

  • 7/31/2019 L3 Morphology

    23/75

    GV12/3072Image Processing.

    24

    Example

    Structuring

    element

    0 1 1

    1 1 1

    1 1 1

    1

    1

    1

    0

    1

    1

    1 1 1 1 1

    0 1 1 1 0

  • 7/31/2019 L3 Morphology

    24/75

    GV12/3072Image Processing.

    25

    Example

    Structuring

    element

    1 0 0

    0 1 0

    0 0 1

    0

    0

    0

    0

    0

    0

    0 0 0 1 0

    0 0 0 0 1

  • 7/31/2019 L3 Morphology

    25/75

    GV12/3072Image Processing.

    26

    Erosion and dilation

    Erosion and dilation are dual operations:

    Commutativity and associativity

    SISI CC

    )(

    ISSI

    ISSI

    )()(

    )()(

    TSITSI

    TSITSI

  • 7/31/2019 L3 Morphology

    26/75

    GV12/3072Image Processing.

    27

    Opening and Closing

    The opening ofIby S is

    The closing ofIby S is

    SSISI )(

    SSISI )(

  • 7/31/2019 L3 Morphology

    27/75

    GV12/3072Image Processing.

    28

    Opening and Closing

    Opening and closing are dual

    transformations:

    Opening and closing are idempotent

    operations:

    SISI CC )(

    SSISI

    SSISI

    )(

    )(

  • 7/31/2019 L3 Morphology

    28/75

    29

    Example

    Structuring

    element

    1 1 1

    1 1 1

    1 1 1

    1

    1

    1

    1

    1

    1

    1 1 1 1 1

    1 1 1 1 1

    close

    open

  • 7/31/2019 L3 Morphology

    29/75

    30

    Example

    Structuring

    element

    0 1 1

    1 1 1

    1 1 1

    1

    1

    1

    0

    1

    1

    1 1 1 1 1

    0 1 1 1 0

    close

    open

  • 7/31/2019 L3 Morphology

    30/75

    31

    Example

    Structuring

    element

    1 0 0

    0 1 0

    0 0 1

    0

    0

    0

    0

    0

    0

    0 0 0 1 0

    0 0 0 0 1

    close

    open

  • 7/31/2019 L3 Morphology

    31/75

    GV12/3072Image Processing. 32

    Morphological filtering

    To remove holes in the foreground and islands inthe background, do both opening and closing.

    The size and shape of the structuring elementdetermine which features survive.

    In the absence of knowledge about the shape offeatures to remove, use a circular structuringelement.

  • 7/31/2019 L3 Morphology

    32/75

    GV12/3072Image Processing. 33

    Example

    Structuring

    element

    1 1 1

    1 1 1

    1 1 1

    1

    1

    1

    1

    1

    1

    1 1 1 1 1

    1 1 1 1 1

    Close then open

    Open then close

  • 7/31/2019 L3 Morphology

    33/75

    GV12/3072Image Processing. 34

    Example

    Structuring

    element

    0 1 1

    1 1 1

    1 1 1

    1

    1

    1

    0

    1

    1

    1 1 1 1 1

    0 1 1 1 0

    Close then open

    Open then close

  • 7/31/2019 L3 Morphology

    34/75

  • 7/31/2019 L3 Morphology

    35/75

    GV12/3072Image Processing. 36

    Count the Red Blood Cells