如何编写图像马赛克生成器
任务如下:如何从大量图像中创建选定的图片马赛克。 我的第一个尝试是使用进化算法。其中基因型表示原始图像到马赛克网格中位置的映射,根据与原始图像的相似度来评估个体。实际上,在基本方法中,每个图块都可以单独处理,因此迭代网格并匹配最佳图像就足够了。但我还不知道如何定义相似度函数。 单纯的像素明智比较(r,g,b)差异可能过于严格。我认为有些 图像处理算法应该像直方图平衡一样应用,以优化子图像和我们尝试定位它的区域之间的相似性。
它类似于创建蒙娜丽莎的遗传算法 类似。
可以在此处找到马赛克示例。
Task is following: how to create selected picture mosaic from large number of images.
My first shot would be using evolutionary algorithm. Where genotype represents mapping of original images to positions in mosaic grid, and individual is evaluated according to similarity to original picture. Actually in basic approach each tile can be treated separately so iterating through the grid and matching best image would be sufficient. But I don't know yet how to define similarity functions.
Naive pixel wise comparing (r,g,b) difference probably would be too strict. I think that some
image processing algorithms should be apply like histogram balancing to optimize similarity between subimage and region where we try to locate it.
It would be similar to genetic algorithm that creates Mona Lisa resemble.
Sample mosaic can be found here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我这样做了(但我停在某个地方)看看:
GetAMosaic 这是一个测试项目,需要再次执行一些 C 操作:-) 所以不要查看那里的每个细节。
Well I did that (but I stopped somewhere) Look at:
GetAMosaic It was a testproject to do some C again:-) So dont look at every detail there.