Keywords

1 Introduction

Segmentation is one of the most important techniques in image processing as it allows the separation of regions of interest from the image background. There are various methods for conducting segmentation. Phase-congruence method, which was proposed by Kovesi [2], is based on a perception model that uses the local energy of the image, postulating that its most important characteristics occur where its frequency components maximize the phase coincidence. Unlike most popular segmentation techniques, this method uses the frequency spectrum, which makes it unattractive due to its high computational cost and high sensitivity to noise. With recent changes introduced by Kovesi in the definition of phase congruence coupled with the use of more powerful computers, this technique has taken on new significance. An important disadvantage of the original method is that it does not allow the detection of closely spaced edges of variable intensity. Nevertheless, this technique has been used by a number of researchers because it is invariant to changes in illumination and contrast [4,5,6,7,8,9,10].

In order to overcome this deficiency in edge detection, in the proposed study, we analyzed the original technique proposed by Kovesi, and contrary to what he established, we adjusted the parameters of the banks of wavelet filters, allowing the spectra of each filter to overlap. This overcomes the limitation of the original technique. To overcome the generation of false edges that this overlapping produces, we have reinterpreted the concept of phase congruence to reduce its sensitivity to false edges.

This article is organized as follows. In Sect. 2, we first present a brief description of phase congruence proposed by Kovesi, highlighting the above mentioned problem. In Sect. 3, we discuss our proposed solution, and in Sect. 4 we present the results obtained from synthetic and real images. Finally, we present our conclusions in Sect. 5.

2 Phase Congruency

Kovesi [2] describes phase congruency in the following way:

For a one-dimensional signal, the phase congruence (PC) function at a point x is defined as the local energy function E(x) divided by the sum of the different Fourier components \(A_n\), Eq. (1). Figure 1 shows a vector scheme of the concept.

$$\begin{aligned} PC(x)= \frac{ E(x) }{ \sum _{n=1}^N A_n(x)}. \end{aligned}$$
(1)
Fig. 1.
figure 1

adapted from [2].

The relation between phase congruency, local energy, and the sum of the Fourier amplitudes,

Bandpass quadrature filters are often used to extract information such as energy from images [1]. In phase congruency, Kovesi used log-Gabor (log-normal) quadrature filters. The responses of pairs of quadrature filters are treated as the real and imaginary components of a complex number. In Eq. (2), we present the pair of responses in vector form, where I is the signal, \(M_n^e\) the even-symmetry wavelet, \(M_n^o\) is the odd-symmetry wavelet, both for the scale n, and \(e_n(x)\) and \(o_n(x)\) are the respective results:

$$\begin{aligned}{}[e_n(x),o_n(x)]= [ I(x) * M_n^e, I(x) * M_n^o]. \end{aligned}$$
(2)

In Eq. (3), these pairs of responses are used to obtain the amplitude \(A_n\) for the nth scale, which can be conveniently approximated as the nth Fourier component of Eq. (1).

$$\begin{aligned} A_n(x) = \sqrt{e_n(x)^2 + o_n(x)^2}, \end{aligned}$$
(3)

and the phase is obtained using Eq. (4):

$$\begin{aligned} \phi _n(x)= atan2(e_n(x),o_n(x)). \end{aligned}$$
(4)

To reduce the problems that occur when the components are of small magnitude, Kovesi added a positive constant \(\varepsilon \) to the denominator in Eq. (1). The effect of noise is also quite important. To reduce this problem, he considered a noise circle of radius T; any value less than or equal to T is not considered and set equal to zero.

Smoothing reduces the high-frequency components of the signal, i.e., it reduces the span of the frequency spectrum. In an extreme case, where the locally whispered signal is practically a pure signal, i.e., where it has a single frequency component, the PC will be maximal throughout the entire signal. To solve this problem, Kovesi weighted the PC using Eq. (5):

$$\begin{aligned} s(x)= \frac{1}{N}\left( \frac{\sum _{n=1}^N A_n(x)}{\varepsilon + A_{max}(x)}\right) , \end{aligned}$$
(5)

s(x) is a measure of the frequency distribution, it takes on values between 0 and 1, and it is used in the weight function in Eq. (6):

$$\begin{aligned} W(x)= \frac{1}{ 1+ e^{\gamma (c-s(x))}}, \end{aligned}$$
(6)

where c is the cut-off value for s(x), which penalizes PC when the signal is formed by only a few frequency components, and \(\gamma \) is a gain factor that controls the sharpness of the cut-off.

To increase the sensitivity of PC, Kovesi redefines the way in which the phase difference \(\phi _n\) at each scale influences the weighted average phase \(\overline{\phi }\). Kovesi originally used a cosine function (see Fig. 1), but this has a problem in edge detect that a significant difference is required between \(\phi (x)_n\) and \(\overline{\phi }(x)\) in order for the value to decrease appreciably. He therefore proposes Eq.  (7):

$$\begin{aligned} \varDelta \varPhi _n(x)= \cos ( \phi _n(x)- \overline{\phi }(x)) - \left| \sin ( \phi _n(x)- \overline{\phi }(x))\right| . \end{aligned}$$
(7)

The improvements introduced by Kovesi to the phase congruence calculation are reflected in the Eq. (8), where the effect due to noise is reduced and sensitivity is increased, even when there are signals with a certain level of smoothing. The operator \(\lfloor x \rfloor \) indicates that x is positive if \(x>0\), and zero if \(x\le 0\).

$$\begin{aligned} PC(x)= \frac{\sum _{n=1}^N W(x)\lfloor A_n(x) \varDelta \varPhi _n(x) - T\rfloor }{\sum _{n=1}^N A_n(x)+ \varepsilon }. \end{aligned}$$
(8)
Fig. 2.
figure 2

Phase congruence such as the cosine of an angle \(\delta \)

To use the Eq. (8) in images, the same transfer function is assumed for filters in all directions. However, the obtained phase congruence results do not allow the precise location of the edges. For this reason, Kovesi uses additional steps to improve the results, which consist of the adaptation in the space of phase congruence of Canny’s techniques for localization of local maxima and the suppression of false edges by hysteresis. However, some additional improvements, which have not been published in articles, were introduced by the same author in the code available on his website [3]. The most striking change affects the very definition of phase congruence. In the initial definition according to the Eq. (1), the phase congruence can be understood as the cosine of an angle \(\delta \), which arises from the right triangle, which hypotenuse sums the magnitudes of each component, and as an adjacent leg the magnitude of the signal energy (see Fig. 2). The change in the definition of phase congruence consists of going from \( \cos (\delta (x)) \) to being \( 1- \left| \delta (x) \right| \). With the new adjustment, introducing the previous improvements, and adding a gain \(\alpha \) to the phase deviation (\( \delta (x) \)) we have the Eq. (9).

$$\begin{aligned} PC(x) = W(x) \lfloor 1 - \alpha \left| \delta (x) \right| \rfloor \frac{ \left\lfloor E(x) - T\right\rfloor }{ E(x)+ \varepsilon } . \end{aligned}$$
(9)

In the implementation of the Eq. (9), several parameters can be modified to apply the filter. Those of special interest in this work correspond to \(\sigma _o \) and \( \alpha \). The value of \(\sigma _o \) directly influences the transfer function of the filter bank (see Eq. 10), it is related to the bandwidth [1], and \(\alpha \), helps to better discriminate phase congruence. It should be added that in order to apply phase congruence to images, monogenic filters are used for the present study.

$$\begin{aligned} G(\omega )= exp\left( \frac{- (\log (\omega /\omega _0))^2}{2(\log (\sigma _o))^2}\right) . \end{aligned}$$
(10)

It is important to mention that in order to model the effect of noise in the calculation of phase congruence, three premises are required: (I) the noise is an additive character, (II) the noise power is constant and (III) they are close together. This latter restriction limits proper edge detection in images. As illustrated by the example in Fig. 3b.

Fig. 3.
figure 3

Phase Congruency at microscopy image of a real case. (a) Diatom image. (b) With default parameters. (c) Parameters: \(\sigma _o \) at 0.3, \(\alpha \) at 3.5

3 Analysis of nearby edges

Phase congruence has difficulties in detecting nearby edges with different width and intensity, as illustrated by the Fig. 4, where two parallel edges appear, one high and one low intensity. If phase congruence is used following the recommendations suggested by Kovesi the result obtained does not allow to differentiate the low intensity edge (see Fig. 4c). However, if the image consists only of the low intensity line, this edge is correctly identified.

Fig. 4.
figure 4

Synthetic image filtered at phase congruency with default parameters. (a) Image with near edges at 255 and 20 intensity. (b) Vertical profile of (a). (c) Image filtered at phase congruency with default parameters. (d) Vertical profile of (c).

In phase congruence, the frequency spectrum of the edges to be identified is quite important, which, following the definitions given by Kovesi, conforms to a power distribution of a square signal [2]. In this way, each wavelet is associated with a Gabor filter, and the overlap of all filters covers the entire spectrum (see Fig. 5).

Fig. 5.
figure 5

Spectrum of wavelets. (a) Suggested by Kovesi. (b) The new proposal. The upper panel displays the individual wavelets, while the lower panel shows the sum of the spectra

In Fig. 4a, the different intensities of the signals produced by the edges overlap in frequency space, hiding the smaller one. This problem disappears, to a certain extent, if the signal intensities are similar, but there is a delocalization of the edges, due precisely to this overlap. To solve the problem of the detection of closely spaced edges, we propose to increase the bandwidths of the filters in such a way that the attenuation of the weaker signal can be reduced. This can be achieved by reducing the value of \(\sigma _o\), beyond the range recommended by Kovesi. The disadvantage of increasing the filter bandwidths is that false edges appear due to the high degree of overlap (see Fig. 7a). Figure 6a shows the result of varying \(\sigma _o\) in the range from 0.55 down to 0.3 (From left to right in the Figure), which is below the theoretical range of 0.55–0.85 established by Kovesi.

Fig. 6.
figure 6

Changes from Phase congruency when vary \(\sigma _o\) and \(\alpha \).

Fig. 7.
figure 7

Synthetic image filtered at phase congruency, (a) \(\sigma _o=0.3\), (b) vertical profile of (a), (c) \(\sigma _o\) at 0.3 and \(\alpha \) at 3.5, and (d) is a vertical profile of (c).

To solve this overlap problem, which arises due to the increases in the bandwidths of the filters (\( \sigma _o = 0.3 \)), it is necessary to increase the sensitivity of the PC by adjusting the gain \(\alpha \). In this way, it is possible to reduce the noise generated by the frequency overlap of the different filters. In Fig. 6b we show the result obtained by varying \(\alpha \) from 1.5 to 3.5 (from left to right in the Figure).

4 Results for Synthetic and Real Images

From our synthetic images, we have found heuristically that the appropriate values of \(\sigma _o\) and \(\alpha \), which are necessary to obtain a PC that allows the detection of low intensity edges that appear close to high intensity edges are \(\sigma _o = 0.3\), and \(\alpha = 3.5\). As shown in Fig. 7c, applying PC to the Fig. 4a with these values allows to detection of both edges.

The distribution of the frequency spectrum after this adjustment of the filter band passes is shown in Fig. 5b.

5 Conclusions

One of the limitations of phase congruence is its inability to detect closely spaced edges. In this work we have presented a solution based on allowing the overlap of the Gabor filter responses through which it is possible to reinforce the responses to weak signals. This solution leads to the generation of spurious signals, but we have eliminated them by readjusting the sensitivity of the PC. The results obtained from synthetic and real images have allowed us to verify the quality of this solution.