【问题标题】:Input dimension of cv2.perspectiveTransformcv2.perspectiveTransform 的输入维度
【发布时间】: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)

【问题讨论】:

    标签: python opencv transform


    【解决方案1】:

    orignal 是将应用预变换的源图像。 Opencv Docs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-13
      • 1970-01-01
      • 2020-03-09
      • 1970-01-01
      • 2019-10-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多