Advertisement
KillianMills

Mosaic

Mar 11th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.94 KB | None | 0 0
  1. display image
  2. ------
  3. load 'C:\Users\admin\Desktop\mosaic.mat'
  4. image(mosaic)
  5. colormap(gray(256))
  6.  
  7. -----
  8. I=imread('imagename.pbm');
  9. F=fft2(double(I));
  10.  
  11. F=fft2(double(mosaic));
  12. S=fftshift(F);
  13. L=log2(S);
  14. A=abs(L);
  15. imagesc(A)
  16.  
  17. F2=fft2(double(mosaic));
  18. L2=log2(F2);
  19. A2=abs(L2);
  20. imagesc(A2)
  21.  
  22.  
  23. mask2
  24. ------
  25. load 'mosaic';
  26. y = fft2(mosaic);
  27. mask = zeros(569,800);
  28. myMask2 = createMask2(mask,y,**amount of boxes**);
  29. y2 = y.*myMask2;
  30. z = ifft2(y2);
  31. image(256*(abs(z))/max(max(abs(z))));
  32.  
  33. masks
  34. ------
  35. y=fft2(mosaic);
  36.  
  37.  
  38. mask = zeros(569,800);
  39. mask(1:30,1:30)=1;
  40. mask(1:30,226:256)=1;
  41. mask(226:256,1:30)=1;
  42. mask(226:256,226:256)=1;
  43. image(256*mask)
  44.  
  45. mask = zeros(256,256);
  46. mask(1:30,1:30)=1;
  47. mask(1:30,226:256)=1;
  48. mask(226:256,1:30)=1;
  49. mask(226:256,226:256)=1;
  50. image(256*mask)
  51.  
  52.  
  53. ------
  54. function mask = createCircleMask(cx,cy,ix,iy,r)
  55. [x,y]=meshgrid(-(cx-1):(ix-cx),-(cy-1):(iy-cy));
  56. mask=((x.^2+y.^2)<=r^2);
  57. image(256*mask);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement