How to locate an object on the image? [closed]
Suppose there is black background with a gray object.
What is the best way to determine a minimal upright rectangle which contains it? For simplicity, let's think that there is no noise or other objects around, but the object itself may be fractured. The simplest approach of findContours(), boundingRect() is not workable. The standard findContours() renders the following output
The object remains broken because of the large gaps in its outer edges. In fact, what I need is yet another contour which embraces all of the existing.
you probably need to explain, why it is so, and show resp. code.