Initially, the gradient of each pixel of the image is computed. Because
of the small size of the rectangles that have to be extracted, the filter
used to compute the gradient vector must not smooth too much the image.
The Sobel filter gives a good approximation of the gradient without eliminating
the smallest rectangles.
The following convolution matrices computes the values of dx
and dy (coordinates of the gradient vector
at point (x,y)):
A rectangle corner forms a right angle, so, for each pixel of the image,
the values of the angles
between the gradient vector of the pixel and each gradient vector of its
eight neighbours are computed. Let us consider this angle for pixel pi
and one neighbour pj:
Where dxk and dyk are the coordinates of the gradient vector of the pixel pk.
This angle value and the two norms of gradients di and dj (gi and gj) are used to compute a similarity measure with a building corner.
The limit of this similarity measure must be equal to zero when the
norm of one of the gradient vectors tends toward zero or when the angle
between the two vectors tends toward zero. The maximum of the function
is reached when the two gradient vectors are orthogonal and their norms
are maximized. BESSETTES and DESACHY propose the following function:
is a positive coefficient used to weight the angle participation. If the value of is close to zero, the value of the angle will have less importance in the calculation of vij, whereas if the value of is very high, vij will only have a high value when aij is close to .
Finally, the pixel is replaced by the mean of the eight values obtained
(Figure 62):
Neighbour8(pi) is the set of the eight neighbours of the pixel pi.
The value of p'i is very high if the pixel pi is located at the corner of one or several buildings and so, belong to the urban area.
Each gray level of the resulting image represents the similarity to a building corner.