Hi Emma,

Yeah, I know the square's centroid, and I am working in 2D.
I need my square fall inside the contour's region, 
and also the square must be not rotated, just like the green square in the image.

Thanks, Jaime

On Tuesday, April 26, 2016 at 2:39:34 AM UTC-4, Emmanuelle Gouillart wrote:
I meant "parametrized by an angle and a radius, if you know its
centroid".

In the image you sent, the edges of the square are parallel to the edges
of the images. Are you only considering such squares, or do you also
allow a rotation of the square?

Best,
Emma

On Mon, Apr 25, 2016 at 11:46:14PM +0200, Emmanuelle Gouillart wrote:
> 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