0

I am looking for a way to pack a binary image like the following one:

binary image

to something like:

packed binary image

in OpenCV, I know that there are many algorithms for rectangle packing but I am looking for the most efficient packing method for segments

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
ma.mehralian
  • 1,274
  • 2
  • 13
  • 29
  • How are you allowed to rearrange segments (translation, rotation, reordering, etc.)? – templatetypedef Jun 26 '23 at 16:52
  • 1
    You probably want to reduce the segments to polygons to make the problem easier to work with. You’re then still left with a hard problem, though. Some ideas here: https://stackoverflow.com/q/6864382/7328782 – Cris Luengo Jun 26 '23 at 17:40
  • 1
    "nesting" (the technical term) is an optimization problem, meaning it's ***hard*** (technical term) to find the optimum, but there may be heuristics and approximation algorithms and simplifying situations. please do the research (literature, implementations) -- https://en.wikipedia.org/wiki/Nesting_(process) and https://en.wikipedia.org/wiki/Nesting_algorithm -- the usual problems exist in 2D (any 2D stock cutting) and 3D (e.g. 3D printing) – Christoph Rackwitz Jun 26 '23 at 19:15
  • @templatetypedef translation, without rotating, resizing or anything else, just moving – ma.mehralian Jun 27 '23 at 17:35

0 Answers0