⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example2.m

📁 纹理合成matlab源代码,非常好
💻 M
字号:
% Example 2:  Seamless blending of real and synthetic texture in an% image, using Portilla-Simoncelli texture analysis/synthesis code,% based on alternate projections onto statistical constraints in a% complex overcomplete wavelet representation.%% See Readme.txt, and headers of textureAnalysis.m and% textureSynthesis.m for more details.%% Javier Portilla (javier@decsai.ugr.es).  March, 2001close allNsc = 4; % Number of scalesNor = 4; % Number of orientationsNa = 5;  % Spatial neighborhood is Na x Na coefficients			% It must be an odd number!im0 = pgmRead('nuts.pgm');	% Warning: im0 is a double float matrix!params = textureAnalysis(im0, Nsc, Nor, Na);Niter = 25;	% Number of iterations of synthesis loopNsx = 192;	% Size of synthetic image is Nsy x NsxNsy = 192;	% Warning: both dimensions must be multiple of 2^(Nsc+2)% Use a mask and the original image to synthesize an image with the% left side synthetic and the right side real data.% The effective mask is M = (mask>0), its smoothness is for avoiding% border effects.ramp = meshgrid(1:Nsx/4,1:Nsy)*4/Nsy;mask = [zeros(Nsy,Nsx/2) ramp ramp(:,Nsx/4:-1:1)];mask =  1/2*(1-cos(pi*mask));showIm(mask>0, 'auto', 'auto', 'Mask');display('Press any key to continue');pauseimKeep = zeros(Nsx*Nsy,2);imKeep(:,1) = reshape(mask, [Nsy*Nsx,1]);imKeep(:,2) = reshape(im0(1:Nsy,1:Nsx), [Nsy*Nsx,1]);	% Originalres = textureSynthesis(params, [Nsy Nsx], Niter,[],imKeep);close allfigure(1);showIm(mask>0, 'auto', 'auto', 'Mask');figure(2);showIm(im0, 'auto', 'auto', 'Original Texture');figure(3);showIm(res, 'auto', 'auto', 'Blended Original and Synthetic Texture');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -