I'm trying to identify an object (a cube) in a set of photos. Using Canny/Sobel/Hough I've managed to get the photo down to a set of lines that are pretty accurate; however if I plot these lines on my image there are a lot of duplicates where the angle/distance varies only a tiny amount. Here's a cut down sample:
I thought I could reduce these by simply looking for lines that have a rho
/theta
values within a certain tolerance. However, the problem I discovered is that the more vertical a line is (the further the intersection at x=0) the greater the difference in the rho
value for the same angle:
This doesn't seem like a problem maths can't fix; but it seems like there should be tried-and-tested method for doing this yet I'm failing to find any good info online about the best way to do this (either maths to allow for this, or a generally better way of merging similar lines within the image space for the output of Hough Transform).
I did wonder if converting them to x/y pairs for the edges of my image (eg. the points to use to render a line) and then comparing them might be a better idea. I'm going to give this a go; but if it's not the "normal" way to do it, I'd like to know!