Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- img = cv2.imread('captcha1.jpg')
- phase = -0.8 * np.pi
- omega = 2.0 * np.pi / img.shape[1]
- amp = 15.0
- # NB: Mat_<Vec2f> -> 2 channels
- proj = np.zeros((img.shape[0], img.shape[1], 2), np.float32)
- for y in range(img.shape[0]):
- for x in range(img.shape[1]):
- u = 0.0
- v = np.sin(phase + float(x) * omega) * amp
- proj[y, x] = (float(x) + u, float(y) + v)
- corr = cv2.remap(img, proj, None, cv2.INTER_LINEAR)
- cv2.imshow('in', img)
- cv2.imshow('out', corr)
- cv2.waitKey()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement