Ask Your Question

Revision history [back]

How to locate an object on the image?

Suppose there is black background with a gray object.

image description

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.

How to locate an object on the image?

Suppose there is black background with a gray object.

image description

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.workable. The standard findContours() renders the following output

image description

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.