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