【发布时间】:2017-03-17 03:50:31
【问题描述】:
以下代码是 OpenCV 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)
【问题讨论】: