maximum square inside a contour

Emmanuelle Gouillart emmanuelle.gouillart at nsup.org
Mon Apr 25 17:46:14 EDT 2016


Hi Jaime,

I don't have a good solution to your problem, which seems a tricky one
from a theoretical point of view
https://en.wikipedia.org/wiki/Inscribed_square_problem
(however we can be relieved since a solution always exists for a polygon
:-)

However, if you have a 2D contour (are you in 2D?), then the square can
be parametrized by an angle and a radius (if you know its radius). A
brute-force search would do, since it's easy to find an upper boundary
for the radius (take the bounding box of scipy.ndimage). You just need
a function that tells you whether one edge of a square lies within the
contour, maybe you can do this by rasterizing the edge using
skimage.draw? 

Only small bits here, if I have better ideas I'll get back to you.

Cheers,
Emma

On Mon, Apr 25, 2016 at 01:30:21PM -0700, Jaime Lopez Carvajal wrote:
> Hi friends,

> Someone knows how can I find a maximum square inside a contour, giving as
> parameter the centroid point? 
> I need whole square area fall inside the contour. Any advice?

> Thanks in advance, Jaime



More information about the scikit-image mailing list