0

I been messing with Python and OpenCV on some images, and kind of got the result I want. Here is an example of the output image.

image result

So the important part is opencv has draw red rectangles around the objects it has identified (I don't want to share what the original image was so yes those gray patches are all the remain after running a lot of functions on the image).

Now what I want to do is expand the rectangles (there are 2 here, but 3 or 4 are also possible) so they are as large as possible without touching. I just can't seem to come up with any kind of algorithm to do that. Any suggestions?

Michael Buckley
  • 591
  • 4
  • 14
  • This is somewhat similar to drawing a [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram) around the centers of the rectangles, except all your lines are going to be horizontal or vertical. – Stef Nov 27 '20 at 13:41
  • @Stef that really helps. I managed to find a package called geovoronoi that can be convinced to do almost what I want. However this question got closed and linked to other questions (which are not what I am asking) so I will not post my own answer. – Michael Buckley Nov 27 '20 at 15:12

0 Answers0