1 Introduction
Image analysis deals with digital images as input to pattern recognition systems with the purpose to extract information about their content, usually objects. Objects appear in images affected by transformations (e.g. rotation, zoom, projection) and noise. Topological features have the ability to ignore changes in the geometry of objects by extracting object properties invariant to elastic transformations. Simple topological features are for example the number of connected components, the number of holes, etc., while more refined ones, like homology and cohomology, characterize holes and their relations.
An example application of topological features is topology simplification, an active field in geometric modeling and medical imaging where highresolution surfaces are created through isosurface extraction from volumetric representations, obtained by 3D photography, CT, or MRI. Isosurfaces often contain many topological errors in the form of tiny handles. These nearly invisible artifacts hinder subsequent operations like mesh simplification, remeshing, and parametrization. See, for example WHDS04 . Another application is shape description and matching, where persistence and homology of a function defined on a shape have been successfully applied to extract shape features Allili2007 .
A 2D image is the result of projecting a 3D scene into the image plane. Often the precise camera parameters are not known and still humans have no problem in correctly interpreting the displayed objects in the image. A 3D object is surrounded by a reflecting surface which itself may split into several smaller but connected patches which can be characterized by their color, their texture or other visual properties. The visible part of the object’s surface maps into a region of the image which shows the same adjacencies of patches as the original surface (because the camera sees the same side of the surface) although the geometry of the patches may change due to projection, due to camera or object movement or due to deformations of the object. Sometimes a collection of patches is completely surrounded by some other surface patches, e.g. a fancy soccer ball on a Spanish Tshirt (see Fig. 1). Although both the picture of the ball as well as the Tshirt may have a specific patch structure (stripes on shoulder and arms, logo) it is clear which subset of regions forms the ball and which regions belong to the remaining Tshirt. A simplified version could describe the pixels of the Tshirt 1’s and the ball’s pixels by 0 (see Fig. 1). Then the ball is a hole in the Tshirt as long as the surrounding of the ball is visible and not occluded by other objects. It may be highly difficult to uniquely and reliably identify any of the involved small patches individually under difficult geometric deformations while the overall arrangement of patches forming the ball is mostly invariant to these geometric deformations. How to segment patches into meaningful aggregations has been dealt with in many other segmentation methods and it is not the main emphasis of this paper. We therefore restrict ourselves in the following on binary images with the understanding that each region may be the collection of several subregions belonging together.
Considering 2D binary images, an object is defined by a connected set (4connectivity) of foreground pixels. A region adjacency graph (RAG) encodes the adjacency of regions in a partition. The holes in a RAG associated to an object of a 2D binary digital image can be characterized by establishing an equivalence between all the cycles as follows: two cycles are equivalent if one can be obtained from the other by joining to it one or more degenerate cycles (cycles with exactly edges). For example, there is only one equivalence class for the foreground (gray pixels) of the digital image in Fig. 2, which represents the unique white hole. This is similar to considering the digital image as a cell complex^{1}^{1}1Intuitively a cell complex is defined by a set of cells (vertices) that bound a set of cells (edges), that bound a set of cells (faces), etc. Hatcher02a (see Fig. 2.c). Unfortunately digital images are not ‘clean’, noise can create many unwanted holes which complicate the correct interpretation. One can ask for the edges we have to delete in order to ‘destroy’ a hole. In the example in Fig. 2, it is not enough to delete only one edge. The deletion of the bold edges in Fig. 2.c together with the faces that they bound produces the ‘disappearing’ of the hole. The set of bold edges in Fig. 2.c define a cocycle, a topological invariant of the respective object. Equivalence classes of such cocycles are the elements of cohomology.
To cope with complexity issues that arise when highly complex algorithms must be applied to huge amounts of data, graph pyramids are used. These hierarchical data structures offer possibilities to reduce the amount of data by local operations which can be applied in parallel and which have the enormous advantage to preserve the topological properties of the data. Hence the search for independent cocycles can be correctly done on a fraction of the data at the top of the pyramid. The simplified geometry of these cocycles can then be delineated topdown through the levels of the pyramid by again local processes up to the high accuracy of the base level.
Maybe due to its more abstract nature, lacking a geometric meaning and due to its computation complexity, cohomology has not been yet widely applied to pattern recognition and image processing. This paper is possibly the first attempt to use it in the context of digital images. For this purpose, in this paper we consider the best known environment which are 2D images whereas nD is the ultimate goal. Concepts related to cohomology can have associated interpretations in graph theory. Having these interpretations opens the door for applying classical efficient graph theory algorithms to compute and manipulate these features. Besides, for objects embedded in
, homology– a wider used topological invariant, and cohomology groups are isomorphic. But the ring structure presented in cohomology characterizes the relations between holes (cohomology generators of dimension ), which homology does not. Indeed, dealing with homology and cohomology properties, representative cycles and cocycles, and their computation is quite different and doing this study in 2D gives important insights which should be relevant for extension to D, . Initial results regarding this work have been presented in GonzalezDiaz09a . The current paper extends our earlier publication with detailed insights and proofs, and a refinement of the previous method that makes the obtained cocycles scanning and rotation invariant in the case of an identical discretization.The paper is organized as follows: Sections 2 and 3 recall graph pyramids and cohomology, and make initial connections. In Section 4, preservingtopology properties in irregular graph pyramids are given. Section 5 presents the proposed method. Section 6 uses the properties of the proposed method to extend it and obtain scanning and rotation invariant cocycles. Section 7 concludes the paper.
2 Irregular Graph Pyramids
A graph (see for example Diestel97a
) is an ordered pair
comprising a set of vertices and a set of edges. Each edge is incident to two not necessarily distinct vertices , written as . An edge is said to be directed if the pair is an ordered pair. An edge is said to be a selfloop if . The edge is called a parallel edge iff s.t. . A graph is called undirected if none if its edges is directed, and it is called planar if it can be drawn in a plane with no edges crossing (vertices are drawn as points and edges as lines connecting their incident vertices). Given a graph removing an edge will result in the graph , contracting the edge implies removing it and identifying its incident vertices s.t any remaining edge previously incident to or is now incident to the unique vertex .Given a decomposition of an object or image into regions a region adjacency graph (RAG) is an undirected graph that encodes the adjacency of regions in a partition. A vertex is associated to each region, vertices of neighboring regions are connected by an undirected edge. Classical RAGs do not contain any selfloops or parallel edges. An extended region adjacency graph (eRAG) is a RAG that contains the socalled pseudo edges, which are selfloops and parallel edges used to encode neighborhood relations to a cell completely enclosed by one or more other cells K95 . The dual graph of an eRAG is called a boundary graph (BG) and is denoted by ( is said to be the primal graph of ). The edges of represent the boundaries (borders) of the regions encoded by , and the vertices of represent points where boundary segments meet. and are planar graphs. There is a onetoone correspondence between the edges of and the edges of , which induces a onetoone correspondence between the vertices of and the 2D cells (will be denoted by faces^{2}^{2}2Not to be confused with the vertices of the dual of a RAG (sometimes also denoted by the term faces).) of . The dual of is again . The following operations are equivalent: edge contraction in with edge removal in , and edge removal in with edge contraction in .
A (dual) irregular graph pyramid Kropatsch93 ; Willersinn94 ; K95 ; KHPL05 is a stack of successively reduced planar graphs . Each level , , is obtained by first contracting edges in (removal in ), if their end vertices have the same label (regions should be merged), and then removing edges in (contraction in ) to simplify the structure. The contracted and removed edges are said to be contracted or removed (sometimes called removal edges) in . In each and , contracted edges form trees called contraction kernels. One vertex of each contraction kernel is called a surviving vertex and is considered to have ‘survived’ to . The vertices of a contraction kernel in level form the reduction window of the respective surviving vertex in level . The receptive field of is the (connected) set of vertices from level that have been ‘merged’ to over levels . The equivalent contraction kernel (ECK) of a vertex is the tree obtained by replacing and all is descendants with their corresponding contraction kernels. The vertices of the ECK of form the receptive field of .
Algorithm 1 gives the main steps used to build a graph pyramid. In Line 5 the operations are performed on both graphs (adjacency and boundary) even if for simplicity only one of the graphs is mentioned in each step. Line 5.ii removes selfloops bounding an empty face in the adjacency graph. Line 5.iii simplifies the region boundaries in the boundary graph.
3 Homology, Cohomology and Integral Operators
We refer to Munkres for an introduction to homology and cohomology.
Intuitively, homology characterizes the holes of any dimension (i.e. connected components, 1dimensional holes, etc.) of an dimensional object. It defines the concept of generators which, for example for 2D objects are similar to closed paths of edges surrounding holes. More general, dimensional manifolds surrounding dimensional holes are generators Munkres , and define equivalence classes of holes. Cohomology arises from the algebraic dualization of the construction of homology. It manipulates groups of homomorphisms to define equivalence classes. Intuitively, cocycles (the invariants computed by cohomology), represent the sets of elements (e.g. edges) to be removed to destroy certain holes. See
Fig. 2.c for an example cocycle.
A homeomorphism is a bijective continuous function between two spaces, that has a continuous inverse function. They are the mappings which preserve all the topological properties of a given space. Two spaces with a homeomorphism between them are called homeomorphic, and from a topological viewpoint they are the same.
Two continuous functions from one topological space to another are called homotopic if one can be ‘continuously deformed’ into the other. Two spaces and are homotopy equivalent if there are maps and such that is homotopic to and is homotopic to . Observe that if two spaces are homeomorphic then they are homotopic. A homotopy invariant is a topological property which is invariant under homotopy.
A dimensional cell (or cell, for short) is a topological space that is homeomorphic to the dimensional ball . A cell is homeomorphic to a point, a cell to an arc and a cell to a disk. Roughly speaking, a cell (or CW) complex is built by gluing together the basic building blocks called cells.
3.1 Homology
The notion of chain is defined as a formal sum of cells. The chains are considered over coefficients i.e. a cell is either present in a chain (coefficient 1) or absent (coefficient 0)  any cell that appears twice vanishes. The set of chains form an abelian group called the chain group . This group is generated by all the cells. The boundary operator is a set of homomorphisms connecting two consecutive dimensions. By linearity, the boundary of any chain is defined as the formal sum of the boundaries of each cell that appears in the chain. The boundary of cells (i.e. points) is always . A chain complex is the set of all the chain groups connected by the boundary operator: .
A chain is called a cycle if . If for some chain then is called a boundary. Two cycles and are homologous if there exists a boundary such that . Denote the groups of cycles and boundaries by and respectively. For each , . In other words, all boundaries are cycles (). Define the homology group to be the quotient group , for all . Each element of is a class obtained by adding each boundary to a given cycle . Then is a representative cycle of the homology class .
Since the chains are considered over
coefficients, the chain groups are vector spaces and the boundary operators are linear operators. The cycle and and boundary groups are just the kernel and image of such operator. The homology group is a quotien space.
3.2 Cohomology
Cohomology groups are constructed by turning chain groups into groups of homomorphisms and boundary operators into their dual homomorphisms. Define a cochain as a homomorphism . We can see a cochain as a binary mask of the set of cells: imagine you order all cells in the complex. (let’s say we have cells, and call this ordered set ). Then a cochain is a binary mask of values in , where is the number of cells in the complex. When no confusion can arise, we will identify the cochain with the set of cells that are evaluated to by .
The cochains form the set which is a group. The boundary operator defines a dual set of homomorphisms, the coboundary operator , such that for any cochain . Since the coboundary operator runs in a direction opposite to the boundary operator, it raises the dimension. Its kernel is the group of cocycles and its image is the group of coboundaries. A cochain is a cocycle if is the null homomorphism. A cochain is a coboundary if there exists a cochain such that . Two cocycles and are cohomologous if there exists a coboundary such that . The cohomology group is defined as the quotient of cocycle modulo coboundary groups, , for all . Each element of is a class obtained by adding each coboundary to a given cocycle . Then is a representative cocycle of the cohomology class , denoted by .
Definition 3.1
A set of cocycles is a basis of representative cocycles if:

Any other cocycle can be written as a linear combination of the cocycles of the set plus a coboundary, that is:
where and is a cochain.

None of the cocycles in the set can be written as a linear combination of the rest plus a coboundary (minimality).
Remark 3.1
If is a basis of representative cocycles then is a basis of the cohomology group of the object. Each is a cohomology generator.
3.3 Integral Operator
Starting from a chain complex, , take a cell and a chain . An integral operator GJMMR08 is defined as the set of homomorphisms such that , if is a cell different to , and for all and any cell we have . It is extended to all chains by linearity.
An integral operator satisfies the chainhomotopy property iff for each . For satisfying the chainhomotopy property, define where is the identity. Define . Then, is a chain complex and is a chain equivalence Munkres . Its chainhomotopy inverse is the inclusion map . Integral operators satisfying the chainhomotopy property can be seen as a kind of inverse boundary operator: They raise the dimension and satisfy the nilpotent condition for all . Although, in general, and , what happens is for all (which would be equivalent to for ). Consider, for example, the cell complex in Fig. 6 on the left. The integral operator associated to the removal of the edge is given by . Then, , , ( is renamed as in ) and is the identity over the other cells of , . The removal of edge decreases the degree of vertex allowing for further simplification.
The following lemma guarantees the correctness of the down projection procedure for computing cocycles given in Section 5. Since graph pyramids offer possibilities to reduce the amount of data by local operations, then the search for independent cocycles can be done on the top of the pyramid. Hence, the following lemma guarantees that these cocycles can be correctly delineated topdown through the levels of the pyramid.
Lemma 3.2
Let be an integral operator satisfying the chainhomotopy property. The chain complexes and have isomorphic homology and cohomology groups. If is a representative cocycle of a cohomology generator, then is a representative cocycle of the same generator.
Proof. An integral operator that satisfies the chain homotopy property, is a chain homotopy of the identity to . Therefore, is a chain equivalence and chain equivalences induce isomorphisms on homology and cohomology (see Munkres ). ∎
For example, consider the cell complex of Fig. 6. The cochain , defined by the set of edges of , is a cocycle which ‘blocks’ the white hole
(in the sense that all the cycles representing the hole must contain an odd number of edges of
). Then is defined by the set of edges of . and are both cocycles representing the same white hole .4 Preserving Topology in Irregular Graph Pyramids
Considering binary images, an object is defined by a connected set (4connectivity) of foreground pixels. A partition of the whole space (foreground and background) in cells is called a cell subdivision. The referred partition could be obtained from any of the planar graphs in every level of the pyramid.
Fix a level , the cell complex associated to the foreground object, called boundary cell complex, denoted by , is obtained from by taking all faces of corresponding to vertices of , whose receptive fields contain (only) foreground pixels, and adding all edges and vertices needed to represent the faces. The chain group generated by the cells of is denoted by .
The following lemma guarantees that the local operations applied to build a graph pyramid preserve the topological properties of the initial data.
Lemma 4.1
The boundary cell complex is welldefined. All the boundary cell complexes of a given irregular dual graph pyramid are cell subdivisions of the same object. Therefore, all these cell complexes are homeomorphic.
Proof.
Our input is a binarized 2D digital image. An object is the
connected set of foreground pixels. Since we only remove an edge in when it is in the boundary of two different regions that have the same label (region merging), and contract an edge in when it is incident to a vertex of degree or it is a pendant edge (simplification), all the new cells created are homeomorphic to dimensional balls, . ∎As a result of Lemma 4.1, topological invariants computed on different levels of the pyramid are equivalent.
For the purpose of this paper, a new cell complex called homologygenerator level, is added over the boundary cell complex obtained from the top (last) level of the pyramid (see Fig. 8). This new cell complex is denoted by and it is a set of regions surrounded by a set of selfloops incident to a single vertex. To obtain this cell complex, on the top of the computed pyramid, we compute a spanning tree of the boundary graph of the top level of the pyramid, and contract all the edges that belong to it. Note that is no longer homeomorphic to any , but homotopic.
Lemma 4.2
The two operations used to construct an irregular graph pyramid: edge removal and edge contraction, are integral operators satisfying the chainhomotopy property.
Proof. Fix a level , suppose an edge in is removed. Since is planar, then is in the boundary of two cells (or regions) and (see Fig. 6). The integral operator associated to this edge removal is given by (see Fig. 7). Now, suppose that an edge of , with a vertex of degree in its boundary, is contracted (see Fig. 6). The integral operator associated to this edge contraction is given by (see Fig. 7). ∎
Starting from a cell decomposition of an object, its homology studies incidence relations of its subdivision. Cohomology arises from the algebraic dualization of the construction of homology. Both homology and cohomology are homotopy invariants.
Corollary 4.3
The boundary cell complex of any level of the pyramid and the homologygenerator level have isomorphic homology and cohomology groups.
Lemma 4.4
Fix a level , suppose an edge in , which is in the boundary of a region , is removed. Let be the integral operator associated to this removal. Let be a cocycle defined by a set of edges in . If an odd number of edges of is in , then defines a cocycle in ; otherwise, it is which defines a cocycle in .
In terms of embedded graphs, an integral operator maps a vertex/point to exactly one of its incident edges and an edge to exactly one of its incident faces. In every level of a graph pyramid, the contraction kernels make up a spanning forest. A forest composed of connected components, spanning a graph with vertices, has root vertices, other vertices, and also edges. These edges can be oriented toward the respective root such that each edge has a unique starting vertex. Then, integral operators mapping the starting vertices to the corresponding edge of the spanning forest can be defined as follows: , where is the edge incident to , oriented away from it.
The following lemma guarantees that all integral operators that create homeomorphisms are in fact a combination of the two operations used to construct irregular graph pyramids.
Lemma 4.5
All integral operators that create homeomorphisms can be represented in a dual graph pyramid. This is equivalent to: given an input image and its associated cell complex , a cell complex with homeomorphic, and a refinement of i.e. and , then there exists a pyramid s.t. is the cell complex associated to some level of .
5 Representative Cocycles in Irregular Graph Pyramids
A method for efficiently computing representative cycles of homology generators using an irregular graph pyramid is given in Peltier09a . In IIKG08 a novel algorithm for correctly visualizing graph pyramids, including multiple edges and selfloops is given. This algorithm preserves the geometry and the topology of the original image and has been used to produce the images throughout the paper (see Fig. 9)
In this paper, representative cocycles are computed and drawn in the boundary graph of any level of a given irregular graph pyramid. They are computed in the top level and down projected using the described process.
In the homologygenerator level (see Fig. 8.c), each selfloop that surrounds a region of the background (hole of a region of the foreground) is a representative cycle of a homology generator.
Let be the homologygenerator level. Without loss of generality, we can suppose that is connected. If not, repeat the following reasoning for each connected component (region) of . Let be the set of the selfloops surrounding a face of the background. Therefore, there are white holes: (see Fig. 8.d). Fix , , is a representative cycle of the homology generator associated to the white hole . Let be a selfloop surrounding the face of the foreground (recall that we suppose that is connected) such that is in the boundary of in . Form the sets . Let denote the boundary cell complex associated to the foreground in . Let be the composition of all integral operators associated with all removals and contractions of edges of the foreground of the boundary graphs of a given irregular graph pyramid. Let where is the inclusion map.
Proposition 5.1
The cochain defined by the set in is a cocycle. Moreover, the set is a basis of representative cocycles.
Proof. The set of edges of is the set of the selfloops surrounding a region of the background together with the selfloop , renamed by , surrounding the face .
The cochain is a cocycle in iff . Since we work with objects embedded in then can only be in the boundary of two faces. In this case, one face belongs to the background and the other face is in . Then .
Let us prove minimality. Suppose, for example, that where , . Then is defined by the set if even, and if odd, which is a contradiction. ∎
We will say that is a representative cocycle of the cohomology generator associated to the white hole .
Algorithm 2 gives the proposed method to downproject a cocycle from level to level . Informally, in the homologygenerator level, there is only one face representing the object. Based on the geometric interpretation of cocycles (Section 3), if we remove the edges and the face inbetween, we destroy the hole. Then, there is no need to add any other edge to the cocycle to remove the hole. However, when going down in the pyramid, this face is partitioned. A connection among all the new regions is determined by the contraction kernels of the RAG. When the first partitioning occurs, the contraction kernel will contain one or two nodes corresponding to faces with one surviving cocycle edge in its boundary, and the rest of the nodes will have none. What Algorithm 2 does is to find the unique path in the contraction kernel joining these two nodes, and take the set of boundary edges between consecutive faces as part of the new cocycle (see Prop. 6.2, 6.3, and their proofs). Lower levels will update the connections in subsections of the cocycle path. Every subsection will correspond to a partitioned region between two consecutive cocycle edges.
Consider the example in Fig. 8. In the homologygenerator level we have = the representative cocycle of a cohomology generator (selfloops in Fig. 8.d). For down projection in level , . We have that is the surviving edges in bold of top level in Fig. 8.e). In this case, because there is no merging of foreground regions from the boundary cell complex obtained from the top level to the homologygenerator level.
In the example in Fig. 10, the cocycle in level is the set of the two edges in bold (see Fig. 10, bottom row, column ). The down projection from level to are the surviving edges of the cocycle in level . This is because there was no contraction in the foreground region. The contractions of the adjacency graph can be seen in the top row of the figure.
In level (Fig. 10, bottom row, column ), the first contraction of foreground in the adjacency graph with a single edge appears. In this case, the leaf node represents a face with an even number () of surviving cocycle edges in its boundary, which leads to not adding any other edge to the downprojected cocycle. Only in the base level (column a), one contraction kernel has a leaf node with an odd number () of surviving cocycle edges in the boundary. In this case, the corresponding edge in the boundary graph, for the edge connecting the respective node with its father, is added to the cocycle.
Any edge that has survived to a higher level , and was selected as part of the cocycle in , will belong to the downprojected cocycle in . In particular, the edges in that have survived to be the edges of the cocycle in the homologygenerator level, are going to be the entry and exit point of the cocycle path through the foreground region.
In Fig. 11, the space between the outside boundary of the object and the hole is bigger, allowing for more possibilities for the paths of the cocycle. The cocycle path in the base is going to converge to the unique path connecting the surviving edges through the ECK (see Fig. 11.c).
In Fig. 11.d the cocycle is made of the surviving cocycle edges from the homologygenerator level in Fig. 11.b . The first partition of the foreground is connected by the contraction kernel in Fig. 11.e . Here, one of the regions in the partition contains in its boundary the two surviving cocycle edges, so there is no path to find and no new cocycle edge to add. In Fig. 11.f there is only one edge to add to the cocycle to connect the path of edges, which is identified with the leaf node with label 1.
Notice that from level Fig. 11.f to the one in Fig. 11.g also the selected ‘surviving’ edges play a role, as edges to be removed at higher levels had to have been ‘surviving’ ones at levels below. In this case, the edge we add to the cocycle in level (Fig. 11.f), was a surviving edge in level below that was connecting two contraction kernels. Therefore, the selection of the surviving edges also determine the delineation of the downprojected cocycle together with the contracted ones. The ECK contains the decision of which edges were contracted but also which ones were simplified, determining the unique path.
Proposition 5.2

The down projection of is a set of edges ‘blocking’ the creation of the hole , i.e., given a cycle homologous to the down projection of the cycle , the down projection of contains an odd number of edges of .

The down projection of is always a cocycle. Moreover, the down projection of is a basis of representative cocycles.
Proof.

The down projection of , which is , contains an odd number of edges of iff . First, if is homologous to the down projection of , which is , then there exists a chain in such that . Second, , since , and because is a cocycle and (since is a chain equivalence Munkres ). So must contain an odd number of edges of the set that defines .

Proof of correctness of the down projection algorithm: it is a consequence of Lemma 4.4. ∎
5.1 Complexity
Let be the height of the pyramid (number of levels) and the number of vertices, respectively edges in the base level, with (logarithmic height). An upper bound for the computation complexity is: to build the pyramid; for each foreground component, in the number of holes to choose the representative cocycles in the top level; to down project each cocycle. The overall computation complexity is then below , where is the number of cocycles that are computed and down projected.
Actually not all edges are part of cocycles and not all levels have number of edges. When building one can go in linear time over the edges of and consider only the contraction kernels in for which the surviving vertices in correspond to one of the two faces to which an edge of is incident to. Then, computing actually takes number of steps, where are the contraction kernels mentioned before. Thus in practice the complexity of down projecting a cocycle is below .
6 A First Step Towards Stable Cocycles
If topology is considered in the context of recognition, or a joint extraction of both topological and geometrical features is required, then the location and shape of the extracted topological invariants becomes relevant and is an important way to ensure stability/repeatability. A relevant example is the work in Dey2008 where handle and tunnel loops are made geometry aware by placing them on “geometrically relevant” positions.
In this section we make a first stept towards obtaining stable cocycles and consider invariance with respect to scanning and rotation of the object. Because we start with a pixel grid and the neighborhood,only rotations with multiple of degrees produce identical discretizations allowing for identical cocycles.
The following properties are required for Prop. 6.4 which gives the parts of the pyramid that the computed cocycles depend on.
Proposition 6.1
The downprojected cocycles contain only removal edges in the boundary graphs, corresponding to edges in the ECK of the top vertex representing the object in , and the two edges that have survived to and where selected as the cocycle .
Proof. Algorithm 2 starts with two edges in , and for each level it adds only removal edges from i.e. edges that where contracted in to merge neighboring regions belonging to the object. ∎
Proposition 6.2
The result of down projection (Algorithm 2) does not depend on the selected surviving vertices in .
Proof. Consider the function , (see Alg.2 for the used notation). Every cocycle has an even number of edges from the boundary of any face in (Section 3). Then is also even and the number of vertices for which is odd, is even. For any edge consider the two connected components (trees) of the subgraph ( is a cut edge of because is a tree). The removal edge of corresponding to the edge is added to the cocycle if and are even, which is independent of the originally chosen surviving vertex, the root of . ∎
Proposition 6.3
A downprojected cocycle does not depend on the order in which edges are removed in the boundary graphs (region merging).
Proof. Consider the proof of Prop. 6.2. What Algorithm 2 does is to select additional edges from the contraction kernel , to connect the vertices with odd . In a tree, there is a unique path connecting any two vertices. Denote by the ECK of the vertex in corresponding to the object. Algorithm 2 returns and , plus the set of edges of corresponding to the path in that connects the two vertices whose corresponding faces in have and in their boundary. The ECK of a vertex does not depend on the order of the intermediate steps Kropatsch97 . ∎
Proposition 6.4
The cocycles computed by Algorithm 2 depend only on the cocycle chosen in the top level, , and on the ECK of the vertex in corresponding to the face describing the object in .
The following property results from Prop. 6.4 and motivates the modification proposed in the rest of this section.
Proposition 6.5
If the ECK of the vertex representing the object in the adjacency graph of the homologygenerator level, and the edges that survive to be in the boundary of the corresponding face in the boundary graph, are scanning and rotation invariant, we will obtain scanning and rotation invariant cocycles.
In the following we will consider the necessary additions to the pyramid building process, to ensure that computed cocycles do not depend on the scanning and rotation of the object. We follow Prop. 6.5 and consider the ECK and the boundary edges of the top level.
6.1 Invariant ECK and surviving edges
As the edges to be removed in are ‘locally’ chosen, in a binary image like the ones used to represent our objects, there is no local structure and a random or scanning/orientation dependent direction is taken (Line 4 of Algorithm 1).
To ‘add structure’ and create an ordering for selecting edges to be removed and contracted:

Compute a spanning tree of the subgraph corresponding to our object in the base level. Mark the edges of corresponding to the edges of the spanning tree to be the removed ones.

Create a strict ordering between any two edges. This ordering is used to select surviving edges during simplification, and thus controls the choice of edges in the homologygenerator level.
The tree
Given the graph corresponding to our object, and a vertex , we define to be the number of edges of the shortest path connecting and in i.e. the geodesic distance between the two pixels corresponding to and , using the 4 neighborhood. Note that a vertex can be obtained in a rotation invariant manner for example by using an automatic shape orientation method ZunicKF06 and then selecting the top, leftmost vertex.
Stable ECK (in )
Every vertex , , labels the edge with as ‘to contract’. If has more than one neighbor with the neighbor that minimizes the angle , and in case of angle equality, the one that has a clockwise orientation of is chosen. , , and are the points in corresponding to the centers of the pixels represented by , , and . The edges in corresponding to the edges of labeled as ‘to contract’, are marked as ‘to remove’.
Region boundary simplification (in )
In Line 5.iii) of Algorithm 1, from any chain of edges bounded by at least one vertex of degree 2, one edge will survive and all others will be contracted. To choose to surviving edge, assign to each edge bounding a cell of the object, the value where , are the vertices of corresponding to the two faces of to which is incident to. Faces not part of the object are ignored. When choosing the edge to survive i.e. not contract, the edges are sorted using the following (transitive) relation between any two edges and :

vs. ;

if then use the orientation of vs. the orientation of , where are the centers of the edges and , and is the center of the pixel used to define the rotation invariant tree;

if are collinear, the Euclidean distance between and vs. the Euclidean distance between and .
Homologygenerator level
When building the homologygenerator level, all edges of bounding the face of the object are sorted based on the criteria above. Edges are selected in inverse order and used to create the spanning tree to be contracted. Edges not bounding the face corresponding to the object are added in random order.
Fig. 12 shows an example object and its computed cocycles with and without the rotation invariant pyramid. Fig. 13 and 14 show the paths in the RAG associated to the downprojected cocycles of the test images in Peltier09a . Fig. 15 is another example showing the path in the RAG associated to the downprojected cocycle related to the hole associated to the ball. Finally, Fig 16 shows the downprojected cocycles computed on a image from the 2010 World Cup final in South Africa.
6.2 Discussion
Besides stability with respect to geometric transformations, one could consider additional criteria like the minimality of the obtained cocycles w.r.t. additional measures, like for example the number of edges of each cocycle, the sum of the number of edges of a basis of representative cocycles, the length of the path in passing through the support squares of the pixels having at least one cocycle in their boundary^{3}^{3}3Would give Euclidean rotation robust cocycles., etc.
It has been shown for homology generators ChenF10 that in general the problem of computing minimal representative cycles is NPhard. Nevertheless, in certain cases, like computing cycles for dimensional objects, finding minimal cycles is not NPhard. For cocycles such a study does not exist yet, but considering the relation between homology and cohomology, similar results can be expected. In the case of 2D objects, the problem of finding cocycles with minimal number of edges can be related to the problem of finding in the RAG shortest paths that connect vertices adjacent to different holes – this problem can be solved in if using Dijkstra’s algorithm Atallah98a .
Real life objects are typically obtained by using scanning devices of different type: 3D scanners, video cameras, CT, MRI, etc. One common issue in all these cases is the presence of noise and being robust w.r.t. the possible deformations of a real object. A possible solution could be to define a robust basis of cocycles based on a function like the eccentricity transform Ion08a which is known to be robust w.r.t. noise and deformations. The eccentricity transform associates to each point of a shape the geodesic distance to the point furthest away. For a given starting point the geodesic distance function defines behind holes a set of points called the cut locus which can be reached in the same distance on multiple paths (going on both sides of the hole). In many cases, cutting a shape along these sets can produce a shape with less holes, which gives the same geodesic distance function for the same starting point. The eccentricity transform can be interpreted as the maximum over multiple geodesic distance propagations initiated at each point of the shape. As cocycles can be seen as ‘cuts into the object’ that ‘kill’ a hole, a cut which has the minimum effect on the eccentricity transform, could provide an avenue for selecting robust cocycles.
Finding associations between concepts in cohomology and graph theory will open the door for applying existing efficient algorithms (e.g. shortest path). The following lemma can be seen as a first step in this direction.
Lemma 6.6
Any set of foreground edges in the boundary graph , associated to a path in the RAG , connecting a hole of the object with the (outside) background face, is a representative 1cocycle
cohomologous to the down projection of the cocycle . It blocks any generator that would surround the hole.
In other words, consider the down projection Peltier09a of and in : the cycles and , respectively. Take any edge and . Let , be faces of , the boundary cell complex associated to the foreground in having , respectively , in their boundary. Let be a simple path of vertices in s.t. all vertices are labeled as foreground. is the vertex associated to , and to .
Consider the set of edges of , where , , and , , is the common edge of the regions in associated with the vertices and . defines a cocycle cohomologous to the down projection of the cocycle .
Proof. is a cocycle iff is the null homomorphism. First, . Second, if is a cell of , , , then, . To prove that the cocycles and (the down projection of to the base level of the pyramid) are cohomologous, is equivalent to prove that . We have that and . Finally, over the remaining selfloops of the boundary graph of the homologygenerator level is null. Therefore, . ∎
7 Conclusion
This paper considers cohomology in the context of graph pyramids. Representative cocycles are computed at the reduced top level and down projected to the base level corresponding to the original image. Connections between cohomology and graph theory are proposed, considering the application of cohomology in the context of classification and recognition. The current paper extends the previous work with detailed insights and proofs, and a refinement of the previous method that makes the obtained cocycles scanning and rotation invariant. Extension to higher dimensions, where cohomology has a richer algebraic structure than homology, and complete cohomology  graph theory associations are proposed for future work. For this last task, we could consider nD generalized map pyramids Damiand06 .
8 Acknowledgements
This work was partially supported by the Austrian Science Fund under grants S9103N13, P18716N13 and P20134N13.
References
References
 (1) Z. J. Wood, H. Hoppe, M. Desbrun, P. Shroder, Removing excess topology from isosurfaces, ACM Trans. Graph. 23 (2) (2004) 190–208.
 (2) M. Allili, D. Corriveau, Topological analysis of shapes using morse theory, Comput. Vis. Image Underst. 105 (3) (2007) 188–199.
 (3) A. Hatcher, Algebraic topology, Cambridge University Press, 2002.
 (4) R. GonzalezDiaz, A. Ion, M. IglesiasHam, W. G. Kropatsch, Irregular graph pyramids and representative cocycles of cohomology generators, in: A. Torsello, F. Escolano, L. Brun (Eds.), Proceedings of the 7th IAPRTC15 International Workshop on Graphbased Representations in Pattern Recognition, Vol. 5534 of LNCS, Springer, Venice, Italy, 2009, pp. 263–272.
 (5) R. Diestel, Graph Theory, no. 173 in Graduate Texts in Mathematics, Springer, 1997.
 (6) W. G. Kropatsch, Building irregular pyramids by dual graph contraction, IEEProc. Vision, Image and Signal Processing 142 (6) (1995) 366–374.
 (7) W. G. Kropatsch, C. Reither, D. Willersinn, G. Wlaschitz, The dual irregular pyramid, in: Proceedings CAIP’93, Computer Analysis of Images and Patterns, Lecture Notes in Computer Science, Vol. 719, Dmitry Chetverikov and Walter G. Kropatsch editors, Springer, 1993, pp. 31 –40.
 (8) D. Willersinn, W. G. Kropatsch, Dual graph contraction for irregular pyramids, in: ICPR1994: Proceedings of the 12th IAPR International Conference on Pattern Recognition, Vol. 3, Shmuel Peleg, Shimon Ullman, and Yehezkel Yeshurun, editors, IEEE Comp.Soc., 1994, pp. 251–256.
 (9) W. G. Kropatsch, Y. Haxhimusa, Z. Pizlo, G. Langs, Vision pyramids that do not grow too high, Pattern Recognition Letters 26 (3) (2005) 319–337.
 (10) J. R. Munkres, Elements of Algebraic Topology, AddisonWesley, 1993.
 (11) R. GonzalezDiaz, M. J. Jimenez, B. Medrano, H. MolinaAbril, P. Real, Integral operators for computing homology generators at any dimension, in: 13th Iberoamerican Congress on Pattern Recognition (CIARP 2008), Vol. 5197 of LNCS, Springer, 2008, pp. 356–363.
 (12) S. Peltier, A. Ion, W. G. Kropatsch, G. Damiand, Y. Haxhimusa, Directly computing the generators of image homology using graph pyramids, Image and Vision Computing 27 (7) (2009) 846–853.
 (13) M. IglesiasHam, A. Ion, W. G. Kropatsch, E. B. García, Delineating homology generators in graph pyramids, in: 13th Iberoamerican Congress on Pattern Recognition (CIARP 2008), Vol. 5197 of LNCS, Springer, 2008, pp. 576–584.
 (14) T. K. Dey, K. Li, J. Sun, D. CohenSteiner, Computing geometryaware handle and tunnel loops in 3d models, ACM Trans. Graph. 27 (3) (2008) 1–9.
 (15) W. G. Kropatsch, Equivalent contraction kernels to build dual irregular pyramids, Advances in Computer Science Advances in Computer Vision (1997) 99–107.
 (16) J. D. Zunic, L. Kopanja, J. E. Fieldsend, Notes on shape orientation where the standard method does not work, Pattern Recognition 39 (5) (2006) 856–865.
 (17) C. Chen, D. Freedman, Hardness results for homology localization, in: Proceedings of the Annual ACMSIAM Symposium on Discrete Algorithms (SODA), 2010, pp. 1594–1604.

(18)
M. J. Atallah (Ed.), Algorithms and Theory of Computation Handbook, 1st Edition, CRCPress, 1998.
 (19) A. Ion, W. G. Kropatsch, E. Andres, Euclidean eccentricity transform by discrete arc paving, in: D. Coeurjolly, I. Sivignon, L. Tougne, F. Dupont (Eds.), 14th IAPR International Conference on Discrete Geometry for Computer Imagery (DGCI), Vol. LNCS 4992 of Lecture Notes in Computer Science, Springer, Lyon, France, 2008, pp. 213–224.
 (20) C. GrassetSimon, G. Damiand, P. Lienhardt, nd generalized map pyramids: Definition, representations and basic operations, Pattern Recogn. 39 (4) (2006) 527–538.