Friday, September 21, 2018

image processing - Alternatives to Hough transform for detecting a grid-like structure


I have an image which is composed of multiple 'angles' which form a grid shape:


enter image description here



After some searching, Hough seemed like a good fit, because it isn't troubled by breaks in lines. However, the problem I have is that my lines are 'fat', and any edge detection I run (Canny in this case), picks out the edges of the line, and not the middle:


enter image description here


This means that the Hough transform ends up picking out one (or both) of the 'sides' of my grid lines, and not the middle.


enter image description here


Given that I know what I'm looking for (this grid-like shape, always in roughly the same orientation), is there a better way to perform the 'edge detection' part to give me the centre lines, or should I be looking at a totally different method?



Answer



The Hough Transform would indeed help in picking up the Grid in this case. To "thin" the lines, you might want to consider the operation of Skeletonization


That would produce an image like this one: Skeletonization Output


Due to the way that skeletonization works, it will still produce some lines that will seem irrelevant to the grid but these lines towards "erroneous" directions are not that many (at least in the given image) to confuse the line detection of the Hough Transform too much and it will clearly pick the two main sets of lines at distinct directions. (Here is how the HT output looks like: ) enter image description here


If you are using MATLAB, you might want to check this help page



No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...