Ask Your Question

# Revision history [back]

### Find a small square patch inside an "approxPolyDP" polygon

Hi,

I'm processing a still image in order to find where the water is. (see my other question here)

Now, I can find all the rather large polygons in the image, using approxPolyDP. But there is no guarantee that the water is the dominant part of the image.

In case I have a few large-ish polygons (> 5%) of the image), I'd like to find a small patch that fits in my polygon and test its texture using one of the classic statistical texture methods (local binary pattern, laws, gabor filters).

But I'm not sure how to find a small square that fits inside the polygon. The only thing I can think of is to use the center of gravity, and create a small box around it. But in the case of a complicated shape, the center of gravity might not be in the shape itself.

Here is an example where finding a small square patch in the polygon that I have outlined seems potentially tricky:

Original image:

Outline of the water (one of the large polygons), where I'd like to define a square patch :

### Find a small square patch inside an "approxPolyDP" polygon

Hi,

I'm processing a still image in order to find where the water is. (see my other question here)

Now, I can find all the rather large polygons in the image, using approxPolyDP. But there is no guarantee that the water is the dominant part of the image.

In case I have a few large-ish polygons (> 5%) of the image), I'd like to find a small patch that fits in my polygon and test its texture using one of the classic statistical texture methods (local binary pattern, laws, gabor filters).

But I'm not sure how to find a small square that fits inside the polygon. The only thing I can think of is to use the center of gravity, and create a small box around it. But in the case of a complicated shape, the center of gravity might not be in the shape itself.

Here is an example where finding a small square patch in the polygon that I have outlined seems potentially tricky:

Original image:

Outline of the water (one of the large polygons), where I'd like to define a square patch : :