An image structure model for exact edge detection

04/21/2019 ∙ by Alessandro Dal Palu', et al. ∙ 20

The paper presents a new model for single channel images low-level interpretation. The image is decomposed into a graph which captures a complete set of structural features. The description allows to accurately identify every edge location and its correct connectivity. The key features of the method are: vector description of the edges, subpixel precision, and parallelism of the underlying algorithm. The methodology outperforms classical and state of the art edge detectors at both conceptual and experimental levels. It also enables graph based algorithms for higher-level feature extraction. Any image processing pipeline can benefit from such results: e.g., controlled denoising, edge preserving filtering, upsampling, compression, vector and graph based pattern matching, neural network training.



There are no comments yet.


page 2

page 5

page 11

page 14

page 16

page 17

page 18

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Edge detection is one of the most active research fields in computer vision. It represents the first step of image features abstraction and interpretation process. Edges are related to significant changes in image values that witness the presence of higher level properties (object boundaries, change in reflectance, reflections, etc.). The quality of any image processing pipeline relies on the underlying edge detector and on its effectiveness in removing false positives while minimizing false negatives. The presence of noise, due to acquisition, compression and filtering, affects the detection. Commonly, a smoothing filter preprocesses the image, in order to reduce the effect of the noise, while preserving the main features. Local edge detection is strictly related to a differential or gradient operator that highlights the presence of strong changes in the image along a specific direction. Eventually, the detection combines them into a set of lines/list of pixels/raster that describes a coherent disposition of each edge according to the maximal change regions of the image.

In literature, several surveys on edge detectors cover last decades of research directions arbelaez2011contour ; papari2011edge ; ziou1998edge ; shapiro2001computer . We refer the reader to such references for further details. Let us shortly cover some approaches that are related to our method. The primordial convolutional masks approaches (Roberts roberts1963machine , Prewitt prewitt1970object and Sobel duda1973pattern ) computed first-order derivatives with kernel convolutions. The maximal intensity pixels in the resulting image indicate the presence of an edge. Such output contains only raster information, which is visually pleasing but of limited use for automatic processing, since no edge labeling and actual interpretation is performed. Canny’s edge detector canny1987computational builds on such (smoothed) output, selects local maxima pixels along gradient directions that correspond to edges and connects them through a chaining process. Such detector and its legacy over the last 30 years represent a landmark for edge detection. Canny’s detector is optimal with respect to three criteria: it provides a low error rate, a minimal error in predicted position w.r.t. the actual edge and a single response to a single edge. Many approaches in literature provide as output of edge detection a raster matrix, where edges are identified by pixels, usually at the same resolution of the original image.

Figure 1: 256x256 Lena. Original image (left), proposed edge detection (center), Canny’s detection (right)

Color and texture information cremers2007review ; malik2001contour are considered in the context of image segmentation. Subpixel precision hermosilla2008non ; jensen1995subpixel has also been included in the detection process. Global interpretations shotton2008multiscale ; catte1992image and statistical approaches konishi2003statistical have been presented. In recent years, the advent of new parallel architectures (GPGPU) allowed a rise of Neural Network based methods xie2015holistically ; dollar2013structured , where a training with manually annotated edges is performed. Global minimization algorithms (active snakes snakes ) have been proposed, where the output is a vector polyline that converges to the edge on a continuous domain.

Junctions of edges (the location where multiple edge lines intersect and/or sharply bend) are usually not computed by the low-level edge detection process. Starting from Harris’ corner detector harris1988combined , where abrupt changes in gradient directions are identified, significant work aimed at including local and global information for accurate positioning and detection of intersections has been carried on ziou1998edge . The task is difficult because high quality edge information is required for a correct interpretation of the junction. Moreover, edge strength and gradients become weak at junctions. Contextual information and higher level interpretation mcdermott2004psychophysics have been proposed to increase accuracy. Finally, perceptual detection of junctions have been proposed by means of ground truth neural network training maire2008using A comprehensive model for edge junctions did not emerge yet, since it combines perceptual interpretation of the image and context information. As already suggested by harris1988combined , edge and junction detection should be performed by a single detector that takes advantage of both kinds of information.

This paper proposes a new formalization of edges and their connectivity with the goal of overcoming the two common challenges of state-of-the-art detectors: edge tracking and edge connectivity. Edge tracking is the process of identifying all maximal gradient magnitude points (or second derivative zeroes) and linking them in order to follow the edge line across the image. This task is impaired by noise and can easily lead to misinterpretation. Moreover, if performed at discrete level, it is heavily affected by spatial quantization of pixels and gradients. To the best of our knowledge, no global relationships between edges and junctions are modelled in a graph like structure.

The proposed model is based on a new point of view: an edge is modelled as a closed and oriented

line that traverses the image and splits and merges into other edges. A single connectivity graph contains all possible edges (or cycles) and describes the correct topology of edges. Rather than tracking the accurate disposition of each edge throughout the image, the focus is to identify a set of key points that must be traversed by the edges (associated to the nodes of the graph) and to deduce the topology of connections by means of the analysis of the relationships between neighbor nodes. Image edges can be drawn, without tracking, as a rendering of graph edges and lines interpolation. The proposed edge model natively combines edge lines localization and connectivity detection into a single process. It also decouples signal raw information from high-level interpretation. Higher level interpretations can be built on such graph: e.g., perceptual faithfulness, corner detection, basic geometry (as opposed to Hough transform), classification of edge types, segmentation.

The main features offered by the proposed detector are:

  • accuracy Every edge, its position and strenght are detected.

  • connectivity The detector outputs an edge graph, where nodes are junctions points and graph edges represent parts of image edge lines.

  • no preprocessing No image pre-filtering is required. The edge extraction directly descends from the image structure and topology.

  • no thresholds nor parameters The model is independent on image based thresholds, since it recovers structural properties.

  • vectorial output The edge features are in vector form, in order to adapt to the finest details of the image. Vectors are oriented, so that directional graph-based algorithms can be used.

  • subpixel precision Vector spatial precision should be unlimited.

  • no prior knowledge The detector is not informed on domain related knowledge (i.e. trained neural networks, registration and calibration).

  • global The algorithm performs a global analysis. Local information is not able to capture the potential edge relations with the context. Any application of the algorithm on a subimage may lead to poorer results.

  • small images The algorithm is able to accurately process any image size, starting from 2x2 pixel images.

  • arbitrary image depth The algorithm accepts any pixel channel depth. In particular, even if continuous values (modeled as floating point) are used, no loss of information (e.g., quantization) is caused be the algorithm.

  • spatial domain The algorithm deals with original image information: no transformed spaces are used in the process.

  • efficiency and parallelism The detector is compute efficient and the algorithm is suitable for parallel execution.

  • perceptual correspondence Edges are drawn by perceptually coherent lines.

The paper is organized as follows. In Section 2 some notation is provided. Section 3 presents the structural model that defines image features and Section 4 shows how to extract edge information from it. In Section 5 we present some edge detection examples for a set of significant synthetic and natural images. In Section 6 we highlight some of the potential benefits of such method for most demanding applications. Finally in Section 7 we draw the conclusions and final remarks.

2 Notation and definitions

A single-channel two-dimensional image is composed of pixels (squares of unit size) tiled on a regular grid on a cartesian space. Each pixel is associated to a value, which usually represents the average measurement of the phenomena of interest, projected among the pixel surface.

Formally, a discrete image is a function . The codomain values can be either quantized gray levels (e.g. 1, 8 or 16 bit representations) or a continuous value (e.g. represented by a floating point value). In the paper no assumptions about value type is made. The syntax (or ), where I is the image and , describes the value at position in the image. The pixel , with value , is the square defined by the corners . Practically, pixels are arranged on a Cartesian space and each pixel value is stored in its lower-left corner.

If not stated differently, indices named will range over , while variables will range over . In particular, , , , . When clear from the context, also image coordinates will inherit corresponding ranges.

Let us introduce a continuous function that is built from the image function through bilinear interpolation. The image , where and the values in inside a pixel are defined by the bilinear interpolation: given , where are the offsets within the pixel, and

, where and . Note that is continuous.

The image can visualized as a surface defined by the set of three-dimensional points . In practice, pixel values define the altitude of a landscape, composed of ridges, valleys, saddle points, local maxima and minima that play a central role in edge detection.

Given an integer coordinate , let us define the set of 8-neighbors .. The set of 4-neighbors for is .. In some cases discussed below, we characterize a generic neighborhood as a subset of the 8-neighborhood, .

Constant regions of the image are avoided, since they are not relevant for edge characterization and they introduce many technicalities in formal proofs and algorithms. Rather than altering the image values, comparisons between pixels are redefined to break ties. It is sufficient to compare neighbors by using lexicographical order of coordinates. Given a point and two points ,, we define , iff or . Note that . W.l.o.g, the upper left value is the most favourite in case of equal pixel values. From now on, we assume that the image has all distinct values and/or refer to the operator .

An isoline is the intersection of the image surface with a constant value plane parallel to x-y plane. Formally, it is the locus of points that are solution to the equation . Within the function’s domain, each isoline is a closed curve, possibly self-intersecting, whose points share the same value in . The line can be associated to an orientation: while moving along the line we assume to have greater values on the left.

There is a degenerate case when an extended region of the function is constant: according to the definition, the isoline contains an area rather than a line. In the context of bilinear interpolation, it easy to notice that the smallest case happens when four pairwise adjacent pixels have equal values. Let us assume that such cases are excluded and rely on the operator that implicitly introduces an infinitesimal slope to the constant plane.

The image gradient is the vector made of the two partial derivatives along the and axis respectively, i.e. . The gradient magnitude is defined as and the gradient direction is the normalized gradient.

Focussing on a pixel with lower left corner in and recalling the bilinear interpolation definition given above, we have that, given , . If follows that .

Function is piecewise continuous. Along pixel sides and corners, discontinuities of direction and magnitude may be encountered.

3 Image structure analysis

We present an informal outlook of the proposed edge detection method. The image model is based on a continuous surface (as in the plot of ). From a computational point of view, however, it is desirable to work at discrete level, i.e. with the original image . The paper presents the theoretical results on and maps them to an acceptable algorithmical approximation on .

Figure 3 depicts a discrete image and shows some isolines associated to the corresponding function. Note that isolines partition the image into a set of areas. Traditionally, an edge is positioned where local maxima in gradient magnitude arise along the local gradient direction. This is a local property that should hold for every point along an edge line. If we map the property to the context of isolines, it means that an edge should be drawn at any place where the isolines get closer, since they show a gradient magnitude increase (compare to non-maxima suppression in Canny’s detection). The relationship between edges and isolines is actually deeper: an edge point is locally supported by a set of isolines.

Let us focus, in the figure, on the image section , that connects a local (blue) minimum point to a local (red) maximum point by means of a white line that traverses the domain. Such line is a monotonic path, meaning that it crosses an isoline at most once. In the paper, we will also consider steepest path

s that include the requirement that the path is orthogonal to isolines. Such paths contribute to classify isolines and to define the presence of edges.

The steepest path A intersects a set of isolines depicted with orange, green and cyan colors. This set of isolines concur in the identification of the purple point, namely the local maxima along the steepest path. We assume that an edge (depicted as a green dashed line) must be traversing such point. In case of several maxima are present along the path A, multiple edges will be traversing the path. The support of an edge will be partly defined by the set of isolines values that are included by the two local minima neighbor to the purple maxima along the path. In principle, this idea could be applied to any steepest path in the image, as in Canny’s non-maxima suppression. In addition, while retrieving edges positions, the fundamental information about which isolines are related to a specific edge is computed.

In particular, the same isolines that support the traversal of the edge through the path A, extend across the image and form contiguous bundles (or a continuous range of image values), that sometimes separate and split in different sub-bundles. For example, cyan isolines loop around the image local maxima (the red dot), while the orange ones loop around the local minima (in blue). However, the green isolines cover a longer distance and eventually return at path A (due to image continuity). This behaviour is caused by the presence of image saddles (visualized by the green dot) or points where the gradient vanishes but second order derivatives along two orthogonal directions have opposite signs. Practically, at a saddle point isolines travel towards different image areas, according to their value. In the picture cyan and purple isolines cover higher values than the saddle point, while green isolines have smaller values. The set of green + cyan isolines passing through path A get divided into two sub bundles (resp. green and cyan) by the saddle point. The path of an isoline provide information about edges at different locations. Green isolines, for example, contribute to the support of an edge at path A, but at the same time they reach path B. This fact is at the basis of the edge connectivity detection. An isoline that interacts with different paths represents a possible connection between the supported edges. Note that at path B, the relative edge is also supported by blue and red isolines that are totally unrelated to isolines of path A. We can infer that a bundle of isolines contribute to the definition of edge properties only if it is completely covered by a path that joins two local extrema in the image. In this way, all local maxima across the path are completely captured, but, more subtly, all isolines that support an edge are identified, so that they can be related to other paths.

The next important question is if and how the hypothetical edge passing through both paths A and B are related. In presence of a shared support (i.e. the green isolines), this set of isolines that connects the two paths suggests the presence of an edge that connects the two purple dots. This property has a significant impact on edge detection, since there is no need to identify and connect all gradient magnitude local maxima across the area between two paths, in order to discover the presence of a (possibly long) edge. The structural property derived from steepest paths and isolines guarantees the presence of an edge, even in the absence of a complete analysis of all pixels. A careful selection of the appropriate set of steepest paths will be discussed as well as a fast method to accurately draw the edges between paths.

Connectivity plays a central role in the model and Figure 3 presents a first simple example. Ideal edges are marked by green lines, isolines by black lines, local maxima by red circles, local minima by blue and the saddle points by green circles. The purple points represent the local maxima in gradient magnitude along each depicted steepest path. The bold green line highlights the edge that connects the paths A and B in the previous figure.

Figure 2: Image isolines
Figure 3: Isolines, steepest paths and edges
Figure 2: Image isolines

Our connectivity model produces an edge graph where nodes are the purple points and graph edges are associated to an image edge that links two nodes. Each maxima along a path is supported by a bundle of isolines which divides into other bundles crossing other paths, because of the presence of saddles and/or maxima on different paths. The bundle evolution on paths allows to follow corresponding edge connectivity.

In this work we give more importance to the detection of edge branching, rather than its accurate localization. This is related to the fact that judging the actual edge branching point can be subjective and, if necessary, it can be post-processed with the preferred perceptual model, provided the correct connectivity graph is available with the information about such branching. Compare Figure 10, where correct connectivity is detected (left) and post processed into a more visually pleasing version, where the junction becomes translated to create a smoother line joining (right).

The detection process: (1) identifies all steepest paths that section isoline bundles; (2) it defines the regions of interest delimited by steepest paths, which result in an image partition; (3) analyzes the regions for graph construction, where graph edges cross exactly one partition; (4) it draws edges without tracking. Each region can be processed independently and in parallel.

Isolines and steepest paths, however, need a special treatment in the presence of critical points (saddles). In fact, isolines can intersect themselves at critical points as well as steepest paths can bifurcate and merge, giving rise to a complex network of paths joining local extrema (depicted by white lines in Figure 3).

3.1 Caveats

This plan sketched above hides a number of issues that need to be tackled. The first consideration is that there is an infinite number of steepest paths, since they can be drawn starting from any point in the continuous 2d-domain. In this scenario, the proposed detection would resemble the Canny’s procedure assuming an infinite resolution image: non-maxima suppression applies along every steepest path and infinitesimally close paths are connected by their maxima. Since this is not computationally feasible (and also unnecessary), the paths are clustered to a finite set of representatives that retain sufficient information for edge localization and correct connectivity. Redundant paths are characterized by the following property: two paths connect the same extrema and they contain the same (possibly empty) set of saddle point. This allows to limit the number of paths by a finite upper bound (the number of saddles). In Figure 3, for example, the two lowest leftmost paths are redundant as well as the two lowest rightmost.

It is preferable to design a core procedure that is based on

, since dealing with continuous coordinates is computationally expensive. At the same time, though, final edge information should be provided as vectors with continuous coordinates. For example, the bilinear interpolation possesses a closed formula for steepest paths. Nevertheless, this would introduce additional floating point arithmetics that can be avoided and approximated by the introduction of

discrete increasing steepest paths. It is worth noting that even on , as opposed to any function, due to the piecewise pixel interpolation, an increasing steepest path can be different from a decreasing steepest path. Since the issue must be tackled also for image , we propose a solution that also works with image.

Another drawback of bilinear interpolation is the presence of saddle-like points at corners (see Section 3.2), where is often discontinuous. Discrete paths are defined to correctly handle such cases.

Since each region defined by the steepest paths does not contain any saddles, the edge drawing is based on isoline interpolation within the region (see Section 4.2), in order to avoid tracking of the maximal gradient magnitude.

3.2 Saddles

Saddles determine isolines and steepest paths behaviours. We first introduce the Continuous Monotonic Increasing Path in order to provide a general definition of saddle point, due to the fact that is not a function.

Definition 1 (Continuous Monotonic Increasing Path)

A continuous monotonic increasing path is a continuous line such that if then .

Starting from a local minimum , such path identifies a line on the surface, such that, while proceeding, it increases its altitude. Since we assume a function without constant pixels and sides, there is always a next candidate except for local maxima.

Definition 2 (Saddle)

Consider two distinct curves and such that they intersect at the point . and are pairwise delimited by points and respectively. The points and are all different. If the sub-curves delimited by ,,, are all monotonic increasing paths and appear in clockwise order around , the point is a saddle.

Definition 2 is slightly more general than the usual one, since it accounts for possible discontinuities of at pixels borders. In such cases, the classical definition (, but at the same time is not a local maximum nor a minimum) would not hold anymore.

Figure 4: Left: a possible isoline arrangement (green line) at saddle point (green dot). Right: discrete vs continuous neighborhood

In Figure 4 we depict a minimal example. In blue we show pixel corners with values smaller than and in red the corners with greater value. The saddle point is depicted with a green dot and the corresponding isoline is traced with a green line. The saddle identifies two different areas delimited by the green isoline (in a different scenario, it can also enclose only the blue dots, depending on the neighbor pixels values). For greater isoline values, the two areas become disjoint, while lesser values they produce a larger and unique area.

Lemma 1 (Saddle point and isolines)

A saddle point is positioned at iff there are two distinct and equally valued isolines that intersect at .

Let us exhaustively treat three different types of saddles, depending on their position: inside a pixel (square perimeter excluded), on a side of the pixel (corners excluded) and on a pixel corner. We assume a generic pixel at position and a saddle point with coordinates with , , as defined above.

Split point: If , the saddle lies inside a pixel. Recall that and are continuous inside the pixel. If , any line with , and , for sufficiently small and , verifies that lines and are both monotonic increasing (or decreasing) and therefore the saddle property is falsified. When , and (we exclude the planar case), given , , , and , such that s are inside the pixel, the saddle property holds.

In this case, we define a split pixel as the pixel (associated to its low left corner ) that contains a saddle at . We name as a split point. Therefore, for a split pixel it holds that and , as solution to with inside the pixel. Let us name as the split value. It also follows that because of bilinear interpolation. Note that there can be at most one split point per bilinear function, since is a vector of linear functions.

Lemma 2 (Split pixel corners value)

Given a split point , associated to the split pixel , it can either be ,, and or the same relationships with inverted order. Informally, two opposite corners are greater than .

Pixel sides: We show that no saddles can occur along a pixel side, w.l.o.g. at . Let us assume that there is a degenerate split pixel with a split point at . This would imply , which is excluded by assumption. Therefore, the only other case is when both pixels and contain no split pixels. It is easy to see that due to continuity of , the isoline passing through is continuous, possibly non differentiable at , and it divides each pixel in two parts. It is not possible to cross the isoline with two curves and such that they verify the saddle property. In particular, it is impossible to verify the clockwise ordering of points for any pair lines and intersecting .

Mix points: Let us assume the saddle is at the corner and let us name it mix point. With a similar argument as in the pixel side case, we can exclude the cases where any of the four neighbor pixels of are a degenerate split pixel. The corner value is shared by four different bilinear functions that join at the same point. Moreover, the piecewise gradient can be often discontinuous in . W.l.o.g., let us assume the point is the corner being investigated.

Lemma 3 (There is at most one isoline that passes inside a pixel and on one of its corners)

Given a pixel with corner , the isoline passing through solves the equation . Given the bilinear interpolation, the line is unique and there is at most one line that intersects the pixel area.

Lemma 4 (Mix point characterization)

The following statements are equivalent:

(i) A mix point exists at integer coordinate

(ii) each of the four pixels adjacent to contains an isoline with value that reaches the pixel border at

(iii) n4(p) neighborhood is such that , , , , , ,

We exhaustively showed that saddles can occur inside a pixel (split points) and/or at pixel corners (mix points), given the assumption that contains no equal valued neighbors.

The process of building discrete steepest paths must account for the discrete sampling of the image at corner values only. The implicit assumption in the discrete scenario is that a discrete segment with and should correspond to the presence of a monotonic increasing continuous path from to in . This is trivially true along sides ( neighborhood) because of bilinear interpolation. However, for diagonal segments crossing split pixels, it does not hold (see Figure 4 on the right — dashed arrow). In fact, for such diagonals the discrete interpretation violates the assumption. A finer analysis reveals that in there is no monotonic path between and . We already showed that both corners on a diagonal are greater (or less) than the split value. Considering an increasing path starting from , the split pixel contains a (lower than ) split value that has to be crossed (at least once) by a corresponding continuous path, in order to reach the opposite corner. The split value isolines are depicted with solid black lines. Thus in , any continuous path connecting to contains at least an inversion of monotonicity (depicted by ’-’ and ’+’ subpaths).

In conclusion, the diagonal comparisons over a split pixel are inhibited, in order to preserve the monotonicity property of paths between and images. Thanks to this choice, the image can be equivalently explored at discrete level. We therefore introduce the general neighborhood operator , defined as a subset of where diagonals crossing split pixels are removed from the set.

3.3 Minima and maxima

In , local maxima (minima) can only appear at integral coordinates, since for each pixel and point there is always a corner with greater (lesser) value, due to bilinear function properties. It follows that detecting local maxima (minima) boils down to checking the maximality (minimality) among the n() neighborhood. Recall that diagonals that cross a split pixel are excluded from the test, since they would incorrectly account for the computation a greater (lesser) value than the correct extremum, while overpassing the saddle and including a different peak (valley). The operator allows to identify local minimum and maximum. A point is a local maximum (minimum) in , with respect to , iff () for every .

3.4 Steepest Paths

In continuous steepest paths are continuous monotonic paths that proceed along the gradient direction. Due to the piecewise continuous gradient function, as depicted in Figure 6 with black arrows, a continuous steepest path can traverse points with undefined directions (i.e., saddles and pixels sides).

We prefer to work at discrete level, since the processing is more efficient and the cases to be treated are reduced.

Let us introduce the formal definition of discrete steepest path.

Definition 3 (Discrete (Increasing) Monotonic Path)

A discrete monotonic path is a sequence of integer 2d points such that .

Definition 4 (Discrete (Increasing) Steepest Path)

A discrete steepest path is a discrete monotonic increasing path P such that and there is no such that .

As discussed below (see Lemma 9), the discrete version may differ from the continuous one but both share the monotonicity property. Compared to continuous steepest path, the discrete version produces the best orthogonal path to isolines. Our choice of using a neighborhood, as opposed to , is dictated by the need of better approximating the continuous steepest paths. Moreover the regions identified by paths have a non self-intersecting perimeter.

3.5 Steepest graph

The steepest graph collects the discrete steepest paths and it represents a finite and compact description of the image surface landscape.

Definition 5 (Steepest Graph)

The steepest graph G=(V,E) is defined as follows: the set of nodes V is the set of points and directed edges are such that . The graph is built incrementally according to the following steps:

  1. Given a split pixel the four edges , , , are added if . Otherwise the edges are reversed.

  2. Given a mix point , the four edges , , , are added if . Otherwise the edges are reversed.

  3. Given any steepest discrete path , edges are added if .

  4. Given a node such that there are no incoming edges and is not a local minimum, the edge is added, where and there is no such that , and , with containing the diagonals that intersect any diagonal edge contained in E.

Steps 1 and 2 introduce predetermined edge patterns that characterize the discrete behaviour of steepest paths in the presence of a saddle. Even if a point contained in such edges has another best optimal neighbor in , such patterns are enforced. This allows to guarantee the bifurcation of a steepest path caused by a saddle (compare Figure 4 on the left, the two incoming edges at ). Edges added at steps 1 and 2 are marked as non removable, since any graph simplification must maintain these fundamental structures.

After step 3 has introduced all steepest paths of the image, it is possible that some paths may start from non local minima (see Figure 5 left). The reason is that any lower valued node w.r.t. to (e.g. , ) has a steepest neighbor node () which is different from .

Figure 5: Edge model for a region

Step 4 guarantees that only local minima have no incoming edges. The procedure introduces additional edges with the requirement that the new addition is the steepest w.r.t. (the green edge in the Figure). Moreover, special care is devoted to avoid to select a new edge that crosses another edge already in the graph. This is due to the need of maintaining a planar graph. Note that this step introduces a potential outdegree greater than one for nodes. We show now that it is always possible to find an edge that connects a non minimal node without incoming edges to a lower valued node.

Lemma 5 (Non minima joining)

Given a non minimal node with no incoming edges and the graph built by steps 1,2 and 3, there is a new edge that does not intersect a diagonal edge and that connects the node to a lower valued node.

Let us cover some fundamental properties of the steepest graph.

Lemma 6 (Dag)

The graph is a directed acyclic graph.

Lemma 7 (Planar graph)

The graph is planar

Lemma 8 (All saddles are connected)

The graph contains, for each saddle, at least a path that connects it to a local extrema.

Lemma 9 (Correct connectivity)

A path starting from a local minimum and ending to a local maximum in the graph is a monotonic increasing path embedded in R.

This lemma shows that every path contained in the graph correctly explores the surface of , i.e. the paths are monotonic visits of and therefore they cross each isoline at most once. However, it can be easily seen in Figure 6 a counter example where the discrete steepest path (in red) is not a steepest path in (in black). Some local value relationships are shown in green and we assume there are no saddles. Depending on pixel values, it may exists a path A, if bottom right pixel contains higher magnitude gradients within the pixel rather than along the side between bottom pixels, while path B could be selected in the opposite case. Steepest paths in are often undefined along sides. A discrete steepest path may end into a different local maxima compared to a path built on continuous lines (i.e. the path A and next pixels are never accessed by the red path).

In conclusion, the discrete steepest graph is a correct monotonic visit of the surface. Since the visit is planar, the isolines are crossed in order and a characterization of sectioned edges can be performed. An example of steepest graph is depicted in Figure 11 where edges are drawn as black to white gradient lines, the local minima (maxima) as blue (red) circles, saddles as green circles.

Figure 6: Steepest paths: discrete vs continuous in

Even if in the different context of detecting the inclusions of areas and the description of the image topology through a tree of areas, caselles2009geometric supports the idea that saddles are an important element for guiding the image structure analysis.

3.6 Image regions

Definition 6 (Min-max path)

Given a steepest graph , a min-max path is a maximal list of nodes such that and there are no nor . and are image local minima and maxima respectively.

The steepest graph contains a finite set of min-max paths and every graph edge belongs to at least a min-max path. Such paths partition the image domain into a set of regions. Each region, given the planarity of the graph, is delimited by a polyline made of a set of graph nodes and edges that define the region’s perimeter. Each region contains no saddles by construction. In principle the edges that delimit the split pixel form a single pixel region: we are not interested in such area since it is the discrete representation of the split point. Therefore we omit such regions and we assume that the split point is copied and projected to all four edges along the pixel sides, at the corresponding split value position.

Definition 7 (Monotonic region)

A region is monotonic if, excluding its perimeter, it contains no saddles.

We show that a monotonic region’s perimeter has exactly one local minimum node and one local maximum node.

Lemma 10

A monotonic region contains no self intersecting isolines.

Lemma 11

The non collapsed part of a monotonic region has exactly one minimum and one maximum in image values on its perimeter.

The region can collapse towards the extrema, since the two min-max paths delimiting the region may become overlapped (see Figure 7). It can also happen that along the collapsed min-max paths, several saddles (black points) are traversed, with the result that multiple extrema can be reached. This is not relevant, since any of the completely collapsed paths between a saddle and an extrema contain only collapsed edges, since actual edges will traverse other adjacent regions. Let us name the left, L in the figure, (right, R in the figure) path as the one that delimits the region at its right (left), while moving towards the maximum.

Another degenerate case is when the two sides are completely overlapped. This means that there is only one region that covers the whole domain.

Figure 7: Region organization

4 Edge model

We pursue two main goals in the detection of edges: the retrieval of accurate edge line position and the exact connections between edges. The edge model is based on monotonic regions as constructed in the previous section. Operationally, each region can be independently processed and the union of the results can be merged into the overall set of edges and connectivity graph.

It is fundamental to model edges with continuous coordinates. A model based on discrete coordinates (compare with raster detectors, where edge polylines are derived from pixel chaining of local pixel neighborhood) is not able to reach the desired precision and to disambiguate the correct connectivity.

Let us introduce three assumptions that approximate the edge model, mainly for computational reasons. (1) Discrete regions: the min-max paths (and consequently regions) are discrete over ; (2) Connectivity: edge can split and merge only at regions boundaries; (3) Edge drawing: edges are interpolated inside a region, rather than exactly traced (i.e., exact maxima /zero second derivative tracing).

The three assumptions allow to recover exact edge connectivity and accurate edge positions. At the same time, they allow a practical algorithm design. Discrete regions and their properties have been discussed in previous section. The second assumption is discussed in Section 4.1 and the last one in Section 4.2.

A monotonic region has the peculiar property of containing a set of isolines that do not intersect with each other (due to absence of saddles). As informally presented in the overview, the region is a maximal partition that satisfies this property. There are a number of possible monotonic partitions of the image, but the one presented above is computationally efficient and the min-max paths mimic at best the continuous steepest paths while preserving correct monotonic reachability of local extrema.

Figure 8 depicts the main elements in a monotonic region, delimited by left and right paths. Structural features are highlighted on the left image, while the corresponding edge properties are shown by the central image. Shared local minimum and maximum for the two steepest paths are identified by Min and Max points. Other elements are detailed below.

Figure 8: Edge model for a region. On the left, isolines and supports are shown. At the center, maximal isolines and retrieved edges (in green). On the right, two examples of carry for selected edges

Isolines inside the region ideally form a single bundle, since there are no saddles. The analysis of their spatial relationships suggests the presence of edges. In principle, closer isolines may indicate the presence of an edge. Rather than analyzing the whole region area, we focus on minimal and sufficient properties along both region paths, in order to infer the expected behaviour inside the region. This is not only computationally more efficient, but it guarantees to recover the correct connectivity of edges.

The key idea is to associate an edge to a bundle of isolines. The bundle may get divided by (i) saddles, which impose a clear and perceptual separation of edges and by (ii) local minima in gradient magnitude, which suggest a more refined partition into parallel edges due to the presence of multiple local maxima in gradient magnitude. For (i) it is sufficient to verify the property at paths, while for (ii) the property is optional, depending on the type of perceptual model in use and it should be also verified also inside a region, in case of a simplified steepest graph (see Section 4.3). Let us characterize the bundles at path intersection.

At the paths, the isoline bundle can actually separate, due to the saddles and the behaviour of isolines when covering adjacent regions. Blue points in Figure 8 represent such locations. In the case (1) in which the point is a saddle, the isolines exiting the region will separate and, consequently, two independent edges will leave the region. Practically, in case of a split pixel, the path intersects one of its sides and we select the point along the path with value equal to the split value. Note that for split pixels, the point can lie at continuous coordinates, even if the path is discrete. Note that the presence of a saddle can not be deduced only by the analysis of the region pixels: it depends also on neighbor region pixels. Therefore the identification of saddles informs adjacent regions about the isolines bundles separation.

If the point is (2) a path extremum, this clearly limits the bundle. Finally, a more perceptually faithful version can also include (3) local minima in gradient magnitude as blue points. In this case, the isoline bundle defined by (1) and (2) can be further divided because of the presence of multiple local maxima in gradient magnitude. The divisions induced by (3) do not affect the overall connectivity, since it only duplicates the affected edges. It can be activated depending on the kind of perceptual model in use. In some cases, where corrupting noise is present, it is more likely to observe several minima of type (3) that actually introduce parallel undesired minor edges (see Figure 9 at top left). In the reminder, we add all (3) points and we delegate the optional local minima removal to a post-processing phase.

Definition 8 (Support and Span)

Let us define the set made of the following points on a min-max path: Min, Max, all split values and mix point values and local minima in gradient direction. The points in are ordered according to point image values. Given two consecutive points and , the continuous interval of image values defined by is named the support of an edge for such path. The restriction of the path between points and is named the span of an edge for the path.

In the Figure, the set is made of points {Min, Lm1, Max} for the left path and {Min, Rm1, Rm2, Max} along the right path. Spans are colored in blue and yellow on the left path and green, red and purple on the right path.

Isolines contained in the region (depicted in black solid thin lines) are expected to separate when exiting the region, because of the presence of the saddles (compare Figure 3). This suggests a possible edge arrangement at the paths.

Definition 9 (Edge at path)

For each span of a path, there is exactly one edge crossing the path.

The span supports the presence of exactly one edge. This means that the span describes the spatial range where an edge is locally and perceptually confined. This reminds of Canny’s single response for an edge and an informed non-maxima suppression, where the support is explicitly modeled. The properties establishes what are the isolines associated to each edge (the support) and the portion of the min-max path (the span) that is considered to determine the location of the edge.

The localization of the exact point where the edge intersects the span (the red dot) can be defined, as in classical detectors, at the point that contains the local maxima in gradient magnitude. Since the presence of the span information allows a global analysis of image values along the path, we prefer to introduce a more perceptually pleasing location, given by the ideal barycenter of points of the span, where the weights are the gradient magnitudes associated to the points. Such computation outputs a point that is often very close to the local maxima, but in certain cases, where e.g. there is some noise in an almost constant positive magnitude path (e.g. a ramp edge on a wide span), it could help in placing the edge in a position more robust to noise. Note that without the presence of the span information, this refinement would be impossible. In the reminder, when referring to local maxima in gradient magnitude, the concept can be substituted by the barycenter defined above. All the examples depicted use the barycenter computation.

On the left path (the one that delimits the region on its right while increasing the values), there are two local maxima of gradient magnitude (LM1 and LM2 red dots), while on the right path we depict three maxima (RM1, RM2 and RM3 red dots).

Definition 10 (Edge strength at path)

Given an edge crossing a path, its strength is defined as the ratio between its support size and its span length.

The edge strength approximates the image derivative along the span. However, a more refined characterization of edges is possible: considering the support size and span length as independent variables, a classification of edges as strong/sharp, strong/blurred, weak/sharp and weak/blurred is possible.

4.1 Edge connectivity

Definition 11 (Edge graph)

The edge graph EG=(M,A) is defined by a set of nodes that contains all local maxima in gradient magnitude for each span of min-max paths in the steepest graph. The graph edges are directed edges that connect two maxima in , such that the first one is at the left path and the second one is at the right path of the same region.

The edge graph summarizes all edges disposition in the image and it is obtained by the union of the graph edges retrieved from each region. This graph describes the pure connectivity of image edges at region boundaries: the proper drawing of each graph edge within each region is described in Section 4.2.

Let us describe the edge connectivity model within a region. Isolines are bundled into supports along min-max paths, because of interactions between adjacent regions (i.e. saddles) and local minima in gradient magnitude. Within a region, the isolines can be separated by local minima. We assume that within the space between left and right paths the bundles identified at paths are able to reorganize and shift from one set of bundles to the other one. This assumption is critical and it approximates the actual behaviour inside the region. This choice allows to completely skip the tracking of edges inside the region and to model both connectivity and edge drawing based on paths. For this reason, supports are depicted by faded colors in Figure 8 on the left. The transition of spans is ideal, since spans do not have a specific characterization inside the region.

The edge connectivity is defined by a bipartite matching of the subset of that intersects the region, i.e. the red points in the Figure (center). Recalling the assumption made above, edges can split and merge only at region sides (edge junctions). If a split occurs inside the region, it can be detected and represented by two edges starting from a node and connecting two nodes on the opposite path. The actual correct position of the junction in space is in fact approximated and this issue is discussed in Section 4.2.

In order to establish whether a matching is possible, let us define the measure that compares left and right supports.

Definition 12 (Edge carry)

Given the points and in , such that lies on the left side and lies on the right side of the same region , the carry of an edge in between and is the intersection of the supports associated to and

The possibility for an isoline bundle at left path to evolve into a bundle at right path, depends on the carry of the pair. If the interval is empty, it means that are no isolines connecting the two spans and no edge can be supported. If there is a non empty carry, there is a set of isolines that connects the two sides, which suggests the presence of an edge.

In Figure 8 (center) the complete bipartite matching is shown. The matching (no orientation depicted) is drawn with thick green lines between nodes. For example, the blue support allows an edge towards the green support, since they have a non empty intersection. The yellow support is disjoint from green support and therefore no edge can connect the two spans. Figure 8 (top right) depicts the isolines defined by the carry between blue and green supports and Figure 8 (bottom right) depicts the isolines defined by the carry between blue and red supports. This last example shows a delicate case, perceptually speaking: no local maxima are included by the carry on the sides, but the edge should be drawn starting from the two red nodes. Moreover, the edge could also have no local maxima in gradient magnitude inside the region. This could lead to a false positive detection and a visually awkward drawn line (compare with Section 4.2). We discuss the handling of such case in the optimization Section 4.3.

Note that graph nodes are associated to positions in the image domain and they contain support and span information. However graph edges are not yet drawn, and therefore they do not represent a correct positioning of the actual edge lines. Nevertheless, edges contain carry information and the edge graph can be used for fast vector and graph based processing pipeline. Note also that some graph edges can be directed self loops: even if the edge is not informative per se, the actual edge is correctly drawn as a (possibly long) closed line across the image.

Definition 13 (Image Edge)

An image edge is defined by any path in the edge graph.

An image edge can be retrieved by a graph processing, since edge graph contains no high-level interpretation. The extraction of main edge lines, apart from trivial carry thresholding for graph edges, can be performed by greedy exploration of best carry edges or adaptations of shortest path algorithm for a more robust retrieval.

In literature, many types of edge have been formalized (step, ramp, line, roof etc.), depending on properties and spatial relationships among them canny1987computational . The edge graph contains only one basic type of edge, while the graph analysis can recover any complex relationship. Our model separates the edge detection task from the high-level interpretation of edges where, e.g., anti parallel edges are recognised as the support of a solid black line (roof edges).

A perceptual characterization of contours is not uniquely defined, since texture, changes of luminance, global relationship of features papari2011edge and even optical illusions opticalillusion carry additional information that influences actual detection. We focus on the isolines information (original signal) and we delegate any further higher-level (and graph-based) interpretation to a next processing step.

4.2 Edge drawing

A graph edge is a match between two sides of a region with non empty carry. The drawing of the graph edge produces a vector line which approximates at best the perceptual traversal on the region. The goal is to produce a line that minimizes the distance from the local maxima in gradient magnitude, without computing them. The proposed drawing is an approximation that simplifies the issues of tracking the edge local maxima inside the region.

Since, by construction, each edge is correctly placed at the intersection of paths ( and points in Figure 8 left), we compute the two isolines passing through and . In Figure 8 at the center, all red isolines for corresponding maxima are highlighted. The edge is confined in the area between the two isolines. The edge is drawn as a linear interpolation between the two associated isolines (see the green thick lines). The edge starts at left side with all the weight on the corresponding isoline, and while approaching the right side the weight is shifted according to the travelled distance. At the right side, the weight is given only to the corresponding isoline. The edge drawing inside the region is rather predictable, given the region monotonicity and the absence of saddles. An edge line is a rather smooth and robust feature and usually it is rather parallel to the bundle isolines even for long distances. We argue that such retrieving can be sufficiently adequate in most cases. This relaxation is visually acceptable, since regions are usually small, especially for natural images.

The only drawback of such technique is that narrow regions and/or high difference in values introduce lines that significanlty cross isolines, since the region extension is not able to accommodate the transition between the two maximal values. Often such edges are weak (see Figure 8 bottom right) and they are perceptually irrelevant. Such edges can be rearranged through a graph processing that allows edges to cross multiple regions before the junction. In the next section we present a synthetic y junction example.

4.3 Optimizations

4.3.1 Steepest graph simplification

The steepest graph induces a partition of the image into regions. Often, see Figure 9 top left, many regions are only one pixel thin. In practice, such regions are rather redundant, since they do not introduce any additional connectivity to the edge graph. Computationally, such divisions require extra computation and they could be simplified by a single and larger region that captures the same behaviour of the included regions.

The graph can therefore be simplified, based on a merging procedure that combines suitable adjacent regions. Two regions can be merged if the common path does not contain any saddle (preservation of monotonicity). This simplification has little impact on connectivity. In fact, no saddles are included in merged regions and the overall connectivity is unchanged. The only difference is that some edges that were separating and merging because of a local minima in gradient magnitude on the removed path, become joined in the merged region.

Another advantage in simplifying the steepest graph is that, since the localization of local maxima in gradient magnitude nodes on min-max paths is subject to small approximation errors of the min-max paths (since they are not perfectly orthogonal to isolines), the presence of narrow regions enhance such errors in edge positioning. Wider regions compensate such errors and the corresponding graph edge results more smooth. Nevertheless, drawn edges can undergo to any vectorial simplification, smoothing and minimization (as for active snakes), which is not considered in the paper.

4.3.2 Local minima in gradient magnitude

As described in Section 4, sometimes the presence of noise fragments one edge into a multiple set of parallel edges. Sometimes a main edge experiences multiple divisions and merging with an unpleasing result as in Figure 9 top left. The information associated to nodes and edges describes the span and carry. A graph processing aiming at recognizing such fragmentations can merge the nodes along the same path, so that parallel edges can be joined as a single and stronger edge. An example of such post-processing analysis is presented in Figure 9 bottom left, were edges are redrawn according to the simplified graph.

Figure 9: Edge separation due to local minima and graph simplification (2x2 images on the left) and small carry edges (right)

In Figure 9 on the left, we show a set of 2x2 detections for the same test image (16x16 pixels). For clarity, all weak edges have been removed and only the behaviour of the relevant edge is shown. There are 4 scenarios being depicted: at the top, the detection of all points on the paths is shown, while at the bottom the post-processing procedure merges nodes that are separated by a local minima. On the left, the complete steepest graph is used, while on the right the simplified graph is used to determine edges. It can be noted that the presence of (almost unnoticeable) local minima in gradient magnitude causes the division of the main edge. For this test image, noise is enough to create local minima and corresponding parallel edges. Note that in this example, no saddles cause edge separation. Stronger noise can also introduce saddles. In this case, the graph post-processing should analyze independent paths and decide to merge them according to the local behaviour.

4.3.3 Perceptually pleasing edges

Figure 10: Handling of edges at a y junction

The edge graph delivers correct connectivity, however, when edges are drawn, the resulting lines may contain abrupt changes. An example of a 24x24 image with a synthetic ’y’ junction is depicted in Figure 10. Isolines for bilinear interpolated pixels are drawn with black lines and corresponding edges are depicted in green. The junction point is recovered in the geometrically correct place, since on the left there is a single undivided bundle of isolines, while on the right the bundle get separated into two parts. Depending on the perceptual interpretation of junctions, it is possible to post-process the edge graph and to adapt the location of the junction further on the left. Basically, a node’s support is partitioned into two new nodes along the same path, if there are two edges starting from the original node and they have a significant difference in image values (the drawn line crosses many isolines on a short distance). In Figure 10 at right, we show an example of such post-processing, with a more natural interpretation of the junction. Since the edge graph contains all the needed information, it is possible to define a model for junctions and apply the post processing to produce the desired rendering of edges.

Figure 9 on the right presents an example of edges with small carries that do not contain local maxima. In such cases, the rendered edges appear as an ’s’ shaped line, which connects the main nodes with an almost orthogonal junction. Given the minimal influence, compared to principal carries of the region, the edge could be removed. Another option is again to post-process the edge graph and divide the bundle support and forward the junction to the adjacent regions. The only drawback is to increase the number of parallel edges and in general this could lead to a visually cluttered result.

4.4 Comparison with Canny’s detector

In this section we propose a critical review of the classical Canny’s detector, under the point of view of the edge model presented above.

The detector starts with an image filtering by a Gaussian smoothing controlled by a parametric and user selectable value. It removes weak minima, strengthens relevant edges and merges close-by local maxima ridges into a single and stronger edge. The automatic tuning of for optimal results is difficult lindeberg1998edge , and different regions of the image would benefit from different parameter values. The practical effect of smoothing is that weak but clear edges are removed and edge connectivity gets disrupted. The filtering worsen the treatment at edge junctions since it decreases the gradient magnitude at the junction point. Our edge extraction, instead, exploits the full amount of information of the original image and it separates the noise removal and restoration from the geometric detection of edges.

Canny’s detector works at pure pixel level. Gradient magnitude is computed and stored as new raster information, as result of a convolutional filter. Our approach computes gradient magnitudes along discrete steepest paths and they are treated as monodimensional information along the best local direction. Sobel convolution computes only gradient magnitude while gradient direction is lost. Implicitly, each pixel stores information about a single principal direction and it ignores the presence of saddles. This limits the precision of the edge positioning to integer coordinates and it introduces ambiguities in chaining the correct neighbors and branching detection, especially in low resolution context.

The non maxima suppression corresponds to the approximation of our identification of the maximal gradient along every steepest path. Canny’s algorithm performs a local non-maximality test, that removes the candidate pixel upon failure. The procedure is performed for each pixel and the information about edge support, saddles and span is simply ignored. After processing, the set of maximal pixels has also lost information about pixel neighbors, gradient directions and their connectivity. Basically, the structure of min-max paths is not considered at all.

The consequence is that the next phase executes an uninformed and local pixel chaining: the greedy iteration starts with a gradient magnitude pixel greater than a high threshold, conquers the best next local maximum (in the neighborhood), until a low threshold is reached (compare to the match of maxima on region right and left paths and edge drawing). During chaining, there is no knowledge about carry-based edge connectivity, nor edge correct direction related to gradient orientation. The low threshold avoids to loose track of the edge direction in favour of noise. This is undesirable because the side effect is to skip weak yet relevant edges with low carry and large spans. Moreover, edge connectivity can not be reconstructed in weak signal conditions, since only the predominant edge is followed, while the secondary ramification does not reach a sufficient threshold to get connected to the main edge. In our model, noise can produce a complex connectivity graph, but connectivity can always be reconstructed by graph analysis.

An edge should be natively described by a line (in terms of vector line with continuous coordinates) rather than a reconstructed sequence of chained pixels, which are modelled as a vector polyline with integer coordinates. A posteriori edge subpixel refinements are biased by the lack of information lost during convolutional smoothing and derivative filters.

5 Results

We implemented a single threaded benchmark program, with no relevant optimizations, run on a 2.5GHz Intel i7, 16 GB RAM 1600 MHz DDR3 laptop. The construction of complete steepest graph is rather stable and it costs 60 mS per Mpixel. Next phases depend on the complexity of the image. The graph simplification costs 5-6 times more. The edge graph construction takes around 3 seconds per milion of graph edges. The drawing of edges takes around 4.5 seconds per milion of graph edges to be rendered. In the context of parallel optimization, the algorithm is expected to run in real time for images up to 1 Mpixel size. At a more comprehensive set of tests is reported. For size requirements, our results are rendered as high resolution rasters, however at specified url the vector pdf files are downloadable for full comparison.

In Figure 11, we detail the complete detection procedure for the same test image of Figure 3. Steepest graph (at top center) is depicted with directed graph edges (black to white lines). The edge graph is with red to blue edges (top right). Drawn edges (bottom left and center) are colored by carry value. Green edges are shifted by (+0.5,+0.5), in order to adapt to visual perceptual interpolation of pixels. The steepest graph used for this test is simplified, in order to have a smaller edge graph. As last figure (bottom right), we show the comparison with the output of Canny’s detector, computed with the built-in function in OpenCV opencv_library (Sobel mask 3x3 and ) with gradient magnitude over-imposed to detected edgels. Note that our processing does not compute any Gaussian filtering.

Figure 11: Top row: Original image and isolines (left), isolines and steepest graph (center), steepest graph and edge graph (right). Bottom row: Steepest graph and drawn edges (left), original image and drawn edges (center), Canny’s detector (right)

Three synthetic small 24x24 pixels images are tested in Figure 12. They capture some challenging behaviours that can occur at small scale. The first one is a bi-dimensional sinusoidal wave with a period of 4 pixels. The detector correctly captures the circular peaks and valleys. Moreover, small carry edges (depicted in darker green) capture the small transfer of isolines between the peaks. Note how the non maxima suppression in Canny’s detector struggles, given the high variability of gradient direction that is not properly detected by Sobel convolution.

The second example investigates slightly rotated lines of 1 pixel width. Here the antialiasing effect is of help in determining the correct position of the main edge, which actually takes advantage of subpixel precision. Note that the detector also identifies the white and black oval shape islands that represent a dual image interpretation. Canny’s detector is not capable of detecting such detailed configuration.

The third example presents a diagonal ramp edge that is embedded in a small vertical gradient. The isolines contribute to the identification of the edge, but the bundle that supports an edge varies along the diagonal. It is interesting to note how the main edge is recovered and how the network of low carry edges brings small bundles of isolines to the fading edge at the border. The right border of the image shows how the fading edge is handled. Part of the isolines that are lost from the vertical edge are connected to the diagonal edge. The almost orthogonal connection at the diagonal edge has been discussed in Section 4.3. Canny’s detection correctly identifies the strong diagonal edge, but it fails at image corners and fading edge.

Figure 12: Tests with 24x24 pixels images. Original image and isolines (left), original image and drawn edges (center), Canny’s detector (right). Top row: Sin wave. Central row: rotated 1px thick lines. Bottom row: diagonal edge

For Lena’s image (Figure 1) we show a comparison between our detection and Canny’s. We use the simplified version of the steepest graph and we also post-process the edge graph in order to reduce the impact of local minima in gradient magnitude along the paths. In particular, we retain only local minima that are at least 2/3 less of neighbor local maxima’s magnitude along the path. This is suitable for natural images, where the original and unfiltered noise can easily break an edge into two parallel ones (that can be anyway seen along the vertical edge on the left in the background). Consider that any post-processing based on local features of the connectivity graph, rather than on a local threshold, can produce a better filtering of such cases (this would be impossible with a single parameter in Canny’s detection). Connections are always recovered, even in fuzzy positions. The edge drawing produce high quality sub-pixel lines. A further processing can be applied for vectorial smoothing and simplification for higher level processing.

An example of a structured image with buildings is presented in Figure 13. Note how the finest details with one pixels width are recovered and correctly connected, even for small gradient magnitudes.

Figure 13: Burano, Italy (320x240). Original image by Lopez Robin (left), drawn edges (center), Canny’s detection (right)

The BSDS500 arbelaez2011contour contains an annotated dataset for training and validating learning based detection. The ground truth images contain a manually annotated rasterization of contours. The numerical comparison against such dataset would be unfair, since the ground truth is a perceptual consensus of the main edges, drawn on a raster image and designed for neural network training. Our vector and subpixel output would result in poor scores because of the greater accuracy and a pure signal-based detection. For completeness, in Figure 14 we show a visual comparison of a 240x160 crop of the image #8068 from the dataset, where the precision of our detector can be appreciated. This suggests that high-quality low level information can actually feed the training phase for a perceptual selection of relevant features.

Figure 14: Crop of picture 8068 from BSDS500 (240x160). Original image (left), drawn edges (center), ground truth image (from BSDS500) (right)

6 Applications

The steepest graph structure allows to benefit from classical graph algorithms and to boost image processing capabilities. In particular, shortest path algorithm can help to selectively identify relevant edges in the image. Weighted cuts can identify edge based segmentation. Graph (sub-)isomorphism can lead to graph based vector pattern matching, 3d reconstruction from stereo images, image stitching etc..

A classification of saddles, in terms of areas contained by the isolines passing through them, allows to select which parts of the image can be perceptually merged (e.g. small peaks separated by a near split point). The graph represents the guidance for a controlled compression schema. This is one of the cases where fractal compression could perform better than other methods, since monotonic regions appears as perfect candidates for the identification of similar areas. Saddles analysis can also be used for image denoising. The edge types contained in a region (e.g. small span ones) can suggest the presence of high frequency signal corruption.

Edge features, span and support, can control a bi-dimensional decisional space for identifying blurred edge (large span and large support) vs sharp edges (small span and large support). This can control a selective image filtering, such as selective edge preserving smoothing, upsampling and area cutting while preserving the alpha blending of contours.

Edges and monotonic regions induce a rich segmentation of the image, that can guide contour detection, segmentation and feed for neural networks for high quality feature and object detection.

7 Conclusions

The paper presents an image model that allows a vectorial description of the underlying structure. The discrete construction is based on steepest graphs, which define a partition of the image into monotonic regions. The edge model stems from regions properties and it captures spatial arrangement, connectivity, span and support of each edge. The model produces accurate results starting from 2x2 images with single channel with any depth. The spatial resolution of drawn edges is natively sub-pixel, as opposed to detectors where the output is a raster image and/or discrete polyline. The correct connectivity is modeled and represented as an edge graph, as opposed to the majority of detectors. The method does not require any image pre-processing, parameters nor prior knowledge. It is global, since the steepest graph construction connects local information and defines monotonic regions that are possibly influenced by the whole image.

The graph edge is a novel description of edge features and it can be used as input of many graph processing algorithms for identification of rich higher-level features (segmentation, shape detection, feature matching, etc.). The experimental section shows the results on a selection of tough synthetic cases and natural images. As future work we plan to extend the model to the three-dimensional case and to combine multi-channel information.

This work is the result of the last 15 years of passionate research. I would like to thank Michele Petterlini for useful discussions and support along the journey. I also would like to thank my wife Fiammetta Maria Rossi for her patience and help.


  • [1] Pablo Arbelaez, Michael Maire, Charless Fowlkes, and Jitendra Malik. Contour detection and hierarchical image segmentation. IEEE transactions on pattern analysis and machine intelligence, 33(5):898–916, 2011.
  • [2] G. Bradski. The OpenCV Library. Dr. Dobb’s Journal of Software Tools, 2000.
  • [3] John Canny. A computational approach to edge detection. In Readings in computer vision, pages 184–203. Elsevier, 1987.
  • [4] Vicent Caselles and Pascal Monasse. Geometric description of images as topographic maps. Springer, 2009.
  • [5] Francine Catté, Pierre-Louis Lions, Jean-Michel Morel, and Tomeu Coll. Image selective smoothing and edge detection by nonlinear diffusion. SIAM Journal on Numerical analysis, 29(1), 1992.
  • [6] Stanley Coren and Joan S Girgus. Seeing is deceiving: The psychology of visual illusions. Lawrence Erlbaum, 1978.
  • [7] Daniel Cremers, Mikael Rousson, and Rachid Deriche. A review of statistical approaches to level set segmentation: integrating color, texture, motion and shape. International journal of computer vision, 72(2):195–215, 2007.
  • [8] Piotr Dollár and C Lawrence Zitnick. Structured forests for fast edge detection. In Proceedings of the IEEE international conference on computer vision, pages 1841–1848, 2013.
  • [9] Richard O Duda, Peter E Hart, and David G Stork. Pattern classification and scene analysis, volume 3. Wiley New York, 1973.
  • [10] Christopher G Harris, Mike Stephens, et al. A combined corner and edge detector. In Alvey vision conference, volume 15, 1988.
  • [11] Txomin Hermosilla, E Bermejo, A Balaguer, and Luis A Ruiz. Non-linear fourth-order image interpolation for subpixel edge detection and localization. Image and vision computing, 26(9), 2008.
  • [12] Kris Jensen and Dimitris Anastassiou. Subpixel edge localization and the interpolation of still images. IEEE transactions on Image Processing, 4(3):285–295, 1995.
  • [13] Michael Kass, Andrew Witkin, and Demetri Terzopoulos. Snakes: Active contour models. International journal of computer vision, 1(4):321–331, 1988.
  • [14] Scott Konishi, Alan L. Yuille, James M. Coughlan, and Song Chun Zhu. Statistical edge detection: Learning and evaluating edge cues. IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(1):57–74, 2003.
  • [15] Tony Lindeberg. Edge detection and ridge detection with automatic scale selection. International Journal of Computer Vision, 30(2):117–156, 1998.
  • [16] Michael Maire, Pablo Arbeláez, Charless Fowlkes, and Jitendra Malik. Using contours to detect and localize junctions in natural images. In

    2008 IEEE Conference on Computer Vision and Pattern Recognition

    , pages 1–8. IEEE, 2008.
  • [17] Jitendra Malik, Serge Belongie, Thomas Leung, and Jianbo Shi. Contour and texture analysis for image segmentation. International journal of computer vision, 43(1):7–27, 2001.
  • [18] Josh McDermott. Psychophysics with junctions in real images. Perception, 33(9):1101–1127, 2004.
  • [19] Giuseppe Papari and Nicolai Petkov. Edge and line oriented contour detection: State of the art. Image and Vision Computing, 29(2-3):79–103, 2011.
  • [20] Judith MS Prewitt. Object enhancement and extraction. Picture processing and Psychopictorics, 10(1):15–19, 1970.
  • [21] Lawrence G Roberts. Machine perception of three-dimensional solids. PhD thesis, Massachusetts Institute of Technology, 1963.
  • [22] Linda Shapiro and George Stockman. Computer Vision. Prentice Hall, 2001.
  • [23] Jamie Shotton, Andrew Blake, and Roberto Cipolla. Multiscale categorical object recognition using contour fragments. IEEE transactions on pattern analysis and machine intelligence, 30(7):1270–1281, 2008.
  • [24] Saining Xie and Zhuowen Tu. Holistically-nested edge detection. In Proceedings of the IEEE international conference on computer vision, pages 1395–1403, 2015.
  • [25] Djemel Ziou, Salvatore Tabbone, et al. Edge detection techniques-an overview. Pattern Recognition and Image Analysis C/C of Raspoznavaniye Obrazov I Analiz Izobrazhenii, 8:537–559, 1998.

Appendix: Proofs

Lemma 1 (Saddle point and isolines)

A saddle point is positioned at iff there are two distinct and equally valued isolines that intersect at .


() By definition are in clockwise order around . Since is continuous and , there is a point on the segment such that . The same can be said for any pair and respectively along the curves between and . Therefore, an isoline is detected between the two curves. The same can be applied to the other three cases.

() Let us consider the three cases: (1) is inside a pixel. Since the pixel is bilinear interpolated, there are two distinct lines, only if . Therefore the pixel is a split pixel and the four corners can be assigned to s. The segments from corners to fulfil the saddle property. (2) lies on a pixel side. In this case there is at most one isoline per pixel and therefore it is not possible to identify two distinct lines crossing . (3) lies on a corner. Each adjacent pixel to has one isoline reaching . The neighbors of can be associated to s and the corresponding segments towards fulfil the saddle property. ∎

Lemma 2 (Split pixel corners value)

Given a split point , associated to the split pixel , it can either be ,, and or the same relationships with inverted order. Informally, two opposite corners are greater than .


Let us assume that Recall that and ,

A split pixel implies that and . Let us assume that . We show that , , . The case is symmetrical.

implies that and . This means that for any , since the gradient along the y axis is constantly equal to 0. Equally, for any .

In particular , which implies that . Since is a linear interpolated value between and , it follows that . With equivalent arguments, and . ∎

Lemma 3 (There is at most one isoline that passes inside a pixel and on one of its corners)

Given a pixel with corner , the isoline passing through solves the equation . Given the bilinear interpolation, the line is unique and there is at most one line that intersects the pixel area.


W.l.o.g. let us assume that the pixel is placed in , so that the corner is the bottom left. The isoline solves the equation , where and . It follows that the function describing the isoline is . The function, except for its asymptotic point in is continuous. Moreover if , it follows that and the line crossing (0,0) enters the pixel. If , and the function intersects the pixel only at the corner. ∎

Lemma 4 (Mix point characterization)

The following statements are equivalent:

(i) A mix point exists at integer coordinate

(ii) each of the four pixels adjacent to contains an isoline with value that reaches the pixel border at

(iii) neighborhood is such that , , , , , ,


(i) (ii)

By definition there are two lines and delimited respectively by and . If the points are outside the area obtained by the union of the four pixels containing , they can be trimmed and placed on the intersection of the lines and the area’s perimeter. Since the function is continuous, it follows that there must be four distinct isolines starting from that interleave the increasing paths. In fact, for any consecutive pair (clockwise selected),e.g. , there must be a point along the segment such that . Since all points are distinct, it follows that also is inside the pixel and it causes an isoline to be inside the pixel. Since each pixel can host at most an isoline with value , each pixel contains exactly an isoline which extends inside the pixel.

(ii) (iii) In the absence of split pixels and having a continuous function on each pixel, the isoline through divides the pixel into two areas that contain the isolines greater (lesser) than . In Figure 15, we depict in red the greater isolines and in blue the lesser isolines. It follows that (I(0,1)-R(p)) has opposed sign to (I(1,2)-R(p)) and the property (iii) holds.

(iii) (i) W.l.o.g. let us assume that . We can assign , , , and create and accordingly. Since each side is linearly interpolated, we have four monotonic lines and a mix point in . ∎

Figure 15: Mix point relationships with isolines
Lemma 5 (Non minima joining)

Given a non minimal node with no incoming edges and the graph built by steps 1,2 and 3, there is a new edge that does not intersect a diagonal edge and that connects the node to a lower valued node.


Since is not a local minimum, it exists at least another point such that . Let us consider the case where the segment is a diagonal crossing the pixel and the graph already contains the other green diagonal () as shown in Figure 5 right. Since was the best choice for , it follows that and . Moreover, since we could consider a diagonal edge, it follows that the pixel does not contain a split point. We have two cases: (blue) . Since there is no split pixel it follows that . If (red), since , it can not be that , since all values are distinct. It follows that necessarily . In both cases the edge is a valid candidate. The proof for the other diagonal orientation is symmetrical. ∎

Lemma 6 (Dag)

The graph is a directed acyclic graph.

Each edge in the steepest graph connects two neighbors nodes such that . Therefore, no cycles are allowed, since each edge connects different and ordered values nodes. ∎

Lemma 7 (Planar graph)

The graph is planar


The nodes embedding in the plane is straightforward, since nodes are associated to discrete pixel points. It is sufficient to show that no edges cross each other. The only possible edges intersection can happen on the two diagonals of a pixel. By construction, steps 1 and 2 introduce no diagonals. Step 3 can not introduce two crossing diagonals over the same pixel, since the two different corners on a pixel could not identify different nodes as corresponding best next nodes, since they both include the other pixels corners in their neighborhood. Therefore, it can not be the case that crossing edges are selected. Step 4 is performed incrementally and guarantees the absence of crossing diagonals. ∎

Lemma 8 (All saddles are connected)

The graph contains, for each saddle, at least a path that connects it to a local extrema.


Since split points are not represented by a node in the steepest graph, let us map the property to each of the four corners of a split pixel. In particular, we state that the two greater (lower) than split value nodes are connected to a local maxima (minima).

The case starting from greater than split value nodes is trivial, since the discrete increasing steepest path reaches a local maxima. It is possible to recursively expand, in a depth first search style, the reversed edges incoming to the node. If no steepest paths are able to reach a local minimum, the edge addition of step 4 allows to extend the search to other steepest paths. Eventually the additions reach a minimum, since the image is finite and every edge decreases the image value.

In case of a mix point node, the arguments are equivalent, since there are two greater (lower) valued points in the neighborhood that are added at step 2. ∎

Lemma 9 (Correct connectivity)

A path starting from a local minimum and ending to a local maximum in the graph is a monotonic increasing path embedded in R.


We inductively proof the statement. Starting from a minimum, this is a collapsed increasing path. Any edge extending the previous path, which already is a monotonic path in R, maintains the property. If the edge covers a pixel side, the bilinear interpolation trivially produces a monotonic increasing path along the corresponding segment in . If the edge covers a diagonal, it follows that there is no split pixel. Moreover, . If there is a isoline of value inside the pixel, then the isolines lands on the pixel perimeter and from there, a monotonic increasing path can be found around the perimeter, until is reached. If there is no isoline of value inside the pixel, the segment is a monotonic increasing path in . ∎

Lemma 10

A monotonic region contains no self intersecting isolines.

A monotonic region contains no saddles by construction. A non saddle point inside a pixel is traversed by a single isoline. A point on the pixel side can be traversed by two isolines (one on each neighboring pixel) that merge at the side. A non mix-point corner contains two isolines that connect at the corner. Note that three isolines on three out of four pixels containing the corner impose that the fourth pixel contains an isoline (by continuity of the four piecewise bilinear functions). It follows that no intersecting isolines are present in a monotonic region.

Lemma 11

The non collapsed part of a monotonic region has exactly one minimum and one maximum in image values on its perimeter.


The perimeter is composed of differently oriented graph edges. Since the region contains no saddles and is continuous, all isolines in the region connect two specific points on the perimeter. It follows that there is a total ordering of two subsets of perimeter points. In particular there is a minimum and a maximum on the perimeter, that correspond to collapsed isolines. ∎