Download presentation
Presentation is loading. Please wait.
Published byAlexander Gill Modified over 11 years ago
1
Binary Image Algorithm
2
What is an Object? What is an object? – Binary image Connected cluster of black pixels on a white background Connected cluster of white pixels on a black background Objects can also have holes in them 2
3
Goals of Image Analysis Identify objects – Objects can have holes in them Find their locations Find their size If certain objects are small, it can be ignored. The decision to ignore any size object is taken by the user
4
Loss less Processing Nothing is removed or ignored No iteration, approximation No floating point arithmetic 4
5
Cell Decomposition Object is represented by – List of pair of numbers Pixel is square – Instead of a point 5
6
Definitions – A vertex is a 0-cell – An edge is a 1-cell Boundaries consists of 2 end-points as 0-cells – A pixel is a 2-cell Boundaries consists of 4 edges as 1-cell – A voxel is a 3-cell Boundaries consists of 6 faces as 2-cells 6
7
Cell Decomposition of an Image Two adjacent edges as 1-cells share a vertex, a 0-cell Two adjacent pixels as 2-cells share an edge, 1-cell Edge: 1-cell Vertex: 0-cell Edge: 1-cell The image is made of k-cells that are attached to each other along (k-1) cells.
8
Binary Images ASSUMPTION: Binary images are analyzed as if they have black objects on white background Background Objects
9
Cycles 0-cycles represent objects or connected components of the image – Traversed clockwise 1-cycles represents holes – Traversed counterclockwise Image Its topological features are represented as cycles. Here A and B are 0-cycles, C and C are 1-cycles.
10
Partition A partition is a collection of non-overlapping regions – Connected set of black pixels – Connected set of white pixels The partition is achieved by finding boundaries of these regions as 0-cycles and 1- cycles.
11
Algorithm to Detect Cycles Incremental One pixel at a time are added to the image The process of adding a pixel starts with adding its vertices and then its edges
12
The Procedure to Add a Pixel Stage 1-4 Stage 5 Stage 7Stage 8 Stage 6 Stage 9 Add 4 vertexAdd 4 EdgesAdd Pixel
13
Example 1 This object has one 0-cycle A one 1-cycle B Incremental addition of pixels will able to recognize the 2 cycles
14
Example 1: Add Pixel 1 and 2 Add Pixel 1 Add 4 vertex Add 4 edges Add 1 cycle 9 Steps 1 Add Pixel 2 Add 2 vertex Add 3 edges Add 1 cycle 6 Steps 12
15
Example 1: Add Pixel 3 and 4 Add Pixel 3 Add 2 vertex Add 3 edges Add 1 cycle 6 Steps 123 Add Pixel 4 Add 2 vertex Add 3 edges Add 1 cycle 6 Steps 123 4
16
Example 1: Add Pixel 5 and 6 Add Pixel 5 Add 2 vertex Add 3 edges Add 1 cycle 6 Steps 123 45 Add Pixel 6 Add 2 vertex Add 3 edges Add 1 cycle 6 Steps 123 45 6
17
Example 1: Add Pixel 7 and 8 Add Pixel 7 Add 1 vertex Add 3 edges Add 1 cycle 5 Steps Add Pixel 8 Add 1 vertex Add 2 edges Add 1 cycle 4 Steps 123 45 67 B 123 45 67 B 8 Cycle A is complete Cycle B is complete
18
Example 2
19
Example 2: Answer
20
Pseudo Code Image Analysis with binary image I FOR all pixels in I IF pixel P in I is black THEN CALL AddCell with pixel P END IF END FOR
21
Pseudo Code AddCell with pixel P CALL AddVertex with the upper right of pixel P CALL AddVertex with the upper left of pixel P CALL AddVertex with the lower right of pixel P CALL AddVertex with the lower left of pixel P CALL AddEdge with the lower edge of pixel P CALL AddEdge with the right edge of pixel P CALL AddEdge with the upper edge of pixel P CALL AddEdge with the left edge of pixel P CALL RemoveCycle with the 1-cycle that starts at any of these 8 edges that goes counterclockwise
22
Pseudo Code AddVertex with vertex V IF the edge = vertex V is active THEN RETURN ENDIF Call AddCycle with edge = vertex V
23
Pseudo Code AddEdge with edge E IF edge E is active THEN RETURN END IF CALL StepForward with edge E RETURNING temporary edge E1 Find the cycle determined by temporary edge E1, A CALL StepForward with the opposite of the edge RETURNING temporary edge E2 Find the cycle determined by temporary edge E2, B IF A == B THEN CALL SplitCycle with edges E1, E2, and cycle A ELSE CALL MergeCycles with edge E1 and cycles A, B END IF
24
Pseudo Code MergeCycles with cycles A, B and edge E CALL CreateCycle with edge E RETURNING a new 0-cycle C Add links from A and B to C in the graph 0-Betti --
25
Pseudo Code SplitCycle with edge E and cycle A IF A is a 1-cycle THEN CALL CreateCycle with edge E1 RETURNING a new 0-cycle C CALL CreateCycle with edge E2 RETURNING a new 0-cycle D END IF IF A is a 0-cycle THEN CALL CreateCycle with edge E1 RETURNING a new 0-cycle C CALL CreateCycle with edge E2 RETURNING a new 1-cycle D END IF 1-Betti number ++ Add links from A to C and D in the graph
26
The output of the algorithm Traversing a cycle.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.