Abstract
Quantifying shape complexity is useful in several practical problems in addition to being interesting from a theoretical point of view. In this paper, instead of assigning a single global measure of complexity, we propose a distributed coding where to each point on the shape domain a measure of its contribution to complexity is assigned. We define the shape simplicity as the expressibility of the shape via a prototype shape. To keep discussions concrete we focus on a case where the prototype is a rectangle. Nevertheless, the constructions in the paper is valid in higher dimensions where the prototype is a hyper-cuboid. Thanks to the connection between differential operators and mathematical morphology, the proposed construction naturally extends to the case where diamonds serve as the prototypes.
Access provided by Autonomous University of Puebla. Download conference paper PDF
Similar content being viewed by others
1 Introduction
Given an 8-connected digital binary pattern representing a digital shape as a mapping \(\mathbb {Z}^2 \rightarrow \left\{ 0,1 \right\} \), we are interested in quantifying, at each point on the pattern, the likelihood that the point belongs to a maximal prototype shape that fits the digital shape represented by the binary pattern in question. For the prototype shape, the measure is expected to be uniformly zero over the shape. The prototype shape serves as the simplest shape in a certain context.
The practical use of such a measure is two fold: First, if integrated over the pattern, the resulting number can be used as a measure of the tileability of the shape by the maximal prototype shape, which in turn can be used to quantify shape’s complexity. Second, directly as a local measure, it can be useful in identifying the locations to cut the shape so that the resulting pieces are tileable by the maximal prototype. A perfectly tileable shape can be digitally represented with maximum compression. By local culprits, we mean the points where the measure is significantly low, as they are the points responsible for the failure of tileability.
In this work, we focus on the case where the prototype shape is a rectangle. Nevertheless, as we discuss in Sect. 4, by changing the underlying metric the method naturally extends to the case where the prototype is a diamond. Though we illustrate the method only on 2D shapes (not necessarily simply connected), all discussions are valid in higher dimensions.
Quantifying rectangularity has practical uses in several applications e.g. urban planning and landscape ecology [1]. Rectangularity measures are also used to improve over-segmented images [2]. In the literature, there are several global measures for quantifying the conformity of a shape to a simple prototype [3,4,5]. These global measures do not convey point-wise information. For circular shapes defined in \(\mathbb R^2\), the method in [6] provide local information for quantifying conformity to circles.
A related problem of recent interest is quantifying the complexity of high-dimensional datasets for estimating their classification difficulty. Varshney and Willsky [7] measured their classifiers in terms of level sets of the decision hypersurfaces’ geometrical complexity using \({\mathbf \epsilon }\)-entropy. A growing number of works emphasize the role of the shape of the decision hypersurface as a determinant of either how complex the data is or how robust its classification by a certain classifier. An interesting claim by Fawzi et al. [8] is that vulnerability to adversarial attacks is related to positive curvature of the decision boundary. Fawzi et al. further attributed the robustness of the popular deep networks to the flatness of the shape of the produced decision boundaries.
Our construction relies on the connection between differential operators and shape sets, the so-called structuring elements of the mathematical morphology. Specifically, we resort to applying morphological derivatives to numerically approximate the infinity-Laplacian as in [9]. Proper numerical realizations of PDEs mimicking morphological process is an important issue. Among the recent works is [10] where the flux-corrected transport scheme to the PDE implementation of erosions and dilations with arbitrary structuring elements is considered.
2 Method
For a shape A, we consider the following PDE with the infinity Laplacian:
In numerical solutions to (1), \(\rho \) is chosen to be equal to the shape radius, i.e. the maximal value of \(L^\infty \) (chessboard) distance transform. After obtaining \(f_A\), it is normalized such that the maximum value of the field is 1. These ensure the scale invariance of \(f_A\). To acquire numerical solutions, the approximation to Laplace operator in \(L^\infty \) [9],
is used where B(x) denotes a unit ball centered at x. The numerical solution to (1) can be acquired by using the scheme proposed in [5].
This equation is favorable for us because the level curves of \(f_A\) roughly serve as gradual transformation of the shape boundary \(\partial A\) towards a square under the influence of the diffusion governed by the \(L^\infty \) metric. The points at a system governed by (1) generate and cumulate the values of the field, \(f_A\). For squares, due to their isotropy in \(L^\infty \), the total accumulated values of points equidistant from the boundaries are the same. Therefore, for a square S, the value of the field at x depends only on the minimum distance of x to boundary (equivalently, on its distance to the shape center, by which we mean the points attaining the maximum distance transform value). The equidistant points form an equivalence class. As a result, the problem of acquiring an analytic solution reduces to disjoint one dimensional problems over regions of the square, which are continuous on the intersection on the regions.
Consider the points \(P_1\) and \(P_2\) as given in Fig. 1. Since they are equidistant from the boundaries, \(f_S\) attains the same values at these two points by the above reasoning. Furthermore, this is true for all points having the same y coordinates in the shaded region \(R_1\). In this region, \(f_S\) changes in the y direction only, i.e. \(\partial f_S / \partial x = 0\). Analogous arguments apply for points in \(R_2\) where instead of y, x coordinates determine the equivalence classes. By the continuity of the field on the intersection of \(R_1\) and \(R_2\), the equivalence classes span both regions, and each is a square by itself.
With these, (1) reduces to
In \(R_1\), for the homogeneous part \(f_{S,h} = A \exp \{ y/\rho \} + B \exp \{ -y/\rho \}\), and for the inhomogeneous part \(f_{S,p} = \rho ^2\). Due to the symmetry of the boundary conditions, the acquired solution is invariant under \(y \mapsto -y\) changes. This dictates \(A = B\). Applying the boundary condition we acquire
Following the same steps, the solution in \(R_2\) is acquired. The joint solution is given in the closed form as
Although this solution is derived for a square, it applies for rectangles as well. This is because the equivalence classes of a square, which are again squares, deform to rectangles: the distances to boundary and the shape center still add up to \(\rho \) since the shape center is a line for a rectangle rather than a single point. The validity of the acquired solution for the elongated unit-circle (rectangle in this case) is due to \(L^\infty \) norm, and in the general scheme does not hold. For example, in the case of \(L^2\), an analytical solution for which is given in [6], circles are the corresponding equivalence classes, yet, the solution for circles does not apply for ellipses.
In the present form the solution is not translation invariant. To make it so, implicit reference to the origin should be removed. This can be satisfied by reformulating (4) in terms of \(L^\infty \) distance transform since \(\max {\{|x|,|y|\}} = \left\Vert (x,y) \right\Vert _\infty \). We acquire:
where \(t'^\infty = 1 - t^\infty / \rho \), and \(t^\infty \) refers to \(L^\infty \) distance transform of S.
In Fig. 2, the difference between the normalized (i.e. has 1 as its maximum value) numerical solution \(\hat{f}_{S,numerical}\) and the normalized analytical solution \(\hat{f}_{S,analytical}\) for a square of side length 256 is displayed.
The maxima of the non-normalized fields are 5766.3 and 5797.8, respectively. However, the mean error between the normalized fields is
This is an acceptable error rate, considering that numerical solution is acquired to a first order approximation.
To construct a measure valid for all shapes, we need (5) to extend beyond rectangles. Thankfully, the solution is in terms of the distance transform of the shape and can be deployed as is as an extension of the field. Then for any shape A,
With the choice that we have here, we can assign scores of contribution to complexity to each point in the shape by simply subtracting the assumed extension from the numerically acquired solution. Thus we define the complexity encoding field \(d_A\) as
This corresponds to measuring the error in assuming each point is coming from a square of radius \(\rho \) in which the point is located \(\rho \,t'^\infty \) away from the center.
Acquired fields, \(\hat{f}_{A,numerical}\) and \(d_A \), for a square with an appendage of size \(64\times 128\) on one side are shown in Fig. 3.
This, being one of the simplest cases of complexity, is informative in understanding the behavior of the proposed field. High negative values occur around the rectangular appendage. Pixels near boundary, be them of base square or appendage, attain smaller values and would be disregarded in a thresholded treatment of the field. The extrema is attained at the two center pixels in the vertical direction along the edge of the square.
3 Illustrative Experiments
In all the experimental results depicting \(d_A\)s, if the color bar is not shown, the color scale is between 0 and \(-0.446\) where the yellow denotes zero. In the first experiment, we demonstrate the method on composite rectangles of constant width. The size of the square is \(64\times 64\), i.e., one quarter of the previous square used in Fig. 2. As shown in Fig. 4, these shapes have no pixels that increase the complexity. Slight fluctuations in \(d_A\) are due to the first order approximation to \(f_{A,numerical}\).
In the second experiment, we apply the method to floor plans of increasing complexity. Results are depicted in Fig. 5. The first floor plan is composed of four identical rooms. This plan has no pixels that increase the complexity. As we introduce missing or extra segments, respective locations start to attain negative \(d_A\) values. The last floor plan consists of multiple rooms of varying sizes. The two rooms of the largest size are deemed as the simplest with \(d_A\) values near zero. \(d_A\) attain higher negative values inside the smaller rooms. Note that the measure \(d_A\) is parameterless. As such it implicitly measures the deviation from the rectangle that maximally fits into the shape due to the choice of \(\rho \) (Sect. 2). Hence, smaller rooms are identified as parts of the plan that increase the plan’s complexity.
For specific purposes, however, one might be tolerant of the size or interested in identifying complexity with reference to a prototype shape of certain size rather than the maximal size. To this end, one can simply treat \(\rho \) as a parameter. In that case positive values for \(d_A\) arise in the central parts of larger rectangles. This is illustrated in Fig. 6. The rightmost figure shows the original result from Fig. 5, i.e., \(\rho ' = \rho \). In the remaining two results, notice that \(d_A\)s take both negative and positive values as indicated by the color bars. In the leftmost figure, \(\rho ' = 8\rho /9\) coinciding with the width of the two identical square-shaped rooms on the right-side of the plan. Inside these two rooms \(d_A\) is almost uniformly zero as indicated by the color bar. Furthermore, the number of pixels where \(d_A\) is negative decreases.
In the third experiment, we explore quantifying the shape complexity with a single value by using \(1000 \times \text {mean}(|d_A|)\) rounded to the closest integer. Some illustrative results are shown in Fig. 7.
In the final experiment we explore how we can simplify a complex shape towards a rectangle. We had observed that the local extrema of \(d_A\) are near the centers of regions that increase complexity. Furthermore, at the extrema, the gradient of \(f_{A,numerical}\) indicates the position of such regions relative to the shape body. Thus, the orthogonal direction to the gradient reveals the directions to cut in order to acquire a more rectangular shape.
As a proof of concept, we developed a greedy iterative algorithm. It uses both fields at each iteration step, \(d_A\) providing information on the cut location and \(f_{A,numerical}\) providing information on the cut direction. For example, for the square with an appendage (Fig. 3), the mean gradient of \(f_{A,numerical}\) at the two neighboring extrema of \(d_A\) has no component in y direction. Therefore, the shape is cut along the y direction from these extrema, separating the base square and the appendage.
Illustrative cuts are shown in Fig. 8. When determining the direction normal to the gradient, the numerically computed direction is replaced with the direction of closest axis if the angle between them is lesser than 2.86 degrees (\(\approx \arctan 0.05\)).
4 Summary and Future Work
We proposed a new measure \(d_A\) for distributed coding of the shape complexity. Each pixel on the shape is assigned a value \(d_A\) quantifying the pixel’s contribution to overall complexity where the simplicity is understood as the expressibility of the shape in terms of an assumed prototype. Throughout the paper we assumed that the prototype is a rectangle (or hyper-cuboid in higher dimensions). We have performed proof of concept experiments to demonstrate the practical applicability of the method.
To first order approximation, the proposed method relies on partial differential equations driven by the morphological Laplacian. An interesting future research based on this would be changing the underlying metric and using a corresponding structuring element that represents the unit circle of the chosen metric. Then, the distance transform appearing in the analytical solution can be computed, for example, in \(L^1\) to acquire a similar shape descriptor addressing rhombicity. In the numerical solution part, this can be imitated by using a diamond structuring element instead of a square one. Sample results for \(L^1\) acquired in this way are displayed in Fig. 9.
References
Moser, D., Zechmeister, H.G., Plutzar, C., Sauberer, N., Wrbka, T., Grabherr, G.: Landscape patch shape complexity as an effective measure for plant species richness in rural landscapes. Landscape Ecol. 17(7), 657–669 (2002)
Ngo, T.-T., Collet, C., Mazet, V.: Automatic rectangular building detection from VHR aerial imagery using shadow and image segmentation. In: IEEE International Conference on Image Processing, pp. 1483–1487 (2015)
Maragos, P.: Pattern spectrum and multiscale shape representation. IEEE Trans. Pattern Anal. Mach. Intell. 11(7), 701–716 (1989)
Rosin, P.L., Zunic, J.: Measuring squareness and orientation of shapes. J. Math. Imaging Vis. 39(1), 13–27 (2011)
Arslan, M.F., Tari, S.: Complexity of shapes embedded in \(\mathbb{Z}^n\) with a bias towards squares. IEEE Trans. Image Process. 5(6), 922–937 (2020)
Genctav, A., Tari, S.: Discrepancy: local/global shape characterization with a roundness bias. J. Math. Imaging Vis. 61(1), 160–171 (2019)
Varshney, K.R., Willsky, A.S.: Classification using geometric level sets. J. Mach. Learn. Res. 11, 491–516 (2010)
Fawzi, A., Moosavi-Dezfooli, S., Frossard, P.: The robustness of deep networks: a geometrical perspective. IEEE Signal Process. Mag. 34(6), 50–62 (2017)
Oberman, A.: A convergent difference scheme for the infinity Laplacian: construction of absolutely minimizing Lipschitz extensions. Math. Comput. 74(251), 1217–1230 (2005)
Breuß, M., Weickert, J.: Highly accurate PDE-based morphology for general structuring elements. In: Tai, X.-C., Mørken, K., Lysaker, M., Lie, K.-A. (eds.) SSVM 2009. LNCS, vol. 5567, pp. 758–769. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02256-2_63
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Arslan, M.F., Tari, S. (2021). Local Culprits of Shape Complexity. In: Elmoataz, A., Fadili, J., Quéau, Y., Rabin, J., Simon, L. (eds) Scale Space and Variational Methods in Computer Vision. SSVM 2021. Lecture Notes in Computer Science(), vol 12679. Springer, Cham. https://doi.org/10.1007/978-3-030-75549-2_8
Download citation
DOI: https://doi.org/10.1007/978-3-030-75549-2_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-75548-5
Online ISBN: 978-3-030-75549-2
eBook Packages: Computer ScienceComputer Science (R0)