iris04

Upload: mohit-goel

Post on 08-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 iris04

    1/25

    Image Segmentation by

    using K-MeansClustering

    Language- C++

    Platform- GNU/LINUX

    Compiler GNU G++Libraries-

    IM-3.6 - for Digital imaging

    NEWMAT11 Matrix library 1

  • 8/7/2019 iris04

    2/25

    ORGANIZATION

    Defense Research & Development

    Organization (DRDO)

    DRDO has a network of 52 laboratories

    eg.

    SAG, LASTEC, DTRL

    Defense Terrain Research Laboratory2

  • 8/7/2019 iris04

    3/25

    CONTENTS

    Introduction

    Image

    Image Processing

    Image Segmentation

    K-Means Clustering

    Results

    Libraries Conclusion

    Refrences

    3

  • 8/7/2019 iris04

    4/25

    INTRODUCTION

    The goal is to change the representation of an

    image into something that is more meaningful

    and easier to analyze i.e. to segment the image

    4

    20 40 60 80 100 120

    20

    40

    60

    80

    100

    120

  • 8/7/2019 iris04

    5/25

    Digital Image

    A digital image is a representation of a two-dimensional image using ones and zeros

    Digital imaging is the art ofmaking digital

    images

    Each image is compiled of a certain amount of

    pixels, which are then mapped onto a grid and

    stored in a sequence by a computer. Every pixel

    in an image is given a tonal value to determineits hue or color.

    5

  • 8/7/2019 iris04

    6/25

    PIXELS

    6

    Each pixel's color sam

    ple has three num

    erical RGB com

    ponents(Red, Green, Blue) to represent the color.

    These three RGB components are three 8-bit numbers for each

    pixel.

  • 8/7/2019 iris04

    7/25

    Image Processing

    Analog Image Processing

    Digital Image Processing

    7

    Output the result

    Analyze or

    Manipulate the

    Image

    Import anImage

  • 8/7/2019 iris04

    8/25

    Image Magnification, Reduction

    8

  • 8/7/2019 iris04

    9/25

    Noise Removal, Mosaic

    9

  • 8/7/2019 iris04

    10/25

    Image Segmentation

    (one of the vital steps used in Image processing)

    segmentation refers to the process of partitioning a digital

    image into multiple segments (sets of pixels, also known

    as superpixels).

    The goal of segmentation is to simplify and/or change the

    representation of an image into something that is more

    meaningful and easier to analyze.

    Image segmentation is typically used to locate objects

    and boundaries (lines, curves, etc.) in images

    10

  • 8/7/2019 iris04

    11/25

    Below is the Original data, on

    which the K-Means steps will

    be implemented

    March 10, 2004 11

    8 1 0 1 2 1 4 1 6 1 8 2 0 7

    8

    9

    1 0

    1 1

    1 2

    1 3

    1 4

  • 8/7/2019 iris04

    12/25

    Placing K points as the initial

    centroids.

    12

    8 1 0 1 2 1 4 1 6 1 8 2 0 7

    8

    9

    1 0

    1 1

    1 2

    1 3

    1 4

    I n i t i a l C l u s t e r C e n t e r s a t I t e r a t i o n 1

    Here, the no. of Clusters in which the pixels of image

    is to be divided is 2. hence, k=2

  • 8/7/2019 iris04

    13/25

    Assigning each object to the group

    that has the closest centroid.

    In this step, we calculate the distance of each object (pixel)

    with the centroids & on comparing, the pixel with shortest

    distance resides in the cluster of that centroid.

    Euclidean Distance

    . If the two pixels that we are considering have

    coordinates (x1,y1) and (x2,y2) , then the Euclidean

    distance is given by:

    13

  • 8/7/2019 iris04

    14/25

    we got two clusters & the objects in

    that cluster are nearer to it as compare

    to that of other cluster

    14

    8 1 0 1 2 1 4 1 6 1 8 2 0 7

    8

    9

    1 0

    1 1

    1 2

    1 3

    1 4U p d a t e d M e m b e r s h i p s a n d B o u n d a r y a t I t e r a t i o n 1

    X V a r i a b l e

    Y

    V

    a

    ria

    b

    le

  • 8/7/2019 iris04

    15/25

    At 3rd step, we need to re-calculate k new centroids as

    barycenters of the clusters resulting from the previous step

    i.e., just take the mean of every cluster that will be new

    centroid as-

    we got new centroids after taking the mean of objects of

    both clusters.

    (Now again the 2nd step is repeated for dividing the objects

    in two clusters according to the new centroids) 15

    8 1 0 1 2 1 4 1 6 1 8 2 0 7

    8

    9

    1 0

    1 1

    1 2

    1 3

    1 4

    p d a te d C l u s te r C e n te r s a t I te r a t i o n 2

  • 8/7/2019 iris04

    16/25

    (Below is the final result, convergence has been achieved

    i.e., centroids dont shift any more)

    16

    8 1 0 1 2 1 4 1 6 1 8 2 0 7

    8

    9

    1 0

    1 1

    1 2

    1 3

    1 4U p d a t d

    ip s a n d

    n d a r y a t I t r a t i n 4

    X a r ia b l

    a

    riab

    l

  • 8/7/2019 iris04

    17/25

    K-MEANS CLUSTERING

    17

    .

    The algorithm is composed of the following steps :

    1). Place K points into the space represented by the

    objects that are being clustered. These points

    represent initial group centroids.

    2). Assign each object to the group that has the closestcentroid.

    3). When all objects have been assigned, recalculate

    the positions of the K centroids.

    4). Repeat Steps 2 and 3 until the centroids no longermove. This produces a separation of the objects into

    groups from which the metric to be minimized can

    be calculated.

  • 8/7/2019 iris04

    18/25

    RESULTSIM Info File Name: ./flower.jpg

    File Size: 1

    7.50 Kb

    Format: JPEG - JPEG File Interchange Format

    Image Count: 1

    Width: 184

    Height: 148

    Color Space: RGB

    Data Type: byte

    Data Size: 79.78 Kb

    FileFormat: JPEG

    ResolutionUnit: DPI

    18

  • 8/7/2019 iris04

    19/25

    Image Orientation:

    Top-down

    19

    Is Packed: Yes

    Is Top Down: Yes

  • 8/7/2019 iris04

    20/25

    Red Plane123 54 0 25 78 245 54 76 125 245 23 175 129

    254 234 21 54 36 87

    23 65 92 145 23474 190

    165 34 26 86 187 165 136 134 176 153 12 9 0

    Green Plane

    23 0 12 7 34 243 65 1 48 21 76 34 87 27 142 163134 1 98 0 34 234 176 19 1 231 1175 123 32 95

    94 36 37 83 95 28 29 83 73 85 93 56 0 124 234

    Blue Plane43 2 65 3 34 243 65 1 48 21 76 34 87 27 142 163

    239 0 83 0 31 232 172 10 19 233 1 75 223 62 75

    44 66 57 88 55 88 59 73 43 75 93 46 2 224 134 20

  • 8/7/2019 iris04

    21/25

    21

    K= 6

    k=8

  • 8/7/2019 iris04

    22/25

    Gray images

    22

    K = 5

    K = 8

  • 8/7/2019 iris04

    23/25

    MATRIX LIB-NEWMAT11

    To construct an m x n matrix, A, (m and n are

    integers) use Matrix A(m,n);

    SquareMatrix SQ(n);

    UpperTriangularMatrix UT(n);

    SymmetricMatrix S(n);

    DiagonalMatrix D(n);

    IdentityMatrix I(n);

    A.swap(B);

    swap(A,B);23

  • 8/7/2019 iris04

    24/25

    24

    CONCLUSIONfor smaller values of k the algorithms give good results. For larger

    values of k, the segmentation is very coarse, many clusters appear in the

    images at discrete places.

    Further, the computational time complexity of the algorithm is O

    (nkl), where n is the total number of objects in the dataset, k is the

    required number of clusters we identified and l is the number of

    iterations.

  • 8/7/2019 iris04

    25/25

    THANK YOU

    QUERIES ?

    25