Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.77 KB | None | 0 0
  1. function [steps,diffs] = rotate(img)
  2.     steps = [];
  3.     diffs = [];
  4.     [n,m] = size(img)
  5.     BigImg = zeros(1024)
  6.     BigImg((n/2):(n/2+n-1) , (m/2):(m/2+m-1)) = img
  7.     for fi=7:7:42
  8.         steps = [steps,fi];
  9.         Rotated = imrotate(BigImg,fi,'crop');
  10.         Rotatedback = imrotate(Rotated,-fi,'crop');
  11.         Rotatedback = Rotatedback((n/2):(n/2+n-1) , (m/2):(m/2+m-1))
  12.         imwrite(Rotatedback,'corvi_peppers_transformed.pgm')
  13.         corr = Extract('peppers.pgm','corvi_peppers_transformed.pgm','corvi')
  14.         diffs = [diffs,str2double(corr)];
  15.     end
  16.  
  17.     %figure;
  18.     %subplot(1,3,1); imshow(uint8(img)); title('Input');
  19.     %subplot(1,3,2); imshow(uint8(Rotated)); title('Big');
  20.     %subplot(1,3,3); imshow(uint8(Rotatedback)); title('Rotated');
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement