Detected object removal
Hi,
I would to remove this object table leg from photos like this example1 but, more importantly, this example 2.
I am using find contours and canny detection for background removal but I have problems with this object because many times shoes have a white sole and is difficult to separate it from the object.
I am a bit new to computer vision, right now I am trying to train a haar clasifier to identify the object, but I am not sure, event if it works, how could I remove the detected object from the final image.
I have tried before with template matching but any minimum variation break detection, I tested with surf but the object appears to be an object without interest with few keypoints, I need to identify the borders too so I am not sure keypoint detection would help me anyway.
Any ideas please? I can use a combination of solutions if OpenCV doesn't have the needed bits to make this work. Thanks!
Just some random ideas, not sure if they work: place some fixed markers along the edge of the table; rely on the rigidity of the transparent table and its leg to calculate an exact solution to the position of the leg, and finally do a background subtraction. It seems the rigidity assumption would be applicable to your case. If the glass table and the leg is not "practically rigid" enough, try make it so.
Try Background Subtraction first. Also, it looks like the edges of the "leg" is straight enough that it can be detected with Hough lines detection.
The table will be turning because it is a series of photographs for every shoe, other than that the shoe have different sole sizes so sometimes the upper part of leg is visible and sometimes it is not, would not this be a problem although I can calculate where should start the leg?
I have tried to detect lines with Hough lines detection but it doesn't works very well for me, maybe I am missing something, I am trying with instructions found here http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_imgproc/py_houghlines/py_houghlines.html and the result is this: http://i.imgur.com/8h4CF4c.jpg , I lowered the threshold of the canny detector to be able to catch some line in the leg.
Since the table leg is vertical, use a vertical edge detector so that it will not be distracted by non-vertical lines. Also, the "minimum line length" of Hough Lines need to be increased, possibly several hundreds of pixels. You can measure the typical length in pixels from the image.
just to add, haar approach is not the way to go. It will supply you with a region of detection, which will still contain part of the pole, exactly what you would like to remove. So don't put time in training a detector that will not do what you want.