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

📄 example.m

📁 this is a very very very nice code
💻 M
字号:


disp('First, I will demonstrate the image inpainting algorithm...')
IM = imread('arm_dmg.bmp');
IM = rgb2gray(IM); %This is a gray-level image
mask = imread('arm_mask.bmp');

param = struct('decompose', struct('lamda', .01, 'mu', .1, 'num_iter', 13), 'texture', ...
    struct('thresh', 150, 'W', 17, 'sigma', 6, 'skip', 4), ...
    'structure', struct('T', 1000, 'num_fill', 15, 'num_anis', 2, 'num_initial', 400, 'delta', .1));
[Z,u,v,U,V] = inpaint(IM, mask, param);

disp('Top left is the original image. Top Middle is the structure image.')
disp('Top Right is the texture image. Bottom left is the resulting image.')
disp('Bottom middle is the inpainted structure image. Bottom right is the synthesized texture image.')
disp('Note that the results of the image inpainting portion are not that great.')
disp('This is a failing in my implementations use of anisotropic diffusion, which has')
disp('proven to be extremely difficult to implement correctly')





disp('Now I will demonstrate an example where the image inpainting example works well,')
disp('despite the problems with diffusion. The algorithm works well still on inpainting problems')
disp('where the regions to be inpainted are not too thick, or far away from known regions of the image.')
IM = imread('horse_dmg.bmp');
mask = imread('horse_mask.bmp');

param = struct('T', 400, 'num_fill', 15, 'num_anis', 2, 'num_initial', 6, 'delta', .1);
U = zeros(size(IM));
for D = 1:size(IM,3)
    U(:,:,D) = structure_inpaint(IM(:,:,D), mask, param);
end

figure, subplot(1,2,1), imshow(uint8(IM)); subplot(1,2,2), imshow(uint8(U));
disp('On the left is the input image, on the right is the inpainted image.')

⌨️ 快捷键说明

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