图像递归

ratio = 0.45;
Nit = 100;
threshold = 10;
 
img = imread('Data\man\a\00056.jpg');
x = img;
 [spi spj spz] = size(img);
 pi = floor(spi * 0.2);
 pj = floor(spj * 0.2);
for iit = 1:Nit
   xsmall = imresize(x, ratio);
   xnew = img;
   [h w c] = size(xsmall);
   xnew(pi:pi+h-1, pj:pj+w-1,:) = xsmall(1:h,1:w,:);
 
   diff = x-xnew;
   diff = sum(sum(sum(diff.*diff)));
   if diff < threshold
       break;
   end
 
   x = xnew;
   %imwrite(x, sprintf('iter-%02d.jpg', iit), 'jpg');
end

imshow(x)
 
 
下边的图系转载而来。

图像递归_第1张图片


reflink:

http://blog.pluskid.org/?p=580


你可能感兴趣的:(c)