March 2018
Beginner to intermediate
306 pages
9h 54m
English
You need to complete the following steps:
import mathimport cv2import numpy as np
img = cv2.imread('../data/Lena.png')
xmap = np.zeros((img.shape[1], img.shape[0]), np.float32)ymap = np.zeros((img.shape[1], img.shape[0]), np.float32)for y in range(img.shape[0]): for x in range(img.shape[1]): xmap[y,x] = x + 30 * math.cos(20 * x / img.shape[0]) ymap[y,x] = y + 30 * math.sin(20 * y / img.shape[1])
remapped_img = cv2.remap(img, xmap, ymap, cv2.INTER_LINEAR, None, cv2.BORDER_REPLICATE)
plt.figure(0)plt.axis('off')plt.imshow(remapped_img[:,:,[2,1,0]])plt.show()
Read now
Unlock full access