# Meaning of topological distance between 2 pixels

I came across the notion of topology and topological distance in the context of image processing several times (especially when it came to mathematical morphology). I looked for a not too abstract explanation of "topological distance" but haven't found one yet. Can you please explain (in layaman's terms) the notion of topological distance between 2 pixels? And what's the difference between a euclidean distance and a topological distance in image-processing?

• Can you give us some context, e.g., a citation to the source where you saw the phrase used and the surrounding context?
– D.W.
Feb 22 '16 at 21:01

Nonlinear Signal and Image Processing: Theory, Methods, and Applications defines topological distance as follows. First, you have to define when two pixels are neighbors. The book offers two possibilities:

• The neighbors of a pixel are the 4 "cardinal" pixels around it.
• The neighbors of a pixel are the 8 pixels surrounding it.

This defines a graph (two pixels are connected by an edge if they are neighbors). The topological distance between two pixels $p,q$ is then the graph distance between $p$ and $q$.

The first choice above corresponds to $L^1$ ("Manhattan") distance, and the second choice to $L^\infty$ distance. This contrasts with the usual $L^2$ (Euclidean) distance.

If you really think about it, imagine two pixels which can take on only two values: 0 or 1. How do you characterize the difference between the two? Suppose you have no notion of position of all, just that a pixel can either take on the value 0 or 1. Preferably, there should only be two absolute values for change in this system: 0 denoting no difference, and 1 meaning existence of a difference between the two values.

Now, suppose there exist two pixels on a one-dimensional axis that can only take on the color value of 1. Now, the difference between the positions on that axis could be taken to represent the "distance" between the two points.

The notion of "distance" is really defined in terms of some fundamental change defined in terms of some units of observation of measurement. Usual Euclidean distance is described in reference to the origin as a difference between the observed or perceived numeric difference between a number and another that are attached to an N-dimensional coordinate system.

Topological distance is most likely a generic form of describing a system of points and relationships between points; topology is about defining what a space really means and relationships between subspaces or points in space, defined using mathematical structures. It's really abstract in the sense that it's really up to you or whoever else to define what a point is, how to define and measure the attributes of the point, and how to define terms to represent changes in between points, and one of those terms can be what we traditionally think as "distance."

In this case, topological distance can be computed against a model that tries to model a certain shape of an object that an image represents. The projection of a specific pixel onto a model of a higher-dimensional object can be considered a part of shape analysis.

Computing a "topological distance," here, then, will be decided by more than what is apparent from the image data itself. It may also take into account certain assumptions of a model (e.g. a pixel on the same coordinates of a 2D image will be mapped to different topologies if one is looking at a sphere versus if one is looking at a dog).