1 | initial version |
Found the solution in the find_obj.py
sample. The catch is that the C++ code is expecting a "two-channel or three-channel floating-point array, where each element is a 2D/3D vector", which translates in Python/NumPy to a 3-dimensional array.
import cv2
import numpy as np
a = np.array([[1, 2], [4, 5], [7, 8]], dtype='float32')
h = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype='float32')
a = np.array([a])
pointsOut = cv2.perspectiveTransform(a, h)