我一直在为我的论文尝试各种算法。现在我专注于模板匹配(匹配的主要焦点是边缘)。然后我发现了倒角匹配。我在自己编码还是使用可用的实现(哪个更好)之间左右为难。然后我发现了上述算法的 cpp 实现。但是,我遇到了奇怪的错误。 ↓
OpenCV Error: Assertion failed (img.type() == CV_8UC1 && templ.type() == CV_8UC1)
in chamerMatching, file /home/pyimagesearch/Downloads/opencv-2.4.8/modules/contrib/src/chamfermatching.cpp, line 1370
Traceback (most recent call last):
File "template.py", line 12, in <module> cv2.chamerMatching(template1, queryFrame, 1, 1) cv2.error:
/home/pyimagesearch/Downloads/opencv-2.4.8/modules/contrib/src/chamfermatching.cpp:1370:
error: (-215) img.type() == CV_8UC1 && templ.type() == CV_8UC1 in function chamerMatching
我试图找到目录/home/pyimagesearch/Downloads/opencv-2.4.8/modules/contrib/src/chamfermatching.cpp(以检查我是否遗漏了函数调用所需的参数), 但令我惊讶的是,我的下载文件夹下没有 opencv-2.4.8 文件夹。
有谁知道错误的主要原因是什么? 非常感谢您的回答。 :) 谢谢!
最佳答案
我认为类型函数不像 cv8uc1 那样返回值。它应该返回整数值。您可以在以下页面中找到类型函数返回的整数值映射列表 http://ninghang.blogspot.com.tr/2012/11/list-of-mat-type-in-opencv.html?m=1 .您可以更改它们并重试吗?
关于python - python opencv中的倒角匹配错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34490795/