## 2 Theoretical Background
### Classical and Fuzzy Hough Transforms
```
0: an edge image \(I[i_{x},i_{y}]\) with size \(L_{x}\), \(L_{y}\), a finite parameter space \(V[j_{a},j_{b},j_{r}]\) with size \(L_{a}\), \(L_{b}\), \(L_{r}\), with initial values of \(0\) a threshold for peak percentage \(P_{p}\), a voting membership matrix \(\mu[j_{a},j_{b},j_{r}]\) with size \(2d_{a}+1,\ 2d_{b}+1,\ 2d_{r}+1\) a result image \(R[i_{x},i_{y}]\), with size \(L_{x}\), \(L_{y}\), with initial values of \(0\)
1:for each image row \(i_{x}\) from \(1\) to \(L_{x}\)
2:for each image column \(i_{y}\) from \(1\) to \(L_{y}\)
3:for each parameter space row \(j_{a}\) from \(1\) to \(L_{a}\)
4:for each parameter space column \(j_{b}\) from \(1\) to \(L_{b}\)
5: for each parameter space 3 rd dimension \(j_{r}\) from \(1\) to \(L_{r}\)
6:if\(\hat{\mu}_{r}^{\prime}=\left(i_{x}-j_{a}\right)^{2}+\left(i_{y}-j_{b}\right)^{2}\) \(V[\left\{j_{a}-d_{a},\ldots,j_{a}+d_{a}\right\},\left\{j_{b}-d_{b},\ldots,j_{ b}+d_{b}\right\},\left\{j_{r}-d_{r},\ldots,j_{r}+d_{r}\right\}]=\ldots\)
7:\(V[\left\{j_{a}-d_{a},\ldots,j_{b}+d_{a}\right\},\left\{j_{b}-d_{b},\ldots,j_{ b}+d_{b}\right\},\left\{j_{r}-d_{r},\ldots,j_{r}+d_{r}\right\}]+\mu[j_{a},j_{b},j_{r}]\)
8:endif
9:endfor
10:endfor
11:endfor
12:endfor
13:endfor
14: compute the global maximum \(M_{G}\) in \(V[j_{a},j_{b},j_{r}]\)
15: compute local maxima \(M(k)=V\left[j_{a,k},j_{b,k},j_{r},k\right]\)
16: select local maxima with \(M(k)>P_{p}\cdot M_{G}\)
17: calculate the number \(N_{M}\) of the local maxima from line \(16\)
18:for each local maximum \(k\) from \(1\) to \(N_{M}\)
19:for each result image row \(i_{x}\) from \(1\) to \(L_{x}\)
20:for each result image column \(i_{y}\) from \(1\) to \(L_{y}\)
21:if\(\hat{\mu}_{r,k}^{\prime}=\left(i_{x}-j_{a,k}\right)^{2}+\left(i_{y}-j_{b,k} \right)^{2}\)
22:\(R[i_{x},i_{y}]=1\)
23:endif
24:endfor
25:endfor
26:endfor
```
**Algorithm 2**Fuzzy Hough transform for a circle with parameters a, b, and r

### Gradient Filtering

In mathematics, for a 2D continuous function, we use the partial derivatives to measure the degree of variation along each dimension. The edges in an image are segments that can be formed from the point locations where there is a rapid change in the image gray-level intensity in a small region. The connection between the previous two concepts made it possible to apply gradient filtering techniques in the field of image processing to detect edges. The gradient of an image intensity function is a 2D vector with two components defined by the horizontal and vertical derivatives at each image point, and using these two values, we can identify the strength of the edge's magnitude and its orientation at each pixel. The common mathematical formulation of the gradient for 2D image is the following vector:

\[\mathbf{G}[f(x,y)]= \begin{bmatrix}G_{x}\\ G_{y}\end{bmatrix} = \begin{bmatrix}\left\langle\frac{\partial f}{\partial x} \right\rangle\\ \left\langle\frac{\partial f}{\partial y}\right\rangle\end{bmatrix} , \tag{6}\]

where \(f\) is the image intensity function, and \(x\) and \(y\) are the spatial coordinates of the image. The magnitude and direction of the gradient are consecutively given by the two equations below:

\[G[f(x,y)]=\sqrt{G_{x}^{2}+G_{y}^{2}}, \tag{7}\]\[\alpha(x,y)=\tan^{-1}\left(\frac{G_{y}}{G_{x}}\right). \tag{8}\]

All of the aforementioned considerations are carried out in the continuous domain. In the case of a digital image, where the intensity function is sampled at image discrete points, we replace the gradient operator by a discrete operation, i.e., by a convolution between the image and a kernel, which is a matrix of smaller size. For partial differentiation the discrete counterpart is taking the difference of neighboring pixels. The following gradient kernels are often used in practice. \[[PERSON]_{1}= \begin{bmatrix}-1&0\\ 0&1\end{bmatrix} ,\ [PERSON]_{2}= \begin{bmatrix}0&-1\\ 1&0\end{bmatrix} . \tag{9}\]

\[Prewitt_{x}= \begin{bmatrix}-1&-1&-1\\ 0&0&0\\ 1&1&1\end{bmatrix} ,\ [PERSON]_{y}= \begin{bmatrix}-1&0&1\\ -1&0&1\\ -1&0&1\end{bmatrix} .