Presentation on theme: "Binary Image Algorithm. What is an Object? What is an object? – Binary image Connected cluster of black pixels on a white background Connected cluster."— Presentation transcript:
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
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
Loss less Processing Nothing is removed or ignored No iteration, approximation No floating point arithmetic 4
Cell Decomposition Object is represented by – List of pair of numbers Pixel is square – Instead of a point 5
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
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.
Binary Images ASSUMPTION: Binary images are analyzed as if they have black objects on white background Background Objects
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.
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.
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
The Procedure to Add a Pixel Stage 1-4 Stage 5 Stage 7Stage 8 Stage 6 Stage 9 Add 4 vertexAdd 4 EdgesAdd Pixel
Example 1 This object has one 0-cycle A one 1-cycle B Incremental addition of pixels will able to recognize the 2 cycles
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
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
Pseudo Code AddVertex with vertex V IF the edge = vertex V is active THEN RETURN ENDIF Call AddCycle with edge = vertex V
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
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 --
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
The output of the algorithm Traversing a cycle.