Advertisement
Guest User

Shear by angle

a guest
Jan 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.46 KB | None | 0 0
  1. %adapted from https://octave.sourceforge.io/image/function/imtransform.html
  2. im = [checkerboard(20, 2, 4); checkerboard(40, 1, 2)];
  3.  
  4. rho = pi/4 % 45°, can't be zero
  5.  
  6. newpoint = 1 + 1/tan(rho);
  7. p1 = [0 0; 1 0; 1 1];
  8. p2 = [0 0; 1 0; newpoint 1];
  9. T = maketform ('affine', p1, p2);
  10.  
  11. [im2 xdata ydata] = imtransform (im, T);
  12. imh = imshow (im2); set (imh, 'xdata', xdata, 'ydata', ydata)
  13. set (gca, 'xlim', xdata, 'ylim', ydata)
  14. axis on, hold on, xlabel ('Shear');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement