1 Introduction

Detection of edges is a fundamental problem in a variety of applications, including image processing and the numerical solution of differential equations. In applications such as magnetic resonance imaging (MRI), it is required to construct images from Fourier data. Let \(\{ {\hat f}_k \vert k = 0, \pm 1, \pm 2, \cdots \}\) be the set of Fourier coefficients of f(x) ∈ L 2[−π, π] given by

$$\displaystyle \begin{aligned} {\hat f}_k = {1\over{2\pi}} \int^\pi_{-\pi} f(x) e^{-ikx}dx, \end{aligned}$$

and let f N be the Fourier partial sum \( f_N = \sum _{k = -N}^N {\hat f}_k e^{ik x}. \) When the underlying function is smooth and periodic, the Fourier reconstruction f N is accurate to spectral accuracy, but when edges are present, the reconstruction is plagued by the Gibbs phenomenon, also known as the Gibbs ringing in MRI applications.

Various methods have been proposed to address these issues and those methods consist of edge detection followed by reconstruction. Thus, the determination of edge locations is critical. Fourier concentration method has emerged over the past decade as a robust method for edge detection in a variety of circumstances and applications [5, 6]. Essentially, a certain Fourier partial sum converges to the jump function as the number of Fourier coefficients increases and this convergence can be accelerated by what is known as concentration factors (functions). Use of different types of concentration factors tends to impart trade-offs between oscillations near jump discontinuities and significant non-zero concentration away from them [2]. Several methods have been devised to address this issue, as well as to treat special circumstances such as incomplete Fourier data and the presence of noise [1, 4, 13, 15].

Thanks to the convergence property of the Fourier concentration to the jump function, the concentration method detects edges with large concentrations. Where the function is smooth, the concentration vanishes as the jump function vanishes as N →. In practice, the concentration method is designed to detect edges with magnitudes larger than some given threshold, with the value of the used threshold being problem dependent. The value of the threshold cannot be arbitrarily small; otherwise, too many false edges can be detected. If the magnitude of weak edges is much smaller than other edges, those edges are considered insignificant, but for some cases weak edges are more important than strong edges. For example, it was shown that in the segmentation of MRI of the knee, the cartilage is better characterized by weak edges rather than strong edges for the separation from the tibia and femur [11].

This note shows that an iterative approach based on the successive conjugation and adaptive mollification can detect all edges without any prior threshold. This approach is similar to the iterative method in the context of the radial basis function method [3, 9, 10]. The iterative method is as follows: at each iteration step, all previously found edges are smoothed by a local mollification and new corresponding Fourier coefficients are computed. By applying conjugation and mollification successively, one can distinguish real edges from fake edges. This approach is useful and effective particularly for problems where the weak jump can significantly affect the global solution of differential equations or images where the interesting structure is represented by the weak edges [11].

In Sect. 2, a brief explanation of the Fourier concentration method is given. In Sect. 3, the proposed iterative method is explained based on the adaptive filtering method. The stopping criteria is also explained. Numerical examples with remarks are given. In Sect. 4, a brief concluding remark is provided.

2 Edge Detection Using Fourier Concentration Method

Let [f](x) = f(x +) − f(x ) denote the jump function of f(x) ∈ L 2[−π, π], where the superscripts +  and − denote the limits taken from the right and left, respectively. Given a finite set of Fourier coefficients, \(\{ {\hat f}_k\}_{|k|\le N}\), the Fourier concentration method, developed in [5, 6], computes the concentration as a sum of the form

$$\displaystyle \begin{aligned} \begin{array}{rcl} S_{N}^{\sigma}[f](x) = i \sum_{|k| \leq N} sgn(k)\hat{f}_{k} \sigma \left( \frac{|k|}{N} \right) e^{ikx} {} \end{array} \end{aligned} $$
(1)

where the σ(⋅) are known as concentration factors and sgn(k) is the sign function. Given certain admissibility conditions [6], the sum converges to the jump function:

$$\displaystyle \begin{aligned} \begin{array}{rcl} S_{N}^{\sigma}[f](x) = [f](x) + \left\{ \begin{array}{ll} O \left( \frac{\log N}{N} \right), & d(x) \leq \frac{\log N}{N} \\ O \left( \frac{\log N}{(N d(x))^{s}} \right), & d(x) \gg N^{-1} \\ \end{array} \right. {} \end{array} \end{aligned} $$
(2)

where d(x) denotes the distance to the nearest edge and s depends on the concentration factor. Here we note that Eq. (2) shows that the concentration function \(S_{N}^{\sigma }[f](x)\) recovers the jump function of f(x) as N → and the convergence may be slow. Equation (2) also implies that the absolute maximum value of the concentration function \(S_{N}^{\sigma }[f](x)\) converges to the maximum jump. Accordingly we observe that strong jumps are relatively easier to detect than weak jumps. The common types of concentration factors satisfying the admissibility conditions are polynomial concentrations

$$\displaystyle \begin{aligned} \sigma(\eta) = p \eta^{p}, \quad p \ge 1, \end{aligned} $$
(3)

where p is a positive integer and η = |k|∕N and exponential concentration functions

$$\displaystyle \begin{aligned} \sigma(\eta) = C \eta e^{1/(\alpha \eta(\eta - 1))}, \end{aligned} $$
(4)

where α > 0 is an order and C is a normalization constant. Cutoffs for edge detection, τ ∈ (0, 1], are with respect to the normalized concentration

$$\displaystyle \begin{aligned} \hat{S}(y) = |S^{\sigma}_{N}[f](y)|/\max_{y}\{ |S^{\sigma}_{N}[f](y)| \} \end{aligned} $$

and the edge set, E, is defined as

$$\displaystyle \begin{aligned} \begin{array}{rcl} E = \{ x | \hat{S}(x) \ge \tau, x \in [-\pi, \pi] \}. {} \end{array} \end{aligned} $$
(5)

Several approaches have been developed for improving the concentration method. We refer readers some to [1, 2, 4, 6, 7, 12, 13, 15, 16]. All these methods are basically utilizing the edge map. Figure 1 is by the Fourier concentration method for f 1(x)

$$\displaystyle \begin{aligned} \begin{array}{rcl} f_1(x) = \left\{ \begin{array}{cc} {3} & {\pi\over 4} \le x \le {\pi\over 2}\\ -2 & \pi \le x \le {5\over 4}\pi \\ {m_w} & {3\over 2}\pi \le x \le {7\over 4}\pi \\ {0} & \mbox{ otherwise } \end{array} \right. {} \end{array} \end{aligned} $$
(6)

where m w = 0.1. That is, the magnitude of the strong jump is 30 times the weakest. As clearly shown in the figure, it is hard to detect the weak edge by looking at the normalized Fourier concentration \({\hat S}(y)\), (a) and (c) in Fig. 1, although the weak edges are clearly visible in (b) and (d) in Fig. 1.

Fig. 1
figure 1

Edge detection for f 1(x) with τ = 0.4. (a and b) with the polynomial concentration with p = 5. (c and d) with the exponential concentration with p = 12 for \({\sigma = \exp \left [-\epsilon _M \left ( 1- \left |{k\over N} \right | \right )^p \right ]}\) and 𝜖 M = 64. (a and c) \({{\hat S}(y)}\). (b and d) the detected edges marked by red cross symbols. N = 128

3 Iterative Concentration Method

As clearly seen in Fig. 1, the Fourier concentration method may fail to detect the weak edge when the concentration of the weak edge is too small compared to the strong edge. To find all edges, we propose to apply the Fourier concentration method iteratively based on the local mollification using the local adaptive filtering method.

3.1 Local Adaptive Mollification

The local adaptive mollification is a key step for the iterative algorithm. Consider a smooth function \(\phi \in C^\infty _0 [0,2\pi ]\) which is compactly supported such that

$$\displaystyle \begin{aligned} \phi_\epsilon (x) = {1\over \epsilon} \phi \left({x\over \epsilon}\right), \end{aligned} $$
(7)

where \(\lim _{\epsilon \rightarrow 0^+} \phi _\epsilon (x) = \delta (x)\). Here δ(x) is the Dirac delta function. And further \( \int _{-\infty }^\infty \phi (x) dx = 1. \) With these properties, the limit property is given by

$$\displaystyle \begin{aligned} \lim_{\epsilon \rightarrow 0^+}(\phi_\epsilon * f)(x) = f(0), \end{aligned}$$

where (∗) operation denotes convolution. The parameter 𝜖 is free and it localizes the convolution and is known as the localization factor. The parameter 𝜖 is a fixed value for every x. Thus a global smoothing occurs everywhere including both the nonsmooth and smooth areas. However, we only want to apply the mollification locally to minimize the Gibbs oscillations near the jump. In order to achieve this, we use a two-parameter family of the spectral mollifier introduced by Gottlieb and Tadmor [8]. Consider the convolution of the Fourier partial sum f N(x) and the mollifier ϕ. Then by the definition of f N(x) and ϕ we have

$$\displaystyle \begin{aligned} \begin{array}{rcl} (\phi_\epsilon * f_N(x)) &\displaystyle =&\displaystyle {1\over {2\pi}}\int^{2\pi}_0 \phi_\epsilon (x - y) f_N(y) dy \\ &\displaystyle =&\displaystyle {1\over {2\pi}}\int^{2\pi}_0 {\phi_\epsilon (x - y)} (D_N(y-z) * f(z))(y) dz dy, \end{array} \end{aligned} $$

where D N is the Dirichlet kernel of degree N. The idea proposed in [8] is that one changes the degree of the Dirichlet kernel with the localization parameter 𝜖 so that the two-parameter family of the new mollifier is defined by

$$\displaystyle \begin{aligned} \phi_{p,\epsilon}(x) = {1\over \epsilon} \rho\left({x\over \epsilon}\right)D_{p}\left({x\over \epsilon}\right), \end{aligned} $$
(8)

where D p is the Dirichlet kernel of degree p. Then for all s, the error is given by [8]

$$\displaystyle \begin{aligned} | (\phi_{p,\epsilon} * f_N(x) - f(x) | \le C || \rho^{(s)}||{}_\infty \left[ N\left({{1+p}\over{N{\epsilon}}}\right)^{s+1} + p\left({2\over p}\right)^s ||f^{s}||{}_{L^\infty_{loc}}\right], \end{aligned} $$
(9)

where\(|| \cdot ||{ }_{L^\infty _{loc}} = \sup _{(x-{\epsilon } \pi , x+ {\epsilon }\pi )}|\cdot |\). The first term in the right hand side of the above inequality is the truncation error and the second term is the regularization error. As we see, the optimization of the error is determined by how the localization parameter 𝜖 and the degree p are balanced. In [8] those parameters were chosen such that \( {\epsilon } = {{d}\over \pi }\), where d is the distance to the nearest jump from the current position. The order of the Dirichlet kernel is chosen such that spectral convergence is achieved, say, \({p} \approx \sqrt {N}\). Here we note that a modification of the two-parameter mollifier for the enhancement of the convergence was proposed in [14], which was designed to reduce the Gibbs oscillations while it provides a sharp reconstruction up to the edge. Note that the adaptive mollifier was used to sharpen the concentration map \({\hat S}\) in [2].

Our proposed iterative method is that once the edge is identified, the edge region is first localized using the value of 𝜖 so that f N in the region away from the detected edge is not affected by the mollification. This helps the next available edge to be preserved through the mollification of f N if existent. Thus as in [8], the localization factor is a function of the distance from the edge, d, i.e. 𝜖 = 𝜖(d). Then we adaptively mollify f N so that a heavy mollification using p is applied to reduce the Gibbs oscillations near the edge. The limit property of p is given as p → 0 if d → 0 and p → if d → 2π. In this work, we use the local adaptive filtering for the mollification.

3.2 Almost Automatic Stopping of the Iteration

To see the proposed method stops almost automatically, consider f(x) = x, x ∈ [−π, π] with the Fourier coefficients

$$\displaystyle \begin{aligned} \hat{f}_{k} = (-1)^{k} \frac{i}{k}, ~~~~~ k \ne 0 \end{aligned}$$

and \(\hat {f}_{0} = 0\). There are two edges (x = ±π) and conjugation and local adaptive filtering have the most effect at ± π. Therefore, by considering the local behavior near ± π, we assume a constant order of filtering p and of conjugation q, with functional forms of \(\exp (-\epsilon _{M}(1-|k/N|)^{p})\) and \(\exp (-\epsilon _{M}|k/N|{ }^{q})\), respectively. By letting ϕ p,𝜖 and \(C^{\sigma }_{N}\) be the corresponding kernels and letting S and F denote conjugation and filtering,

$$\displaystyle \begin{aligned} C^{\sigma}_{N} * (\phi_{p,\epsilon} * f_{N}) \approx \phi_{p,\epsilon} * (C^{\sigma}_{N} * f_{N}) \end{aligned}$$

and after some simplification, we have

$$\displaystyle \begin{aligned} \begin{array}{rcl} S[F[f_{N}]] &\displaystyle =&\displaystyle C^{\sigma}_{N} * (\phi_{p,\epsilon} * f_{N}) \approx\sum_{k=-N,k\neq 0}^{N} \frac{(-1)^{k+1}}{k}\exp\left( -\epsilon \left( 1 - \frac{|k|}{N} \right)^{p} \right)\\ &\displaystyle &\displaystyle \qquad \exp(-\epsilon|k/N|{}^{q}) e^{ikx}. \end{array} \end{aligned} $$

This has Fourier coefficients

$$\displaystyle \begin{aligned} \widehat{S}[F[f_{N}]] \approx \frac{(-1)^{k+1}}{k} \exp\left( -\epsilon \left( 1 - \frac{|k|}{N} \right)^{p} \right) \exp(-\epsilon|k/N|{}^{q}). \end{aligned}$$

From the sharp localization and heavy filtering near ± π, we choose p, q→0. Then setting y = |kN| yields

$$\displaystyle \begin{aligned} |\widehat{S}[F[f_{N}]]| \approx \frac{1}{k}\exp[-\epsilon(y^{q})+(1-y)^{p}],\quad k \neq 0 \end{aligned}$$

which approaches 0 exponentially. Thus after all the edges are found through iteration, the concentration decays exponentially small. Thus if the stopping criteria η below is chosen small enough, e.g. η ∼ 10−10, the stopping of the iteration is guaranteed

$$\displaystyle \begin{aligned} |S[F[f_{N}]]| \leq \eta. {} \end{aligned} $$
(10)

3.3 Numerical Examples

We consider the case that the magnitude of the weak edge is highly small for the function f 1(x) in Eq. (6)

$$\displaystyle \begin{aligned} m_w = 0.01. \end{aligned}$$

Figure 2 shows how the iteration method finds edges. The order of the finding the edges is from left to right (see red arrows). As shown in the figure, the iterative method finds all edges even with m w = 0.01. It is interesting to observe that the weakest edges are found in the 3rd and 7th iteration steps before all the strong edges are found. Now we consider even smaller value of m w

$$\displaystyle \begin{aligned} m_w = 0.001. \end{aligned}$$

Figure 3 shows how the iteration method finds all edges. Figure 3 shows similar result as in Fig. 2. As shown in the figure, the method is highly accurate and finds all edges including the highly weak edges.

Fig. 2
figure 2

f 1(x) with m w = 0.01 and successive edge detection. Left: \({\hat S}(y)\). Right: edges found in each iteration marked by red cross symbols with the weak edges circled in green. Note that the weak edges are almost invisible in the right figure of f 1(x)

Fig. 3
figure 3

f 1(x) with m w = 0.001 and successive edge detection. Detected edges are marked by red cross symbols with the weak edges circled in green. Note that the edges in f 1(x) are almost invisible in the figure

Fig. 4
figure 4

The density ρ at t = 1 for the shock-density wave interaction and shocks (with cross symbols) found with different values of τ and p. Left two figures: the Fourier concentration method. Right: the iterative method

As an application to the solution of PDEs, namely the shock-density wave interaction equation, we consider finding shocks in the density profile at t = 2 with the total number of grid points N = 300 computed with the WENO-Z method used in [9]. The left two figures of Fig. 4 show the edges (shocks) found by the Fourier concentration method while the right figure shows the edges (shocks) found by the iterative method. As shown in the figure, the iterative method find all the physical shocks accurately while the Fourier concentration method misses some of shocks.

For two-dimensional examples, we consider a Shepp-Logan image with a faint box added to comprise additional weak edges, and a brain image. To detect edges in two dimensions, edges are detected slicewise in the x and y directions. The x and y coordinates have a range of [−π, π]. For a 2N x + 1 × 2N y + 1 image, slices of f(x, y) are taken at evenly spaced x and y with Δx = 2π∕(2N x + 1) and Δy = 2π∕(2N y + 1), with − π included and π excluded. Within each slice, Fourier coefficients are computed by partial Fourier expansion and the iterative method is applied to find strong and weak edges. Calculation parameters for the two-dimensional calculations were similar to those for the one-dimensional calculations. An edge with a concentration magnitude at or above a fraction τ = 0.1 of the maximum magnitude concentration was considered strong. To detect strong edges, trigonometric concentration factors with α = π were used. Figure 5 shows the edges found by the proposed method for the Shepp-Logan image. As in the figure, the weak edges (square box with magnitude of 0.01) are successfully found by the method.

Fig. 5
figure 5

Original image (left) and edges (right) detected for concentration followed by iterative method on the Shepp-Logan image with a weak square edge of magnitude 0.01 added

Remarks

First, the proposed method is affected by noise as the original Fourier concentration. Consider Eq. (6). Let \({\hat f}_k(m_w = 0)\) be the Fourier coefficients with m w = 0. Then \({\hat f}_k(m_w) = m_w/8\) for k = 0 and \({\hat f}_k(m_w ) = {{m_w}\over {2\pi k}}\left [ \sin {}(7k\pi /4) - \sin {}(3k\pi /2)\right ]\) for k≠0. The weak edge translates \({\hat f}_k\). Thus we expect that unless SNR is high enough, \(|{\hat f}_k(m_w = 0 ) - {\hat f}_k(m_w )|\) becomes easily smaller than the noise as m w decays. Figure 6 shows the concentration with m w = 0 (left), the concentration with SNR = 20 (middle) and with SNR = 10. As in the figure, the weak edges are easily indistinguishable as SNR decreases. As the main objective of this research is finding the weak edges, a proper noise reduction suitable for the proposed method should be investigated in our future research.

Fig. 6
figure 6

Concentration. Left: without noise. Middle: SNR = 20. Right: SNR = 10

Fig. 7
figure 7

Left: edges with finite difference in the physical domain. Right: \({{3\pi }\over 2} \le x \le {{7\pi }\over 4}\)

Second, the proposed method is to find the edges by \({\hat f}_k\). Figure 7 shows the edge detection in the physical domain, with the forward difference, generated from the Fourier data (the left figure). The right figure shows the plot in \(x \in {{3\pi }\over 2} \le x \le {{7\pi }\over 4}\) where the weak edges exist. As in the figures, the weak edges are still hard to distinguish in the physical domain. Once the strong edges are removed in the Fourier domain and switching back and forth from the Fourier to physical domains, the weak edges are eventually found with the proposed method.

Summary

The following is the summary of the proposed iterative concentration method. The procedure stops eventually with a non-zero value of η > 0 in Eq. (10).

  • Step 1: Find edge locations x o using the Fourier concentration method.

  • Step 2: Apply the local filter near x o and find the new set of Fourier coefficients.

  • Step 3: Find a new edge location y o where the normalized concentration \({\hat S}\) by \(\{ {\hat f}_k\}\) from Step 2 has the maximum.

  • Step 4: Repeat Steps 2 and 3 until all the edges are found (the iteration stops once all edges are found.)

4 Conclusion

We showed that the iterative approach of the Fourier concentration method can detect all edges, which is not the case if the weak edges are too small. We showed that the proposed method is able to detect weak edges 3000 times weaker than the strongest edge, as long as the weak edges are well-separated from the stronger edges without noise and that the proposed method find all weak edges in a PDE application, namely the WENO calculation for the shock-density wave interaction. The iterative method also shows that it stops almost automatically after all the edges are found. Thus the proposed method is accurate and efficient.