[] The C++ source codes are released.download (9/5/2016).
In this paper, we develop the Helmholtz principle on the gradient magnitude map of an image in the view of probability theory, and apply it on the detection of edge chains and line segments. The traditional Helmholtz principle needs a good estimation of Nconf to calculate the "number of false alarms" (NFA) of an event, which is difficult in some applications. To overcome this shortage, we propose to use the "relative number of false alarms" (RNFA) instead of the traditional NFA to validate an event. Based on this observation, a simple and efficient edge chain detection algorithm is proposed, which detects edge chains via edge pixel growing first and then validates the edge chains according to their RNFAs. In this way, not only edge chains that are weak in contrast but meaningful in vision can be detected, but also the false alarms ratio is controlled in a low level. Extending this observation to the line segment detection, we propose a novel line segment detector which fits for straight line segments directly on the gradient magnitude map instead of the edge chains which often suffer from the influence of noise. To evaluate the proposed edge chain and line segment detectors in quantity, both an edge chain detection benchmark with 25 semi-automatically labeled images and a line segment detection benchmark with 30 images were built. The proposed edge chain and line segment detectors were tested in these two benchmarks. The experimental results on the benchmarks sufficiently demonstrate that the proposed edge chain and line segment detectors outperform the state-of-the-art methods.
For each integral gradient magnitude level $u \in [1,g_{\max}]$ where $g_{\max}$ is the maximum gradient magnitude level in the gradient magnitude map $\mathbf{G}$, the number of pixels whose gradient magnitude level is equal or greater than $u$ is denoted as $k(u)$, thus the probability of the considered quality that "a pixel on $\mathbf{I}$ whose gradient magnitude level is equal or greater than $u$" is defined as: \begin{equation}\label{Eq:Probability2} P(u) = k(u) / M, \end{equation} where $ M = w \times h$ is the size of $\mathbf{I}$.
$\textbf{Definition of NFA} - \textbf{Number of False Alarms}$. Given an event $\mathcal{E}$ (a detected structure) made up of $l$ pixels on an image, $N_{\textrm{conf}}$ is the theoretical number of $\mathcal{E}$ on the image, $u$ is the minimal gradient magnitude of these pixels, the NFA of $\mathcal{E}$ on the gradient magnitude map is defined as: \begin{equation}\label{Eq:NFAGradient} \text{NFA} = N_{\textrm{conf}} \times P(u)^l. \end{equation}
In some applications, it is difficult to give a good approximation of the $N_{\textrm{conf}}$, for example the value of $N_{\textrm{conf}}$ for edge chain is hard to be obtained. In this case, we propose to use the ``relative number of false alarms" (RNFA) to validate edge chains.
$\textbf{Definition of RNFA} - \textbf{Relative Number of False Alarms}$. Given an event $\mathcal{E}$ (a detected structure) whose binomial probability is $\mathcal{B}(n,k,p)$, and $\mathcal{E}_{r}$ is a minimal meaningful event (MME) whose binomial probability is $\mathcal{B}(n_r,k_r,p_r)$. The relative number of false alarms of $\mathcal{E}$ to $\mathcal{E}_{r}$ is defined as: \begin{equation}\label{Eq:RNFA} \text{RNFA} = \frac{N_{\textrm{conf}} \times \mathcal{B}(n,k,p)}{N_{\textrm{conf}} \times \mathcal{B}(n_r,k_r,p_r)} = \frac{\mathcal{B}(n,k,p)}{\mathcal{B}(n_r,k_r,p_r)}, \end{equation} where $N_{\textrm{conf}}$ is the number of different possible configurations one could have for the searched event, and we simply say that the event is meaningful than the minimal meaningful event (MME) if $\text{RNFA} < 1$.
We consider using the proposed RNFA to validate the meaningfulness of the edge chains.
$\textbf{Definition of MME}_{\textbf{edge}} - \textbf{Minimal Meaningful Edge Chain Event}$. A minimal meaningful edge chain event is defined as the edge chain with a size of $L_{mm}$ and a minimal gradient magnitude equal to $g_{\min}$.
The $g_{\min}$ is a user defined parameter which is set as a constant, and $L_{mm}$ is the minimum length of a meaningful line segment, which can be very well solved according to the works of LSD and CannyLines as following: \begin{equation}\label{Eq:LMM} L_{mm} = -2.5\log(M) / \log(p), \end{equation} where $ M = w \times h$ is the size of $\mathbf{I}$ and $p=1/8$.
The proposed edge chain detector contains four steps:
We apply the NFA on the validation of line segments.
Assume that there is a line segment made up of $l$ pixels, the minimal gradient magnitude of these pixels is $u$, the NFA of this line segment is: \begin{equation}\label{Eq:NFALine} \text{NFA} = M^{2.5} \times P(u)^l, \end{equation} where $M = w \times h$ is the size of the image. If $\text{NFA} < 1$, we simply say that the event is meaningful.
It's worth noting that we can also apply the RNFA on the line segment validation if a minimal meaningful line segment event is given. In this work, we recommend to apply both NFA and RNFA to double check the line segments, in this way the performance of the validation procedure can be adjusted by setting a customized $g_{\min}$.
The first two steps are the same as those of the edge chain detector proposed in Section 3.2 and the resting steps are described as follows:
To evaluate the performance of the proposed edge chain detector, we built an edge chain benchmark with ground truth edge chains labeled in a semi-automatic way. There are 25 labeled images in our benchmark, most of which were selected from the EDC dataset. Fig. 1 shows six representative images and the corresponding ground truth edge chains on the proposed benchmark.
As an edge chain detector, we consider to detect as many meaningful edge chains as possible. In this condition, we should find the value of $g_{\min}$ corresponding to the minimal meaningful edge chain event. To find out the best value of $g_{\min}$ for edge chain detection, we tested the proposed edge chain detector on our edge chain benchmark with $g_{\min}$= 40, 60, 80, 100, 120, 140, 160, 180, and 200, respectively. Fig.2(a) shows the edge chain detection results on our benchmark with different values of $g_{\min}$, we recommend to set $g_{\min}=120$ as a balance between the precision and recall for edge chain detection.
As an object boundary detector, we consider to detect as many boundary as possible. In this condition, the value of $g_{\min}$ should be greater than that of edge chain detection because the boundaries are usually with greater contrast. To find out a general value of $g_{\min}$ for boundary detection, we tested the proposed edge chain detector on the RUG dataset with $g_{\min}$= 100, 120, 140, 160, 180, 200, 220, 240, and 260, respectively. Fig.2(b) shows the edge chain detection results on the RUG with different values of $g_{\min}$, we recommend to set $g_{\min}=180$ as a balance between the precision and recall for boundary detection.
(a) | (b) |
We compared it with other four state-of-the-art edge detection methods, including: EDPF, ED, SREdge and CannyPF on the proposed edge chain benchmark, the RUG dataset and the BSDS dataset. Table 1 shows the average accuracies of these algorithms on the proposed benchmark and the RUG dataset. We can see in this table that the proposed RNFA method achieves the highest values on both precision and $F$-score, which are much better than the EDPF on the second place. Fig.3 shows the precision recall curve of the five tested algorithms on the BSDS dataset, in which we set $g_{\min}=180$ for the proposed RNFA method. We can see that the performances of the RNFA and EDPF are close to each other with the same $F$-score equals 0.57, which are better than that of the SREdge (0.53), ED (0.52) and CannyPF (0.52). Fig.4, 5, 6 show the edge chain detection result of the five tested methods on our benchmark, the RUG dataset and the BSDS dataset, respectively.
Algorithm | CannyPF | ED | SREdge | EDPF | RNFA | ||||||||||
Measure | R | P | F | R | P | F | R | P | F | R | P | F | R | P | F |
Our Benchmark | 0.88 | 0.49 | 0.59 | 0.83 | 0.55 | 0.62 | 0.79 | 0.61 | 0.65 | 0.81 | 0.65 | 0.71 | 0.82 | 0.75 | 0.77 |
RUG Dataset | 0.82 | 0.16 | 0.26 | 0.83 | 0.19 | 0.29 | 0.81 | 0.23 | 0.35 | 0.72 | 0.26 | 0.37 | 0.60 | 0.44 | 0.49 |
To evaluate the performance of the proposed line segment detector, we built a benchmark with ground truth line segments labeled in the same way as the edge chain benchmark in Section 5.1.1. There are 30 labeled images in our benchmark, all of them were selected from the YorkUrbanDB dataset. These images cover a range of indoor and outdoor scenes.
To sufficiently evaluate the performance of the proposed NFA+RNFA line segment detector, we compared it with other three state-of-the-art line segment detectors, including: CannyLines, LSD and EDLines. We also tested the line segment detection result based on the edge chains detected by the proposed RNFA based edge chain detector. The least square method to fit for line segments on each edge chains, also the same gradient orientation line validation procedure as LSD and EDLines is applied to get rid of false alarms. We denote this line segment detector as RNFAEdge. Fig.7 shows the line segment detection results of NFA+RNFA, RNFAEdge, CannyLines, LSD and EDLines on our benchmark. Table 2. is the comparison of EDLines, LSD, CannyLines, RNFAEdge and NFA+RNFA on our line segment benchmark.
Algorithm | EDLines | LSD | CannyLines | RNFAEdge | NFA+RNFA | ||||||||||
Measure | R | P | F | R | P | F | R | P | F | R | P | F | R | P | F |
Average | 0.638 | 0.724 | 0.675 | 0.729 | 0.796 | 0.757 | 0.792 | 0.819 | 0.802 | 0.827 | 0.865 | 0.843 | 0.862 | 0.841 | 0.851 |