我正在尝试在Python中矫正一张图片。我有一个单应性H (来自绕x、y和z轴旋转的旋转矩阵) ,例如:
[[ 9.95671447e-01 7.83610423e-02 7.47993630e+02]
[-7.69292630e-02 9.96586377e-01 -4.48354859e+02]
[-3.48494755e-06 1.73615469e-06 9.98300856e-01]]
我想使用cv2.perspectiveTransform()实现,但我做不到。这是我使用的代码:
但我遇到了以下错误:
# warp image
img_cv2 = cv2.imread('surf.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
# strange output but it does something:
dst = cv2.perspectiveTransform(img_cv2,H)
但我遇到了以下错误:
Traceback (most recent call last):
File "C:\directory structure\python_files\Rectification\rectify.py", line 82, in <module>
dst = cv2.perspectiveTransform(img_cv2,H)
error: C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\matmul.cpp:1916: error: (-215) scn + 1 == m.cols && (depth == CV_32F || depth == CV_64F)`</pre>
有人能看出问题出在哪里吗?