Python photo mosaic with abstractly shaped mosaics

Image mosaics use a set of predefined squared images to build a larger image (example here). There are a lot of solutions and it's quite trivial to achieve this effect. However, it becomes much harder with the following constraints:

  • The shape of the original mosaics is abstract. Any convex polygon could do.
  • Each mosaic can only be used once.
  • There is no need for the mosaics to be absolutely packed (ie occupying 100% of the canvas), but they should be as packed as possible without overlapping.
  • I'm trying to automatize the ancient art of tesselation, specifically the Opus palladianum technique.

    My idea is to use simulated annealing or some other heuristic to optimize the position and rotation of each irregular mosaic, swaping two in each iteration, trying to minimize some energy function that reflects the similarity to the target image as well as the "packness" of the tiles. I'm trying to achieve this in python, any ideas and help would be greatly appreciated.

    Example:


    I expect that you may probably use GA (Genetic Algorithm) with a "non-overlapping" constraint to do this job.

    Parameters for individual (each convex polygon) are:

  • initial position
  • rotation
  • (size ?)
  • And your fit function will be build to give best note to each individual when polygon are not overlapping (and close to other individual)

    You may see this video and this one as example.

    Regards

    链接地址: http://www.djcxy.com/p/39838.html

    上一篇: 程序固定点和Coq中的函数有什么区别?

    下一篇: Python照片马赛克与抽象形马赛克