This page is a part of CVprimer.com, a wiki devoted to computer vision. It focuses on low level computer vision, digital image analysis, and applications. It is designed as an online textbook but the exposition is informal. It geared towards software developers, especially beginners, and CS students. The wiki contains mathematics, algorithms, code examples, source code, compiled software, and some discussion. If you have any questions or suggestions, please contact me directly.

# Cycles

The image.
Its topological features are represented as cycles. Here A and B are 0-cycles, C and C’ are 1-cycles.

Our interest is 2D images only. As a result, we will have to deal with only objects and their holes. Recall,

Binary images are analyzed as if they have black objects on white background.

Both objects (components) and holes are captured by cycles. By a cycle, we will understand a circular sequence of edges. There are 0- and 1-cycles:

• A 0-cycle follows the outer boundary of an object (like a rubber band),
• A 1-cycle follows the outer boundary of a hole.

This results in a natural and unambiguous representation of the regions by the curves that enclose them.

• A 0-cycle is traversed clockwise.
• A 1-cycle is traversed counterclockwise.

Observe that in the either case black is on the right.

Note: The name “1-cycle” is justified by the fact that this is a sequence of edges or 1-cells. But so is a 0-cycle. How come? The representation is only a matter of convenience. A 0-cycle can just as easily be represented as a sequence of 0-cells.

Of course, 1-cycles of the picture are 0-cycles of its negative and vice versa, except for ones that touch the border of the image.

Given an image, any cycle can be traversed by taking left turns from the initial edge in such a way that black pixels are always on the right - until this edge is reached again. (This does not work in 3D, at all.)

Exercise. Follow the above idea to come up with an economical way of capturing cycles.

The result of this topological analysis is a partition of the binary image. The partition is a collection of non-overlapping regions, connected sets of black pixels and connected sets of white pixels, that covers the whole image. The partition is achieved by finding boundaries of these regions as 0- and 1-cycles. These cycles are closed curves made of vertical and horizontal edges of pixels.

Note: Even though geometrically by a cycle we understand a circular sequence of edges, algebraically the sum of two cycles is also a cycle. This point of view is crucial in homology theory.

Pixcavator's image analysis is based on cycles representation. Download the free Pixcavator Student Edition here.