Algorithm to split an image into smaller images reducing the amount of whitespace and specifying maximum amount of rectangles

后端 未结 5 1001
悲哀的现实
悲哀的现实 2021-01-03 01:08

I am looking for an algorithm which can split an image into smaller images, with some constraints. One constraint is to use the least amount of \"whitespace\" meaning empty

5条回答
  •  悲&欢浪女
    2021-01-03 01:47

    You want to write a run-lenght or a delta compression algorithm. Or you want to use a space-filing-curve or a spatial-index. A sfc recursively subdivide the surface into smaller 4 tiles and reduce the complexity of 2 dimension to 1 dimension thus it makes it easier to identify white-space. You want to look for Nick's hilbert-curve quadtree spatial index blog. You want to download my php class hilbert curve at phpclasses.org.

提交回复
热议问题