Finding largest rectangles in matrix
Hello :)
I'm new to opencv. Having 2d occupancy matrix (box status is occupied, free or unknown) is there an algorithm covering whole matrix with possibly largest status rectangles?
Thank you for your help
Example:
- white box = free
- red box = occupied
- green boxes are expected answers (green boxes should touch, but I draw it this way for clarity) e.g. coordinates of down left and top right corner
thanks for the image update !
hmmm, why do you expect rectangles here ? e.g. there is nothing seperating the small one top/left from the large one bottom/left and the one on top/right
i don't think, opencv has any kind of magic for this kind of "self-organization"
however, have a look at connectedComponents (it will work for the red boxes, bzut return all connected white space as a single blob)
I expect rectangles, because of the further processing to custom octree. Thank you for your answer :)
ahh, ok. unfortunately, i think, you 'll have to do your own "partitioning", then.