Advertisement
dan-masek

Untitled

Sep 22nd, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3.  
  4. img = cv2.imread('captcha1.jpg')
  5. phase = -0.8 * np.pi
  6. omega = 2.0 * np.pi / img.shape[1]
  7. amp = 15.0
  8.  
  9. x = np.arange(img.shape[1], dtype=np.float32)
  10. y = np.arange(img.shape[0], dtype=np.float32)
  11. xx, yy = np.meshgrid(x, y)
  12. u = 0.0
  13. v = np.sin(phase + xx * omega) * amp
  14.  
  15. corr = cv2.remap(img,  xx + u, yy + v, cv2.INTER_LINEAR)
  16. cv2.imshow('in', img)
  17. cv2.imshow('out', corr)
  18. cv2.waitKey()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement