Neuro-Hough transform
The Hough transform is probably the best way to detect
lines in the image. Let's implement it using neural nets. This approach
promises additional benefits because neural nets have useful properties by themselves.
Adding them to the already useful method will only improve it. A formal neuron
is an elementary voting device so we can apply it as the Hough accumulator. I
used the 2-layered perceptron with its synapses preprogrammed so as to perform
transformation from the image to the Hough space. That is, each neuron in the 2
layer represents some pair of theta-rho values. Using the same matrix of
connections we can pass activity in both directions. If some straight line is
presented to the first layer, then 1 definite neuron will be activated in the
second. Vice versa, if we activate 1 neuron of the 2 layer, all the pixels of
some input line will be highlighted. The simplest 2-layered net works 1:1 as
the standard Hough transform.
Here, the left image is a source, the right - the
corresponding Hough space with the following coordinates: X - the angle of the
line clockwise from X on the image (0 - 180 degrees). Y (downwards) - rho, may
be negative. Zero - in the centre.
You can use thresholding or maximum detection so as to
determine the most active output neuron and the corresponding line coordinates.
The new features begin when we set more complicated goals.
1. Gap filling
On real-world pictures lines are often broken. Some
dots may be absent and continuity lost. Neural nets are famous for their
ability to correct errors. We can do it in 2 ways. We can use a Convolutional
Neural Net. In this case, neurons at the sides of the kernel support one in the
centre. If this centre is placed in a small gap, it will be light up from both
sides. We can also use a Recurrent Neural Net. If we add positive feedback from
the 2 layer to the 1, all the dots of an active line will be enhanced. The
disadvantage of CNN is that it will make the line thicker so we can combine both.
Recursion will affect not input neurons immediately, but the work of
convolution. As a result, only pixels of the same line will enhance each other.
2. Detecting line segments
This is the job of the probabilistic Hough method. The
standard Hough can't output coordinates of line ends. Here, if we use RNN,
brightness of the line will be boosted relatively to the background and we will
be able to cut it off using the simple threshold.
3. Detecting corners
We can even detect corners of 3D rectangular objects.
With the common Hough transform it will require rather complicated programming
and many lines of code. Here, we only adjust the structure and parameters of
the net. The idea is that if we use the aforementioned combination of CNN and
RNN, each of 3 lines will be boosted independently and the point where they
come together will have triple brightness.
The task of corner detection becomes as simple as
finding the maximal intensity.
Copyright (c)
I. Volkov, May 29, 2018