文理合成像素算法可以说是非常古老而经典的算法,对于刚学习opencv的萌新再适合不过来。
原始资料相信大家都知道,不知道看下面链接:http://graphics.cs.cmu.edu/people/efros/research/EfrosLeung.html
伪代码在下:
Let SampleImage contain the image we aresampling from and let Image be the mostly empty image that we want to fill in(if synthesizing from scratch, it should contain a 3-by-3 seed in the centerrandomly taken from SampleImage, for constrainedsynthesisit should contain all the known pixels). WindowSize, the size of theneighborhood window, is the only user-settable parameter. The main portion ofthe algorithm is presented below:
//从一个样本图得到元素填充:比如以一个潦草的乱图为样本合成图片来填充image,应该有一个3*3的样本源
//constrained(adj. 不舒服的,被强迫的,拘泥的 v. 约束;限制;强迫( constrain的过去式和过去分词 );强使)
Pixels:像素