maximum square inside a contour

Jaime Lopez Carvajal jalopcar at gmail.com
Thu Apr 28 13:31:59 EDT 2016


Hi Georges,

I really don't have the green square, it is what I want to get. I just put 
it there for illustration purpouses.

But you give an interesting point of view. I will start from centroid, 
checking in every step if every square's corner is inside the region (as 
you said, 0 value)
it they are inside, increase their coordinates respectively, if not, take 
coordinates from the previous step to build the square.

I will give it a try, and will say how it works,

Thanks, Jaime

On Thursday, April 28, 2016 at 12:46:42 PM UTC-4, GeorgesVis wrote:
>
> How about turning problem into an optimisation problem ?
> You have the green square, could be considered as initial maximum square 
> dimensions.
>
> I believe it can be done by varying the position of the square along a 
> path that maximises the square dimensions while all px values remain at 0 
> (ubyte image).
> The path can be chosen depending on the polygon properties, if it is a 
> platonic solid you use mass centre or the positions along the symmetry axis 
> (example above).
>
> Else, a more expensive approach: pick random positions (pos) and keep same 
> size. Check if all px==0: increase size; else: continue to next pos.
> I think you should also look at the flood fill algorithm, could also be 
> helpful.
>
>
> Hope this helps. 
> Cheers, Georges
>
> On Monday, 25 April 2016 13:30:21 UTC-7, 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20160428/6bf94768/attachment.html>


More information about the scikit-image mailing list