1 | initial version |
I couldn't test the next ideas, but (at least some of them) they should work. Probably you'll have to experiment a bit to find the right parameters.
First, I suggest to do a gamma adjustment as preprocessing; it should darken the grey lines to make them more visible:
out = in ^ gamma
where in
is normalized between 0..1
and gamma>1
.
To detect the lines, you can use a Sobel filter and get the regions where abs(Gx)
is high and Gy=0
(for vertical lines) and abs(Gy)
is high and Gx=0
(for horizontal lines).
Another possibility is to create some convolution kernels that respond to the horizontal and vertical lines. For example:
-1 -1 5 -1 -1
-1 -1 5 -1 -1
-1 -1 5 -1 -1
and
-1 -1 -1
-1 -1 -1
5 5 5
-1 -1 -1
-1 -1 -1
You can make them 3x3, 5x5 and so on. They should highlight the lines.