6

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:

Lines from Hough Transform plotted

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:

I hope this makes sense :)

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!

  • What was the reasoning behind computing rho/theta? Without thinking about the geometry, I'd recommend trying doing some kind of normalized RMS. – Andrew Piliser Mar 15 '16 at 18:48
  • That seemed to be the way to do Hough Lines (a way of combining lines that are close in location and angle). I'm totally new to all this, so it's entirely likely I'm not doing th ebest things, but I'm struggling to find good info on this (lots of stuff on edge detection, less on detecting an object like a 3D cube) :( – Danny Tuppeny Mar 16 '16 at 8:38
1

Well, I went ahead and tried converting to x/y pairs and then de-duping where both sets were within 5% of their respective axis. I don't know if this is a good way to do it, but it's definitely gotten me closer!

enter image description here

There's something wonky with a bunch of lines starting at 0, 0 (I reckon they should be perpendicular, and suspect the noise at top might be overwhelming the real edge from the cube centre corner, but I don't care for those lines ultimately anyway), and I have a problem for "perfectly vertical" lines (theta is 0, causes errors in some of my maths) but this page seems to have a solution to that.

Posting this as an answer in case it helps others, but still hoping for a better answer (or confirmation this way make sense).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.