【发布时间】:2014-02-20 11:09:00
【问题描述】:
我正在尝试纠正 python 中的图像。我有一个 Homography 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>
任何人都可以看到出了什么问题吗?
【问题讨论】:
-
接受一个答案,因此它看起来已解决,并会帮助其他遇到同样问题的人。
标签: python opencv image-processing