The most classic paper on texture synthesis should be about Texture Synthesis by non-parametric sampling of Efros. the reference amount is nearly 2000.
The synthesis here is based on the example, that is, there is a small texture image first, and then a large one is synthesized.
In my personal understanding, a large random image is generated first, and then each pixel in the random image and its neighboring pixels are compared with small texture images, find the nearest neighbor between the current neighbor of a random image and a small texture image, and assign the nearest pixel to a large random image. In this way, each time we process the pixels in a random image, we need to traverse all the pixels in a small texture image, so the running time is very slow.
First look at the effect:
Small texture image:
Synthetic texture image:
The Matlab code is as follows:
Clear all; close all;clc?mask=mat2gray(imread('wen.jpg '); % small texture image [m n] = size (mask); imgn = mat2gray (RAND (256,256 )); % The final large texture image is now a random image W = 2; % L radius I = [1 1 1 1 1; 1 1 1 1 1 1 1 1 1 1; 1 1 0 0 0]; % L neighborhood, here is 5*3, of course, it can also be 7*4 or 9*5 for I = 1 + W: 256 for j = 1 + W: 256-w MI = inf; for p = 1 + W: m for q = 1 + W: n-w tmp = mean2 (ABS (imgn (I-W: I, j-W: J + W ). * I-Mask (p-W: p, q-W: q + W ). * I); If TMP <mi %, obtain the smallest difference pixel MI = TMP; II = P; JJ = Q; end imgn (I, j) = mask (II, JJ); endendfigure; imshow (imgn, []);
Reference blog: http://blog.sina.com.cn/s/blog_50a6faf801009fry.html