Skip to main content

Efficient Gaussian Distance Transforms for Image Processing

  • Conference paper
  • First Online:
Advanced Data Mining and Applications (ADMA 2019)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 11888))

Included in the following conference series:

  • 1773 Accesses

Abstract

This paper presents Gaussian distance transform (GDT) of images and demonstrates its applications to image partition and image filtering. The time complexity of the naive implementation of GDT is quadratic on the image size and is thus computationally intractable for real time applications and for high resolution images. To address this issue, we investigate the properties of GDT and show that GDT can be conducted in linear lime using well known matrix search algorithms. Experimental results are provided to show the applications of GDT to image partition and image filtering.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Aggarwal, A., Klawe, M.M., Moran, S., Shor, P., Wilber, R.: Geometric applications of a matrix-searching algorithm. Algorithmica 60(2), 195–208 (1987)

    Article  MathSciNet  Google Scholar 

  2. Fabbri, R., Costa, L.D.F., Torelli, J.C., Bruno, O.M.: 2D euclidean distance transform algorithms: a comparative survey. ACM Comput. Surv. (CSUR) 40(1), 2 (2008)

    Article  Google Scholar 

  3. Felzenszwalb, P., Girshick, R., McAllester, D., Ramanan, D.: Object detection with discriminatively trained part based models. IEEE Trans. Pattern Anal. Mach. Intell. 32(9), 1627–1645 (2010)

    Article  Google Scholar 

  4. Felzenszwalb, P., Huttenlocher, D.: Distance transforms of sampled functions. Technical Report TR2004-1963, Conell Computing and Information Science (2004)

    Google Scholar 

  5. Meijster, A., Roerdink, J.B., Hesselink, W.H.: A general algorithm for computing distance transforms in linear time. In: Goutsias, J., Vincent, L., Bloomberg, D.S. (eds.) Mathematical Morphology and Its Applications to Image and Signal Processing, pp. 331–340. Springer, Boston (2002)

    Chapter  Google Scholar 

  6. Pandey, M., Lazebnik, S.: Scene recognition and weakly supervised object localization with deformable part-based models. In: 2011 International Conference on Computer Vision, pp. 1307–1314. IEEE (2011)

    Google Scholar 

  7. Ribas, L.C., Neiva, M.B., Bruno, O.M.: Distance transform network for shape analysis. Inf. Sci. 470, 28–42 (2019)

    Article  Google Scholar 

  8. Subr, K., Soler, C., Durand, F.: Edge-preserving multiscale image decomposition based on local extrema. In: ACM Transactions on Graphics (TOG), vol. 28, p. 147. ACM (2009)

    Article  Google Scholar 

Download references

Acknowledgement

This work was supported by a Faculty of Science and Engineering Research and Development Committee Small Grants Program of Curtin University.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Senjian An .

Editor information

Editors and Affiliations

Appendix: Proof of Theorem 1

Appendix: Proof of Theorem 1

Consider the optimization problem (5)

$$\begin{aligned} \begin{array}{rcl} VT_{\gamma }(x)&{}=&{}\displaystyle \max _{y\in \varOmega }\{J(y)-\gamma D_p^p(x,y)\\ &{}=&{} \displaystyle \max _{y_1,y2}\{J(y_1,y_2)-\gamma \vert x_1-y_1\vert ^p-\gamma \vert x_2-y_2\vert ^p\}\\ &{}=&{} \displaystyle \max _{1\le y_1\le m}\{J(y_1,x_2)-\gamma \vert x_1-y_1\vert ^p\}\\ J(y_1,x_2)&{}\triangleq &{} \displaystyle \max _{1\le y_2\le n}\{J(y_1,y_2)-\gamma \vert x_2-y_2\vert ^p\}. \end{array} \end{aligned}$$
(17)

The core problem is the following 1D grid optimization with a given sequence f(i) with length l.

$$\begin{aligned} g(j)=\max _{1\le i\le l}\{ f(i)-\gamma \vert j-i\vert ^p\}, 1\le j\le l. \end{aligned}$$
(18)

Later we will show that this sequence transform problem can be solved in O(l) time. The matrix J can be obtained by calling the sequence transform (18) m times, for \(y_1=1,2,\cdots m\), each time setting \(f(i)=J(y_1,i)\) where \(i=1,2,\cdots ,n\). This procedure takes O(mn) time. Then based on J, the matrix \(VT_{\gamma }\) can be obtained by calling (18) n times, for \(x_2=1,2,\cdots ,n\), each time setting \(f(i)=J(i,x_2)\) where \(i=1,2,\cdots ,m\). This procedure takes O(mn) time. So the total time complexity is linear in terms of the matrix size.

Now we show the sequence transform (18) can be solved in linear time. First we prove that this problem is related to a well-known matrix search problem in combinational optimization.

A matrix A is called a Monge Matrix if it satisfies the so-called Monge Property

$$\begin{aligned} A[i,j]+A[k,l]\le A[i,l]+A[k,j], \forall i<k, j<l. \end{aligned}$$
(19)

A is called Inverse Monge Matrix if the above the inequalities hold in the reverse directions, i.e.,

$$\begin{aligned} A[i,j]+A[k,l]\ge A[i,l]+A[k,j], \forall i<k, j<l. \end{aligned}$$
(20)

An handy property of Monge matrices for us to check its Monge property is that the Monge property (or inverse Monge property) holds if and only if it holds for adjacent rows and adjacent columns, that is, it suffices to check

$$\begin{aligned} A[i,j]+A[i+1,j+1]\le A[i,j+1]+A[i+1,j], \forall i, j \end{aligned}$$
(21)

for Monge property, or

$$\begin{aligned} A[i,j]+A[i+1,j+1]\ge A[i,j+1]+A[i+1,j], \forall i, j \end{aligned}$$
(22)

for inverse Monge property.

Another property of inverse Monge matrices is that inverse Monge matrices are totally monotone matrices and its row maxima can be found in \(O(n+m)\) time by SMAWK algorithm [1]. Note that reversing the order of its rows turns a Monge matrix into an inverse Monge matrix. And therefore, the row maxima of a Monge matrix can also be found in linear time by SMAWK algorithm.

Next, we show that the sequence transform (18) is equivalent to a Monge matrix search problem. Define

$$\begin{aligned} A(i,j)=f(j)-\gamma \vert i-j\vert ^p, \end{aligned}$$
(23)

then we have

Lemma 2

Let A be defined as in (23). Then A is an inverse Monge matrix if \(p\ge 1\).

Proof: Let

$$\begin{aligned} \begin{array}{rcl} \delta &{}\triangleq &{}\{A(i,j)+A(i+1,j+1)\}\\ &{}&{} -\{A(i,j+1)+A(i+1,j)\}\\ &{}=&{} \vert i-j-1\vert ^p+\vert i+1-j\vert ^p-2\vert i-j\vert ^p. \end{array} \end{aligned}$$
(24)

To prove the inverse Monge property of A, it suffices to show \(\delta \ge 0\).

When \(i=j\), then \(\delta =2>0\). Now assume that \(i\not = j\) and let \(s\triangleq \vert i-j\vert \). Note that \(s\ge 1\). Then \(\delta =(s+1)^p+(s-1)^p-2s^p\). Now let \(t=\frac{1}{s}\) and \(\xi (t)=\delta /(s^c)=(1+t)^p+(1-t)^p-2\). Note that \(t\in (0,1]\) and \(\mathrm {sign}(\delta )=\mathrm {sign}(\xi )\). Consider the derivative of \(\xi (t)\)

$$\begin{aligned} \begin{array}{rcl} \xi ^{\prime } (t)&{}=&{}(p-1)(1+t)^{p-1}-(p-1)(1-t)^{p-1}\\ &{}=&{}(p-1)\{(1+t)^{p-1}-(1-t)^{p-1}\}\\ &{}\ge &{} 0, \forall t\in [0,1]. \end{array} \end{aligned}$$
(25)

Note that \(\xi (0)=0\) and \(\xi (t)\) is a non-decreasing function in [0, 1]. Therefore \(\xi (t) \ge 0\) for any \(t\in [0,1]\) and \(\delta \ge 0\). So A is an inverse Monge matrix.

   \(\square \)

Lemma 3

Let A be defined as in (23) except that all diagonals A(i, i) are defined as \(-\infty \). Then A is a Monge matrix.

Proof: Let

$$\begin{aligned} \begin{array}{rcl} \delta &{}\triangleq &{}\{A(i,j)+A(i+1,j+1)\}\\ &{}&{} -\{A(i,j+1)+A(i+1,j)\}\\ &{}=&{} \vert i-j-1\vert ^p+\vert i+1-j\vert ^p-2\vert i-j\vert ^p. \end{array} \end{aligned}$$
(26)

To prove the Monge property of A, it suffices to show that \(\delta \le 0\).

When \(i=j\), \(\delta <0\) since the diagonals are \(-\infty \). Now assume that \(i\not = j\) and let \(s\triangleq \vert i-j\vert \). Note that \(s\ge 1\). Then \(\delta =(s+1)^p+(s-1)^p-2s^p\). Now let \(t=\frac{1}{s}\) and \(\xi (t)=\delta /(s^p)=(1+t)^p+(1-t)^p-2\). Note that \(t\in (0,1]\) and \(\mathrm {sign}(\delta )=\mathrm {sign}(\xi )\). Consider the derivative of \(\xi (t)\)

$$\begin{aligned} \begin{array}{rcl} \xi ^{\prime } (t)&{}=&{}(p-1)(1+t)^{p-1}-(p-1)(1-t)^{p-1}\\ &{}=&{}(p-1)\{(1+t)^{p-1}-(1-t)^{p-1}\}\\ &{}\le &{} 0, \forall t\in [0,1]. \end{array} \end{aligned}$$
(27)

Note that \(\xi (0)=0\) and, when \(p\in [0,1]\), \(\xi (t)\) is a non-increasing function in [0, 1]. Therefore \(\xi (t) \le 0\) for any \(t\in [0,1]\) and thus \(\delta \le 0\) which implies that A is a Monge matrix.

In summary, the 1D sequence transform problem is equivalent to a Monge matrix search problem which can be solved in linear time, and therefore concluding the proof of Theorem 1.

   \(\square \)

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

An, S., Liu, Y., Liu, W., Li, L. (2019). Efficient Gaussian Distance Transforms for Image Processing. In: Li, J., Wang, S., Qin, S., Li, X., Wang, S. (eds) Advanced Data Mining and Applications. ADMA 2019. Lecture Notes in Computer Science(), vol 11888. Springer, Cham. https://doi.org/10.1007/978-3-030-35231-8_49

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-35231-8_49

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-35230-1

  • Online ISBN: 978-3-030-35231-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics