Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. MATLAB. Inverse crop images.
  2. I=imread('img_9.tif');
  3. I2=imcrop(I,[60,50,85,85]);
  4. n_big=size(I);
  5. n_small=size(I2);
  6.  
  7. for j1=1:(n_big(1)-n_small(1))
  8. for j2=1:(n_big(2)-n_small(2))
  9.     Itest=I(j1:j1+n_small(1)-1,j2:j2+n_small(2)-1,:);
  10.     if ( Itest == I2)
  11.         I(j1:j1+n_small(1)-1,j2:j2+n_small(2)-1,:) = zeros(n_small(1),n_small(2),3);
  12.     end
  13. end
  14. end
  15.  
  16. figure(1);
  17. imshow(I);
  18. figure(2);
  19. imshow(I2);