Traceback (most recent call last): File "C:\Users\DELL\Desktop\dataTool\test.py", line 38, in <module> transformed_coordinate = cv2.perspectiveTransform(pixel_coordinate, perspective_matrix) cv2.error: OpenCV(4.6.0) C:\b\abs_74oeeuevib\croots\recipe\opencv-suite_1664548340488\work\modules\core\src\matmul.dispatch.cpp:550: error: (-215:Assertion failed) scn + 1 == m.cols in function 'cv::perspectiveTransform' Traceback (most recent call last): File "C:\Users\DELL\Desktop\dataTool\test.py", line 38, in <module> transformed_coordinate = cv2.perspectiveTransform(pixel_coordinate, perspective_matrix) cv2.error: OpenCV(4.6.0) C:\b\abs_74oeeuevib\croots\recipe\opencv-suite_1664548340488\work\modules\core\src\matmul.dispatch.cpp:550: error: (-215:Assertion failed) scn + 1 == m.cols in function 'cv::perspectiveTransform' Traceback (most recent call last): File "C:\Users\DELL\Desktop\dataTool\test.py", line 38, in <module> transformed_coordinate = cv2.perspectiveTransform(pixel_coordinate, perspective_matrix) cv2.error: OpenCV(4.6.0) C:\b\abs_74oeeuevib\croots\recipe\opencv-suite_1664548340488\work\modules\core\src\matmul.dispatch.cpp:550: error: (-215:Assertion failed) scn + 1 == m.cols in function 'cv::perspectiveTransform' Traceback (most recent call last): File "C:\Users\DELL\Desktop\dataTool\test.py", line 38, in <module> transformed_coordinate = cv2.perspectiveTransform(pixel_coordinate, perspective_matrix) cv2.error: OpenCV(4.6.0) C:\b\abs_74oeeuevib\croots\recipe\opencv-suite_1664548340488\work\modules\core\src\matmul.dispatch.cpp:550: error: (-215:Assertion failed) scn + 1 == m.cols in function 'cv::perspectiveTransform' Traceback (most recent call last): File "C:\Users\DELL\Desktop\dataTool\test.py", line 38, in <module> transformed_coordinate = cv2.perspectiveTransform(pixel_coordinate, perspective_matrix)
时间: 2023-07-21 21:05:17 浏览: 194
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个错误通常出现在透视变换的输入参数上。请确保输入的像素坐标和透视变换矩阵的维度和类型是正确的。以下是一些可能导致错误的原因和解决方法:
1. 检查像素坐标的维度和类型是否正确。像素坐标应该是一个形状为 (N, 1, 2) 的浮点数数组,其中 N 是点的数量。
2. 检查透视变换矩阵的维度和类型是否正确。透视变换矩阵应该是一个形状为 (3, 3) 的浮点数数组。
3. 检查像素坐标和透视变换矩阵的数据类型是否匹配。通常情况下,像素坐标和透视变换矩阵都应该是浮点数类型(`float32`)。
4. 确保你的像素坐标和透视变换矩阵是正确对应的。透视变换矩阵是通过使用 `cv2.findHomography` 函数计算得到的,它需要一组对应的像素坐标和地理坐标。
如果你仍然遇到问题,请提供更多的代码和错误信息,以便我可以更好地帮助你解决问题。
阅读全文