I'm trying to use OpenCV to detect remote controlled robots in an arena. These robots typically contrast well with the surroundings so my approach has been to use the Canny detector to find edges and then use findContours to filter out contours I don't care about. (Please refer to linked image) For example in the top left image I don't care about the long straight lines that are caused by the edge of the arena. In general I can discard these by aspect ratio. However in some cases (bottom left) findContours keeps multiple lines in one contour and then fills in a box (grey in bottom right)
My question is, is there a way to break up these lines output from findContours ?
I have played with thresholds on the Canny detctor and while higher quality does tend to break up those lines it also loses track on those robots (which apparently are not high quality features! :) )
I tried feeding my Canny image into HoughLinesP to remove lines. After some tweaking the situation is improved (see figure) now I just have small triangles instead of large quadrilateral.
I am still looking for a solution to break up lines remaining in the canny image.