简体   繁体   English

python opencv中的倒角匹配错误

[英]Chamfer Matching error in python opencv

I've been trying out various algorithms for my thesis. 我一直在为我的论文尝试各种算法。 And now i'm currently focusing in template matching (where the main focus in matching would be the edge). 现在,我目前专注于模板匹配(匹配的主要重点是边缘)。 Then I found out about chamfer matching. 然后我发现了倒角匹配。 I'm torn between coding it myself, or using available implementations (which is better). 我在自己编写代码或使用可用的实现方式(更好)之间感到困惑。 Then I found out about a cpp implementation of the said algorithm. 然后我发现了该算法的cpp实现。 However, I'm encountering weird error. 但是,我遇到了奇怪的错误。

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

i tried to locate the directory /home/pyimagesearch/Downloads/opencv-2.4.8/modules/contrib/src/chamfermatching.cpp (so as to inspect whether i'm missing out on the parameter required for the function call), but to my surprise, there's no opencv-2.4.8 folder under my Downloads folder. 我试图找到目录/home/pyimagesearch/Downloads/opencv-2.4.8/modules/contrib/src/chamfermatching.cpp(以便检查我是否缺少函数调用所需的参数),但是令我惊讶的是,我的下载文件夹下没有opencv-2.4.8文件夹。

does anyone know what could be the main cause of the error? 有谁知道可能是导致错误的主要原因? Your answer would be much appreciated. 您的回答将不胜感激。 :) thanks! :) 谢谢!

I think type function don't return value like cv8uc1 . 我认为类型函数不会像cv8uc1这样返回值。 It should return integer value. 它应该返回整数值。 You can find list of integer value map which is returned by type function in following page http://ninghang.blogspot.com.tr/2012/11/list-of-mat-type-in-opencv.html?m=1 . 您可以在以下页面中找到由类型函数返回的整数值映射列表: http://ninghang.blogspot.com.tr/2012/11/list-of-mat-type-in​​-opencv.html?m=1 Could you change them and try again ? 您可以更改它们然后重试吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM