0

I'm trying to to write the program, that will plot region that satisifies system of inequalities.

I now have binary image with 0's and 1's.

Due to some specific implementation, I can't just draw region pixel by pixel.

Is there some algorithm, that can help to cover region by approximating rectangles/polygons?

Matrix looks like this: http://en.wikipedia.org/wiki/Connected-component_labeling#mediaviewer/File:Screenshot-Pixel_Region_(Figure_1).png

I need to paint 1's and leave 0's as it is.

Thanks in advance.

Paul R
  • 2,631
  • 3
  • 38
  • 72
  • So you need an efficient algorithm giving the region not by pixels but by larger rectangles. This does not look easy from a general point of view. Can you give us properties of the input? Examples at least? – user189 Jun 16 '14 at 15:41
  • Edited. I added image, how my input looks like. – Paul R Jun 16 '14 at 15:48
  • http://stackoverflow.com/a/5813015/47984 should solve this nicely, though not necessarily optimally. It works a little bit harder than necessary because it avoids ever finding rectangles that overlap -- but I suspect you don't want too much overlap anyway (since that could be even more wasteful than drawing each pixel separately but once only). – j_random_hacker Jun 16 '14 at 17:30
  • possible duplicate of [Algorithm for finding the fewest rectangles to cover a set of rectangles](http://stackoverflow.com/questions/5919298/algorithm-for-finding-the-fewest-rectangles-to-cover-a-set-of-rectangles) – j_random_hacker Jun 16 '14 at 17:36

0 Answers0