0
以下代码是OpenCV perspectiveTransform函数的一个简单示例。cv2.perspectiveTransform的输入尺寸
import cv2
import numpy as np
src = np.array(((25, 25), (200, 20), (35, 210), (215, 200)), dtype=np.float32)
dest = np.array(((-50, -50), (50, -50), (-50, 50), (50, 50)), dtype=np.float32)
mtx = cv2.getPerspectiveTransform(src, dest)
original = np.array([((42, 42), (30, 100), (150, 75),(100, 150))], dtype=np.float32)
converted = cv2.perspectiveTransform(original, mtx)
print converted
它运作良好,但为什么我需要在cv2.perspectiveTransform(original, mtx)
参数“原始”的附加尺寸,使其工作?
original.shape =>(1,4,2) mtx.shape =>(3,3) src.shape =>(4,2)