0% found this document useful (0 votes)
5 views206 pages

Computer Vision - Unit-2

Uploaded by

Vanusha D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views206 pages

Computer Vision - Unit-2

Uploaded by

Vanusha D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 206

COMPUTER VISION - UNIT-2

COMPUTER VISION - UNIT-2

SHAPES s REGIONS
CONTENTS

•Binary shape analysis •deformable shape analysis


•Connectedness boundary tracking procedures
•Object labeling and •active contours
counting
•shape models and shape
•Size filtering recognition
•Distance functions •centroidal profiles
•skeletons and thinning •handling occlusion
CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape Region-based


Analysis Shape Analysis Analysis Shape
Analysis

Connectedness Boundary Tracking Active Contours Region


Labeling C Procedures Descriptors
Counting Size Boundary Centroidal
Filtering Distance Descriptors Profiles
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Occlusion Handling
INTRODUCTION

 Shape and region analysis is crucial for understanding the


structure, geometry, and spatial arrangement of objects
within an image.

 These methods help in object recognition, classification,


and tracking across various applications like medical
imaging, industrial inspection, robotics, and surveillance.

 This unit focuses on binary shape analysis, boundary shape


analysis and region binary shape analysis.
BINARY SHAPE ANALYSIS

•Binary Shape Analysis is the process of examining and


extracting meaningful information from binary images
(images with only two pixel values.

•Typically 0 for background and 1 for foreground).

•In this context, the "shape" refers to the connected group of


foreground pixels representing an object in the image.
BINARY SHAPE ANALYSIS

Purpose

•To identify, label, and measure shapes in binary images.

•To prepare shape data for recognition, classification, or further


geometric analysis.
BINARY SHAPE ANALYSIS

Key Steps
•Connectedness
•Labeling s Counting
•Size Filtering
•Distance Functions
•Skeletons s Thinning
BINARY SHAPE ANALYSIS

Applications
•Counting cells in a microscope image.
•Detecting defects in manufacturing parts.
•Counting and classifying traffic vehicles in surveillance.
•Recognizing handwritten characters.
•Medical imaging for tumor boundary extraction.
BINARY IMAGES – 4 Connectivity

•In 4-connectivity, a pixel is connected to only the four


pixels that share a side with it — not the diagonals.
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0 01 0
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0 01 0
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0 01 0
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0 01 0
1 11 0
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1110
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1100
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1100
0100
BINARY IMAGES – 4 Connectivity

•A binary image has only two pixel values:


•1 (foreground / object)
•0 (background)

•Example (small binary image):

0010
1100
0100
BINARY IMAGES

Original Image
BINARY IMAGES

Original Image Binary Image


BINARY IMAGES

Original Image Binary Image

Identified Object
BINARY IMAGES – 8 Connectivity

•In 4-connectivity, is a rule in image processing that defines


two pixels
as “connected” if they touch either along an edge or at a
corner.
BINARY SHAPE ANALYSIS
BINARY SHAPE ANALYSIS
BINARY SHAPE ANALYSIS

1 0 0 0 1
0 1 0 1 0
0 0 1 0 0
0 1 0 1 0
1 0 0 0 1
OBJECT LABELING & COUNTING

•Object Labelling and Counting is a process in binary


shape analysis where each distinct connected object in a
binary image is:

•Labelled — assigned a unique identifier so it can be


distinguished from other objects.

•Counted — the total number of unique objects is determined.


OBJECT LABELING & COUNTING

How It Works
Input: A binary image where foreground pixels (value = 1)
represent objects, and background pixels (value = 0) represent
empty space.
Connected Component Analysis:
•Uses 4-connectivity or 8-connectivity rules to determine
which pixels belong to the same object.
Assign Labels:
•Each connected object gets a unique label (e.g., Object
1, Object 2, etc.).
Counting:
•Simply counting the number of labels gives the total
number of objects in the image.
OBJECT LABELING & COUNTING
SIZE FILTERING

•Size Filtering is a binary image processing technique used to


remove objects (connected components) that are too small or
too large based on a predefined size threshold.

Purpose
•To eliminate noise (tiny unwanted objects) or irrelevant large
regions.
•To keep only the objects that match the expected size range for
analysis.
SIZE FILTERING

How It Works
Object Labelling
• Identify and label all connected components in the binary image.
Size Measurement
• Calculate the size of each object (usually the number of pixels in it).
Filtering
• Remove objects whose size is less than a minimum threshold or
greater than a maximum threshold.
Output
• A cleaned binary image containing only the objects of interest
SIZE FILTERING

0 1 2 . . . 400
.
1
B
2 A
.
.
.
. C
400
SIZE FILTERING
DISTANCE FUCNTIONS

Distance Functions in binary shape


analysis are mathematical tools used to
measure the minimum distance from
each foreground pixel (object pixel) to
the nearest background pixel (or vice
versa).

They are often used to understand the


spatial structure of a shape, help in
shape simplification, and serve as a
foundation for operations like
skeletonization, shape matching, and
feature extraction.
DISTANCE FUCNTIONS

Distance Functions in binary shape


analysis are mathematical tools used to
measure the minimum distance from
each foreground pixel (object pixel) to
the nearest background pixel (or vice
versa).

They are often used to understand the


spatial structure of a shape, help in
shape simplification, and serve as a
foundation for operations like
skeletonization, shape matching, and
feature extraction.
DISTANCE FUCNTIONS

Distance Functions in binary shape


analysis are mathematical tools used to
measure the minimum distance from
each foreground pixel (object pixel) to
the nearest background pixel (or vice
versa).

They are often used to understand the


spatial structure of a shape, help in
shape simplification, and serve as a
foundation for operations like
skeletonization, shape matching, and
feature extraction.
DISTANCE FUCNTIONS

Distance Functions in binary shape


analysis are mathematical tools used to
measure the minimum distance from
each foreground pixel (object pixel) to
the nearest background pixel (or vice
versa).

They are often used to understand the


spatial structure of a shape, help in
shape simplification, and serve as a
foundation for operations like
skeletonization, shape matching, and
feature extraction.
DISTANCE FUCNTIONS

Distance Functions in binary shape


analysis are mathematical tools used to
measure the minimum distance from
each foreground pixel (object pixel) to
the nearest background pixel (or vice
versa).

They are often used to understand the


spatial structure of a shape, help in
shape simplification, and serve as a
foundation for operations like
skeletonization, shape matching, and
feature extraction.
DISTANCE FUCNTIONS

Distance Functions in binary shape


analysis are mathematical tools used to
measure the minimum distance from
each foreground pixel (object pixel) to
the nearest background pixel (or vice
versa).

They are often used to understand the


spatial structure of a shape, help in
shape simplification, and serve as a
foundation for operations like
skeletonization, shape matching, and
feature extraction.
DISTANCE FUCNTIONS – How to Calculate?

00000 00000 00000


01110 01110 01110
01110 01110 01210
01110 01110 01110
00000 00000 00000
DISTANCE FUCNTIONS – How to Calculate?

distance transform
00000 00000 00000
01110 01110 01110
01110 01110 01210
01110 01110 01110
00000 00000 00000
DISTANCE FUCNTIONS – How to Calculate?

00000 00000 00000


01110 01110 01110
01110 01110 01210
01110 01110 01110
00000 00000 00000

Local Maxima
DISTANCE FUCNTIONS – How to Calculate?

distance
transform
0000000 0000000 0000000 0000000
0111110 0111110 0111110 0111110
0111110 0111110 0122210 0122210
0111110 0111110 0121210 0123210
0111110 0111110 0122210 0122210
0111110 0111110 0111110 0111110
0000000 0000000 0000000 0000000
DISTANCE FUCNTIONS – How to Calculate?

0000000 0000000 0000000 0000000


0111110 0111110 0111110 0111110
0111110 0111110 0122210 0122210
0111110 0111110 0121210 0123210
0111110 0111110 0122210 0122210
0111110 0111110 0111110 0111110
0000000 0000000 0000000 0000000

Local Maxima
DISTANCE FUCNTIONS – Use?

000000
0
011111
0  Data compression (store only peaks instead of whole
shape).
012221
0  Reducing storage space.
012321
0
012221
Regenerating the object
00000 From stored maxima, apply downward propagation
until full shape is reconstructed.
01110
01210
01110
00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?

Steps
 Convert binary object to distance transform.
 Find local maxima (peaks).
 Store only maxima (compressed form).
 Reconstruct full object by spreading values downward.
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?

00000
01110
01110
01110
00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?

distance transform

00000 00000
01110 01110
01110 01210
01110 01110
00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?

distance transform Local maxima

00000 00000
01110 01110
2
01110 01210
01110 01110
00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?


Compressio
n
distance transform Local maxima

00000 00000
01110 01110
2
01110 01210
01110 01110
00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?


Compressio Decompressio
n n
distance transform Local maxima

00000 00000
01110 01110
2
01110 01210
01110 01110
00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?


Compressio Decompressio
n n
distance transform Local maxima

00000 00000 00000


01110 01110 00000
2
01110 01210 00200
01110 01110 00000
00000 00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?


Compressio Decompressio
n n
distance transform Local maxima

00000 00000 00000 00000


01110 01110 00000 00100
2
01110 01210 00200 01210
01110 01110 00000 00100
00000 00000 00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?


Compressio Decompressio
n n
distance transform Local maxima

00000 00000 00000 00000 00000


01110 01110 00000 00100 01110
2
01110 01210 00200 01210 01210
01110 01110 00000 00100 01110
00000 00000 00000 00000 00000
DISTANCE FUCNTIONS

How to achieve Compression and Decompression ?


Compressio Decompressio
n n
distance transform Local maxima

00000 00000 00000 00000 00000 00000


01110 01110 00000 00100 01110 01110
2
01110 01210 00200 01210 01210 01110
01110 01110 00000 00100 01110 01110
00000 00000 00000 00000 00000 00000
SKELETONS AND THINNING

 The skeleton of a shape is a thin version of that shape, usually


just one- pixel wide, that represents its general structure.
 Imagine shrinking an object evenly from the boundary
towards the center until only the "center lines" remain →
that is the skeleton.
•It preserves:
•The topology
• The overall structure/shape
SKELETONS AND THINNING
SKELETONS AND THINNING

Original Object

11111
11111
11111
SKELETONS AND THINNING

Original Object

11111
11111
11111

Skeleton

00100
00100
00100
SKELETONS AND THINNING

• Thinning is a morphological operation that iteratively removes


boundary pixels of an object until only a skeleton-like line
remains.
• It is one method to obtain skeletons.
• it makes it thin while keeping the shape’s connectivity.
SKELETONS AND THINNING

A pixel is removed only if:


• It is a border pixel (yes, touches a background 0), AND
• Removing it does not break connectivity (the object
must remain connected), AND
• It is not part of the “skeleton line” (pixels on the medial axis are
preserved).

Definition of Border Pixel


•A pixel = border pixel if:
•Its value = 1 (part of the object), AND
•At least one of its 8 neighbors = 0 (background).
SKELETONS AND THINNING
SKELETONS AND THINNING
SKELETONS AND THINNING
DEFORMABLE SHAPE ANALYSIS

 It is the study of shapes that can bend, stretch, or change


slightly, while still being recognized as the same object.
 It looks at the geometry and structure of an object even when
it is:
• Rotated
• Stretched or compressed
• Bent or curved
• Slightly deformed (like handwriting differences or flexible
objects)
DEFORMABLE SHAPE ANALYSIS – Why?

•In the real world, objects rarely look exactly the same every
time.
•For example:
•Handwritten letters → every person writes “A” differently.
•Human body → people move, bend, and change poses.
•Medical images → organs may shift or deform but are still
the same organ.
•Deformable shape analysis helps us recognize these as the
same class of object.
DEFORMABLE SHAPE ANALYSIS – How?

•boundary tracking procedures and active contours.


CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape Region-based


Analysis Shape Analysis Analysis Shape
Analysis

Connectedness Boundary Tracking Active Contours ReRgeigoinonDDese


Labeling C Procedures csrcipritpotrosrs
Counting Size Boundary CMenotmroeidnatsl
Moments
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Occlusion Handling
CONTENTS
SHAPES s REGIONS

Region-based
Binary Shape Boundary-based Deformable Shape
Shape
Analysis Shape Analysis Analysis
Analysis

ReRgeigoinonDDese
Connectedness Boundary Tracking Active Contours
csrcipritpotrosrs
Labeling C Procedures CMenotmroeidnatsl
Moments
Counting Size Boundary
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Static Dynamic Occlusion Handling


BOUNDARY TRACKING PROCEDURES

In computer vision, one of the most important tasks is to


understand the shape of an object.
An object can be represented in two main ways:

•Region representation – using all the pixels inside the object.

•Boundary representation – using only the pixels along


the edge (outline) of the object.
BOUNDARY TRACKING PROCEDURES

•These are algorithms to extract the boundary (contour)


of an object from a binary image.

•They work by starting from a boundary pixel and


systematically following connected edge pixels until
the entire contour is traced.
•The result is an ordered sequence of boundary points,
often used for further processing (e.g., descriptors,
recognition).
•Definition of Boundary Representation:
•Boundary tracking is the process of systematically walking
along the
pixels of an object’s outline (its boundary) in a binary or edge
image.
BOUNDARY TRACKING PROCEDURES

Need for Boundary Tracking

•Reduced Computation:
•Shape Analysis:
•Compression:
•Recognition:
•Foundation for Other Algorithms
BOUNDARY TRACKING PROCEDURES

How Boundary Tracking Works?

• Input : A binary image (object pixels = 1, background = 0).


• Find a Starting Pixel : The first object pixel encountered
(e.g., top-left corner of object).
• Choose a Direction Rule : For example, “always keep the
left side occupied.”
• Move to the Next Pixel : Check neighbours to find the next
boundary pixel.
• Repeat : Continue until you return to the starting pixel.
BOUNDARY TRACKING PROCEDURES

•Moore-Neighbour Tracing Algorithm:


•Start at a boundary pixel.
•Move clockwise around its 8-neighbors until the next boundary pixel is found.
• Continue until the starting pixel is reached again

•Freeman Chain Code Tracking:


• Encode the direction of movement between boundary pixels (0 = right, 1 = up-right, 2
= up, etc.).
• The sequence of codes fully represents the shape.

•“Always Keep Left” Rule:


•While moving, keep the object pixels on your left side.
•Ensures you don’t cut across thin parts of the boundary.
BOUNDARY TRACKING PROCEDURES

•Moore-Neighbour Tracing
0 0 0 0 0
Algorithm: 0 1 1 1 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0

•Freeman Chain Code Tracking:


BOUNDARY TRACKING PROCEDURES

•Moore-Neighbour Tracing 00000


Algorithm:
0 11 1 0
0111 (1,1)
0
0111
0
•Freeman Chain Code 0000
Tracking: 0
BOUNDARY TRACKING PROCEDURES

•Moore-Neighbour Tracing 00000


Algorithm:
0 1 11 0
0111 (1,1) -> (1,2)
0
0111
0
•Freeman Chain Code 0000
Tracking: 0
BOUNDARY TRACKING PROCEDURES

•Moore-Neighbour Tracing
0 0 0 0 0
Algorithm: 0 1 1 1 0
0 1 1 1 0
0 1 1 1 0
000 0 0

•Freeman Chain Code Tracking: 3 21


4 *0
5 67
BOUNDARY TRACKING PROCEDURES

Input Image
0 0 0 0 0
0 1 1 1 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0

Freeman Code
3 2 1
4 * 0
5 6 7
BOUNDARY TRACKING PROCEDURES

Input Image
00000
011 1 0
01110
01110
00000

Freeman
Code
NW N NE
3 2 1 W * E
4 * 0 SW S SE
5 6 7
BOUNDARY TRACKING PROCEDURES

Input Image
00000
011 1 0 000
01110 0 11
0111 011
0
00000

Freeman
Code
NW N NE Final Freeman Code Output
3 2 1 W * E
4 * 0 SW S S
5 6 7 E
BOUNDARY TRACKING PROCEDURES

Input Image
00000
011 1 0 000
01110 0 11
0111 011
0
0000
0

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0,
BOUNDARY TRACKING PROCEDURES

Input Image
0 0000
0 11 1 0 000
0 1110 1 11
0 111 111
0
0 000
0

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0,
BOUNDARY TRACKING PROCEDURES

Input Image
0 0000
0 11 1 0 000
0 1110 1 11
0 111 111
0
0 000
0

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0,
BOUNDARY TRACKING PROCEDURES

Input Image
0 0 000
0 1 11 0 000
0 1 110 1 10
0 1 11 110
0
0 000
0

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0,
BOUNDARY TRACKING PROCEDURES

Input Image
0 0 000
0 1 11 0 000
0 1 110 1 10
0 1 11 110
0
0 000
0

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6,
BOUNDARY TRACKING PROCEDURES

Input
Image
110
0 000
0
0 111
0 1
0 11 0 110
0 111 110
0
0 000
0

Freeman
Code
3 2 1 4 * 0
5 6 7
NW N Final Freeman Code Output
0 , 0, 6,
NE
W * E
SW S
SE
BOUNDARY TRACKING PROCEDURES

Input
Image
110
0 000
0
0 111
0 1
0 11 0 110
0 111 110
0
0 000
0

Freeman
Code
3 2 1 4 * 0
5 6 7
NW N Final Freeman Code Output
0 , 0, 6, 6,
NE
W * E
SW S
SE
BOUNDARY TRACKING PROCEDURES

Input
Image
0 000 110
0
0 111
0
0 1110 110
0 1 11 0 000
0 0000

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6, 6,
BOUNDARY TRACKING PROCEDURES

Input
Image
0 000 110
0
0 111
0
0 1110 110
0 1 11 0 000
0 0000

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6, 6, 4,
BOUNDARY TRACKING PROCEDURES

Input
Image
0 000 111
0
0 111
0
0 1110 111
0 11 1 0 000
0 0000

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6, 6, 4,
BOUNDARY TRACKING PROCEDURES

Input
Image
0 000 111
0
0 111
0
0 1110 111
0 11 1 0 000
0 0000

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6, 6, 4, 4,
BOUNDARY TRACKING PROCEDURES

Input
Image
0000 011
0
0111
0
01110 011
011 1 0 000
00000

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6, 6, 4, 4,
BOUNDARY TRACKING PROCEDURES

Input
Image
0000 011
0
0111
0
01110 011
011 1 0 000
00000

Freeman
Code
5 6 7
NW N NE
3 2 1 W * E
4 * 0 SW S SE
Final
Freeman
Code Output
0 , 0, 6, 6, 4, 4, 2,
BOUNDARY TRACKING PROCEDURES

Input
Image
0000 011
0
0111
0
011 1 0 011
0111 011
0
0000
0

Freeman
Code
3 2 1 4 * 0
5 6 7
NW N Final Freeman Code Output
0 , 0, 6, 6, 4, 4, 2,
NE
W * E
SW S
SE
BOUNDARY TRACKING PROCEDURES

Input
Image
0000 011
0
0111
0
011 1 0 011
0111 011
0
0000
0

Freeman
Code
3 2 1 4 * 0
5 6 7
NW N Final Freeman Code Output
0 , 0, 6, 6, 4, 4, 2, 2
NE
W * E
SW S
SE
BOUNDARY TRACKING PROCEDURES

Input Chain Code


Image
0000
0 0 , 0, 6, 6, 4, 4, 2,
0 11 10 2
011 10 Boundary point sequence
0 11 10 (1,1) → (1,2) → (1,3) → (2,3) → (3,3) → (3,2) → (3,1) → (2,1) → back to
00000 (1,1)

Freeman
Code
NW N NE
3 2 1 W * E
4 * 0 SW S SE
5 6 7
BOUNDARY TRACKING PROCEDURES

Why Boundary Tracking?


• Instead of storing all pixels, we just store the sequence of
boundary pixels, which is much more compact and
meaningful.

Why Chain Code?


• to provide a compact, analyzable, and reconstructable
representation of object boundaries that is useful in shape
analysis, recognition, compression, and computer vision
applications.
BOUNDARY DESCRIPTORS

 Boundary descriptors are numerical or symbolic


features that describe the shape of an object’s boundary
(contour) in an image.
 They allow a computer to compare, analyze, and
recognize shapes efficiently.

Types
 Boundary Length (Perimeter)
 Fourier Descriptors
 Chain Codes
BOUNDARY TRACKING PROCEDURES

Input Chain Code


Image
0000
0 0 , 0, 6, 6, 4, 4, 2,
0 11 10 2
011 10 Boundary point sequence
0 11 10 (1,1) → (1,2) → (1,3) → (2,3) → (3,3) → (3,2) → (3,1) → (2,1) → back to
00000 (1,1)

Freeman
Code
NW N NE
3 2 1 W * E
4 * 0 SW S SE
5 6 7
BOUNDARY DESCRIPTORS

 Boundary descriptors are numerical or symbolic


features that describe the shape of an object’s boundary
(contour) in an image.
 They allow a computer to compare, analyze, and
recognize shapes efficiently.

Types
 Boundary Length (Perimeter)
 Fourier Descriptors
 Chain Codes
BOUNDARY LENGTH MEASURES

•Boundary length = the total length of the outline


(perimeter) of an object in a binary image.
•It is one of the simplest ways to describe a shape.

How it is calculated:
Count Boundary Pixels
Connectivity Adjustment (For 4-connectivity: each step is 1 unit)
(For 8-connectivity: each step is 1 unit for Hoz/Vert
√2 units for Diagonal
BOUNDARY LENGTH MEASURES
Example-1
4 Connectivity
Input Image Walk around the boundary clockwise
0000 From (1,1) → go right → (1,2), (1,3)
0 Go down → (2,3), (3,3)
0111 Go left → (3,2), (3,1)
0 Go up → (2,1), back to (1,1)
0111 Step counting (Edges, not pixels)
0 Top edge : 3 steps (between top boundaryls
0111 pixe Right edge : 3 steps (downwards)
0 along right side) Bottom edge : 3 steps
0000 (moving left along bottom side) Left edge
0 : 3 steps (upwards along left side)

So total = 3 + 3 + 3 + 3 = 12
BOUNDARY LENGTH MEASURES
Example-1
8 Connectivity
Input Image Walk around the boundary clockwise
0000 From (1,1) → go right → (1,2), (1,3)
0 Go down → (2,3), (3,3)
0111 Go left → (3,2), (3,1)
0 Go up → (2,1), back to (1,1)
0111 Step counting (Edges, not pixels)
0 Top edge : 3 steps (between top boundaryls
0111 pixe Right edge : 3 steps (downwards)
0 along right side) Bottom edge : 3 steps
0000 (moving left along bottom side) Left edge
0 : 3 steps (upwards along left side)

So total = 3 + 3 + 3 + 3 = 12
BOUNDARY LENGTH MEASURES
Example-2
4 Connectivity
Input Image Walk around the boundary clockwise
0000 (1,1)
0 B (2,2)
0100
C (3,3)
0
0010
0
0001
0
0000
0

A
A(1,1) → Right (2,2 → 2,3) , Down (2,3 → 3,3)
B(2,2). Distance = 2 units.
To reach
B, we
must So total = 2 + 2 = 4 Units
step:
Right
(1,1 →
1,2) ,
Down
(1,2 →
2,2)
Distance
=2
units.

B(2,2) →
C(3,3).
To reach
B, we
must
step:
BOUNDARY LENGTH MEASURES
Example-2
8 Connectivity
Input Image Walk around the boundary clockwise
0000 (1,1)
0 B (2,2)
0100
C (3,3)
0
0010
0
0001
0
0000
0

A
A to B
A(1,1) →
B(2,2) =
one So total = √2 + √2 = 2√2 ≈ 2.82 units.
diagonal
step.
Length
of
diagonal
= √2 ≈
1.41.

B to C
B(2,2) →
C(3,3) =
one
diagonal
step.
Length =
√2 ≈
1.41.
BOUNDARY LENGTH MEASURES
Example-2
8 Connectivity
Input Image Walk around the boundary clockwise
0000 (1,1)
0 B (2,2)
0100
C (3,3)
0
0010
0
0001
0
0000
0

A
A to B
A(1,1) →
B(2,2) =
one So total = √2 + √2 = 2√2 ≈ 2.82 units.
diagonal
step.
Length
of
diagonal
= √2 ≈
1.41.

B to C
B(2,2) →
C(3,3) =
one
diagonal
step.
Length =
√2 ≈
1.41.
BOUNDARY DESCRIPTORS

Why?
 To measure object size and shape complexity.

 Helps compare shapes:


• A circle and a square with same area will have
different boundary lengths.

 Used in shape recognition and region compactness


analysis.
CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape Region-based


Analysis Shape Analysis Analysis Shape
Analysis

Connectedness Boundary Tracking Active Contours ReRgeigoinonDDese


Labeling C Procedures csrcipritpotrosrs
Counting Size Boundary CMenotmroeidnatsl
Moments
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Occlusion Handling
CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape Region-based


Analysis Shape Analysis Analysis Shape
Analysis

Connectedness Boundary Tracking Active Contours ReRgeigoinonDDese


Labeling C Procedures csrcipritpotrosrs
Counting Size Boundary CMenotmroeidnatsl
Moments
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Occlusion Handling
FOURIER DESCRIPTORS

 Fourier descriptors (FDs) are a way to describe the shape


of an object's boundary in a way that's robust to changes
in position, size, and rotation.
 It works by treating the object's boundary as a signal and
applying the Fourier transform.
 Imagine a shape's boundary, like the outline of a hand.
FOURIER DESCRIPTORS

 Fourier descriptors (FDs) are a way to describe the shape


of an object's boundary in a way that's robust to changes
in position, size, and rotation.
 It works by treating the object's boundary as a signal and
applying the Fourier transform.
 Imagine a shape's boundary, like the outline of a hand.
FOURIER DESCRIPTORS

Step
s  Find the Boundary pixels
 Get the Boundary Coordinates
 Convert to a Complex Number Sequence
 Apply the Discrete Fourier Transform
FOURIER DESCRIPTORS

Input Bound. Pixels Bound. Co- Comp Num Seq


Image ord (1,1) → 1 + j1
00000 00000 (1, 1) (2,1) → 2 + j1
01110 01110 (1, 2) (3,1) → 3 + j1
(1, 3) (3,2) → 3 + j2
01110 01110
(2, 3) (3,3) → 3 + j3
01110 01110 (3, 3) (2,3) → 2 + j3
00000 00000 (3, 2) (1,3) → 1 + j3
(3, 1) (1,2) → 1 + j2
(2, 1)
FOURIER DESCRIPTORS

Input Bound. Pixels Bound. Co- Comp Num Seq


Image ord (1,1) → 1 + j1
00000 00000 (1, 1) (2,1) → 2 + j1
01110 01110 (1, 2) (3,1) → 3 + j1
(1, 3) (3,2) → 3 + j2
01110 01110
(2, 3) (3,3) → 3 + j3
01110 01110 (3, 3) (2,3) → 2 + j3
00000 00000 (3, 2) (1,3) → 1 + j3
(3, 1) (1,2) → 1 + j2
(2, 1)

Why Complex Numbers?


FOURIER DESCRIPTORS

Input Bound. Pixels Bound. Co- Comp Num Seq


Image ord (1,1) → 1 + j1
00000 00000 (1, 1) (2,1) → 2 + j1
01110 01110 (1, 2) (3,1) → 3 + j1
(1, 3) (3,2) → 3 + j2
01110 01110
(2, 3) (3,3) → 3 + j3
01110 01110 (3, 3) (2,3) → 2 + j3
00000 00000 (3, 2) (1,3) → 1 + j3
(3, 1) (1,2) → 1 + j2
(2, 1)

Why Complex Numbers?


Complex numbers are used in Fourier descriptors because they let us treat 2D boundary
coordinates as a single signal, making Fourier analysis simple and allowing easy handling of
translation, scaling, and rotation.
FOURIER DESCRIPTORS

Input Bound. Pixels Bound. Co- Comp Num Seq


Image ord (1,1) → 1 + j1
00000 00000 (1, 1) (2,1) → 2 + j1
01110 01110 (1, 2) (3,1) → 3 + j1
(1, 3) (3,2) → 3 + j2
01110 01110
(2, 3) (3,3) → 3 + j3
01110 01110 (3, 3) (2,3) → 2 + j3
00000 00000 (3, 2) (1,3) → 1 + j3
(3, 1) (1,2) → 1 + j2
(2, 1)
FOURIER DESCRIPTORS
FOURIER DESCRIPTORS
FOURIER DESCRIPTORS

So the first Fourier descriptor gives us the centroid of the shape (2,2).
FOURIER DESCRIPTORS

For u = 0 : centroid of the shape

(2,2) For u = 1, 2, 3… 7
FOURIER DESCRIPTORS
FOURIER DESCRIPTORS
FOURIER DESCRIPTORS
FOURIER DESCRIPTORS

Boundary → Frequency Space


 The sequence of boundary points (shape outline) is converted into
a set of frequency components.
 Low frequencies = overall coarse shape.
 High frequencies = fine details (corners, noise).

Shape Simplification
 You don’t need all frequencies.
 Just keep the first few descriptors (say 4–10) → this gives a smooth,
noise-free
approximation of the shape.
CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape


Region-based
Analysis Shape Analysis Analysis
Shape
Analysis

Connectedness Boundary Tracking Active Contours ReRgeigoinonDDese


Labeling C Procedures csrcipritpotrosrs
Counting Size Boundary CMenotmroeidnatsl
Moments
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Static Dynamic Occlusion Handling


DEFORMABLE SHAPE ANALYSIS

Definition
• It is the study of shapes that can bend, stretch, or change
slightly, while still being recognized as the same object.

• It looks at the geometry and structure of an object even when it is:


 Rotated
 Stretched or compressed
 Bent or curved
 Slightly deformed (like handwriting differences or flexible
objects)
DEFORMABLE SHAPE ANALYSIS – Why?

•In the real world, objects rarely look exactly the same every time.
•For example:
•Handwritten letters → every person writes “A” differently.
•Human body → people move, bend, and change poses.
•Medical images → organs may shift or deform but are still the same
organ.
•Deformable shape analysis helps us recognize these as the
same class of object.

•Active Contours
ACTIVE CONTOUR

 An Active Contour, also called a Snake, is a flexible curve


that moves across an image to find object boundaries.
 It is defined by a set of points (control points).
 The curve “snaps” onto edges in the image by balancing:
 Internal forces (keep it smooth and continuous).
 External forces (pull it toward object edges).
ACTIVE CONTOUR – Working Prnciple

Step 1: Initialization
• Place an initial curve (circle, rectangle, or manual outline) near the
object.
Step 2: Forces Acting on the Snake
• Internal energy: keeps the snake smooth, resists stretching.
• Like tension in a rubber band.
• External energy: pulls snake toward strong edges, lines, or corners.
• Derived from image features (e.g., gradient magnitude).
Step 3: Iteration
• The snake moves step by step:
• If a point is far from an edge → pulled outward until it reaches one.
• If a point hits noise → internal energy keeps it smooth.
Step 4: Convergence
• The snake stops moving when forces balance → it “locks” onto the
boundary.
ACTIVE CONTOUR – Working Prnciple

Example 1:

•Draw a rough circle around the coin.


•Run active contour:
• Points of the circle get attracted to the coin’s edges (bright-to-dark
transition).
• The circle deforms into the coin’s exact outline.
•Result = a smooth closed curve exactly around the coin.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Initialization (Start the Snake)


Place an initial contour (curve) around the object.
For example: a rough circle or rectangle around the blob of 1s.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Forces Acting on the Snake


External Force (from image edges):
The boundary between 0 and 1 has strong gradient (edge).
This pulls the snake toward the border of the rectangle.
Internal Force (from the snake itself):
Keeps the contour smooth and prevents it from collapsing
inward or forming jagged shapes.
.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Forces Acting on the Snake


External Force (from image edges):
The boundary between 0 and 1 has strong gradient (edge).
This pulls the snake toward the border of the rectangle.
Internal Force (from the snake itself):
Keeps the contour smooth and prevents it from collapsing
inward or forming jagged shapes.
.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Forces Acting on the Snake


External Force (from image edges):
The boundary between 0 and 1 has strong gradient (edge).
This pulls the snake toward the border of the rectangle.
Internal Force (from the snake itself):
Keeps the contour smooth and prevents it from collapsing
inward or forming jagged shapes.
.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Forces Acting on the Snake


External Force (from image edges):
The boundary between 0 and 1 has strong gradient (edge).
This pulls the snake toward the border of the rectangle.
Internal Force (from the snake itself):
Keeps the contour smooth and prevents it from collapsing
inward or forming jagged shapes.
.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Forces Acting on the Snake


External Force (from image edges):
The boundary between 0 and 1 has strong gradient (edge).
This pulls the snake toward the border of the rectangle.
Internal Force (from the snake itself):
Keeps the contour smooth and prevents it from collapsing
inward or forming jagged shapes.
.
ACTIVE CONTOUR – Working Prnciple

Numerical Example :
0000000
0111110
0111110
0111110
0000000

Forces Acting on the Snake


External Force (from image edges):
The boundary between 0 and 1 has strong gradient (edge).
This pulls the snake toward the border of the rectangle.
Internal Force (from the snake itself):
Keeps the contour smooth and prevents it from collapsing
inward or forming jagged shapes.
.
ACTIVE CONTOUR – Working Prnciple

Snake = just a set of points (control points) connected as a curve.


External force = “go to edges of object.”
Internal force = “stay smooth and balanced with neighbors.”
Together = smooth closed contour that fits object boundary.
.
CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape Region-based


Analysis Shape Analysis Analysis Shape
Analysis

Connectedness Boundary Tracking Active Contours ReRgeigoinonDDese


Labeling C Procedures csrcipritpotrosrs
Counting Size Boundary CMenotmroeidnatsl
Moments
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Occlusion Handling
REGION DESCRIPTORS

 They are numerical features.


 These features summarize the properties of a region or a
segmented object in an image.
 They give a compact and quantitative way to describe a shape.
 The description includes size, location, and overall form.
 Boundary descriptors like chain codes or Fourier descriptors
focus only on the perimeter.
 Region descriptors use all the pixels inside the object’s area.
REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.
REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

Boundary related values : Boundary Descriptor


REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

Boundary related values : Boundary Descriptor

Region related values : Region Descriptor


REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

 Area (Number of Pixels):


 Centroid Profiles
 Moments
REGION DESCRIPTORS - AREA

Input Image
00000
01110
01110
01110
00000

 This is the simplest region descriptor.


 You simply count the number of "1" pixels within the object's region.
 In this example, the area is G.
REGION DESCRIPTORS - AREA

Input Input Image2


Image1
0000000
00000 0011000
01110 0011000
01110 0011000
01110 0000000
00000 0000000

area is G area = 6
REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

 Area (Number of Pixels):


 Centroid Profiles
 Moments
REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

 Area (Number of Pixels):


 Centroid Profiles
 Moments
REGION DESCRIPTORS - CENTROID

Input Image
00000
01110
01110
01110
00000

 The centroid is a pair of coordinates that represents the


geometric center of the region.
 For this symmetrical 5x5 square, the centroid is at coordinates (2,
2).
REGION DESCRIPTORS - CENTROID

Input Image
00000
01110
01110
01110
00000

 The centroid is a pair of coordinates that represents the


geometric center of the region.
 For this 3x3 square inside 5x5 matrix, the centroid is at coordinates (2,
2).
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image
00000
01110
01110
01110
00000

 The centroid profile is a that measures distances from the centroid


to the
object’s boundary
 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image

00000
01110
01110
01110
00000

 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image

00000
01110
01110
01110
00000

 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image

00000
01110
01110
01110
00000

 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image

00000
01110 To top boundary = 1
pixel, To bottom
01110 boundary = 1 pixel, To
left boundary = 1 pixel,
01110 To right boundary = 1
00000 pixel,

 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image

00000
01110 To top boundary = 1
pixel, To bottom
01110 boundary = 1 pixel, To
left boundary = 1 pixel,
01110 To right boundary = 1
00000 pixel, Along diagonals
= √2

 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
PROFILES
Input Image

00000 Center = (2,2)

01110 To top boundary = 1


pixel, To bottom
01110 boundary = 1 pixel, To
left boundary = 1 pixel,
01110 To right boundary = 1
00000 pixel, Along diagonals
= √2

 Find top, bottom, left, right, and diagonal distance from centroid
REGION DESCRIPTORS - CENTROID
Input
PROFILES
Input Image2
Image1
0001000
00000 0011100
01110 0111110
01110 1 1 11 1 1 1
01110 0111110
00000 0011100
0001000

Center = (2,2) Center = (3,3)


Up = 1 Up = 3
Down = 1 Down = 3
Left = 1 Left = 3
Right = 1 Right = 3
Diagonals = √2 Diagonals = 3
Centroid profile = {1, 1, 1, 1, √2, √2, Centroid profile = {3, 3, 3, 3, √2, √2, √2, √2}
√2, √2}
REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

 Area (Number of Pixels):


 Centroid
Profiles
 Moments
REGION DESCRIPTORS

 They are numerical features.


 The description includes size, location, and overall form.

 Area (Number of Pixels):


 Centroid Profiles
 Moment
s
REGION DESCRIPTORS - MOMENTS

 A moment is a weighted average of an image's pixel intensities.


 It's a fundamental concept used to derive various properties
of objects in an image after they've been segmented, like
their area, centroid.
REGION DESCRIPTORS - MOMENTS

 A moment is a weighted average of an image's pixel intensities.


 It's a fundamental concept used to derive various properties
of objects in an image after they've been segmented, like
their area, centroid.

Input Image 1 Input Image 2


00000 00110
01110 01000
01110 1010 0
01110 01110
00000 00000
CONTENTS
SHAPES s REGIONS

Binary Shape Boundary-based Deformable Shape Region-based


Analysis Shape Analysis Analysis Shape
Analysis

Connectedness Boundary Tracking Active Contours ReRgeigoinonDDese


Labeling C Procedures csrcipritpotrosrs
Counting Size Boundary CMenotmroeidnatsl
Moments
Filtering Distance Descriptors
Functions Boundary Length
Skeletons C Advanced Shape
Chain Codes
Models
Fourier Descriptors

Occlusion Handling
SHAPE MODELS AND SHAPE RECOGNITION

 . Shape Models
 A shape model is a way to mathematically or structurally
represent the shape of an object so that it can be stored,
analyzed, or compared.
 • Think of it like a blueprint of a shape.
 • Instead of keeping all the pixels of an object, we store
only the important information about its geometry.
SHAPE MODELS AND SHAPE RECOGNITION

 Common Shape Models:


Boundary-based models – describe only the outline of the shape.
 Example: Chain codes, Fourier descriptors.
Region-based models – describe the entire filled-in region.
 Example: Moments, area, centroid.
Deformable models – flexible models that can change to fit
different variations.
 Example: Active contours (snakes), shape templates.
SHAPE MODELS AND SHAPE RECOGNITION

Common Shape Models:


Boundary-based models – describe only the outline of the shape.
 Example: Chain codes, Fourier descriptors.
Region-based models – describe the entire filled-in region.
 Example: Moments, area, centroid.
Deformable models – flexible models that can change to fit
different variations.
 Example: Active contours (snakes), shape templates.
SHAPE MODELS AND SHAPE RECOGNITION

Shape Recognition:
Once shapes are modeled, the next step is recognition →
identifying what the shape is.
How it works:
1. Feature Extraction – Extract important features from the
shape (like boundary length, chain codes, Fourier descriptors,
moments).
2. Matching – Compare these features with stored
models in the database.
3. Classification – Decide which known shape the object
is most similar to.
SHAPE MODELS AND SHAPE RECOGNITION

Shape Models give us structured ways to describe shapes.


Shape Recognition uses those models to identify and classify
shapes in images
SHAPE MODELS AND SHAPE RECOGNITION

Shape Models give us structured ways to describe shapes.


Shape Recognition uses those models to identify and classify
shapes in images

Input Image
00000
01110
01110
01110
00000
SHAPE MODELS AND SHAPE RECOGNITION

Input Image
Shape Model (Feature Extraction)
00000
Now, instead of storing all 25 pixel values, we extract
shape features: 01110
1.Area = number of "1"s = 9 pixels 01110
2. Perimeter (Boundary length) = 12 units (from tracing 01110
boundary) 00000
3. Centroid (Center point) = (2,2)
4. Chain Code (Clockwise boundary walk): 0,0,1,1,2,2,3,3

Shape Recognition (Identify/Classify)


Now, we compare this feature set with a database of
known shapes:
If Area = 9, Perimeter = 12, Shape = Square → Match found
The system recognizes it as a Square.
Output: “Shape = Square”
SHAPE MODELS AND SHAPE RECOGNITION

Input Shape (5×5 binary matrix)


Shape Model (Area=9, Perimeter=12, Chain Code=…)
Shape Recognition → Classified as “Square”

You might also like