Hey guys, I am really stuck with following image processing problem:
I want to transform images from an IP webcam via remap and warpPerspective before using a YOLO model. Since these two steps are pretty slow on CPU, I want to use GPU accelaration via VPI on my Jetson Nano.
How can I do this? All solution attempts have failed so far.
This is my CPU-based code:
undistorted = cv2.remap(image, map1, map2, interpolation=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT)
transformed = cv2.warpPerspective(undistorted, matrix, img_size)
with
K = np.array(data['K'])
D = np.array(data['D'])
img_size = tuple(data['img_size']) # (width, height)
new_K = np.array(data['new_K'])
map1, map2 = cv2.fisheye.initUndistortRectifyMap(K, D, np.eye(3), new_K, img_size, cv2.CV_16SC2)
src_points = np.float32([[253, 845], [332, 910], [2065, 885], [2120, 820]])
dst_points = np.float32([[253, 845], [253, 910], [2120, 885], [2120, 820]])
matrix = cv2.getPerspectiveTransform(src_points, dst_points)
Thanks in advance!