Python OpenCV chamer匹配函数参考

Python OpenCV chamerMatching function reference

我到处搜索,发现没有关于 chamerMatching 函数的参考资料真是太神奇了,尤其是在 Python 中。其他人也遇到了与 no answer 相同的问题:

我真的不想了解算法 - 我知道算法是如何工作的 - 我想知道如何在 Python 中调用它并检索成本、结果和最佳拟合。我试过下面的代码。

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

ret, frame = cap.read()
frame = cv2.GaussianBlur(frame, (13, 13), 0)
frame = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
frame = cv2.adaptiveThreshold(frame,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2)

templ = cv2.imread("template.png",cv2.CV_LOAD_IMAGE_GRAYSCALE)

cannyframe = cv2.Canny(frame,5,50,apertureSize=3)
cannytempl = cv2.Canny(templ,5,50,apertureSize=3)

cv2.imshow("cannyframe",cannyframe)
cv2.imshow("cannytempl", cannytempl)

cv2.waitKey(0)

#The line below, and NOT any other line, crashes the program
cv2.chamerMatching(cannytempl,cannyframe)

除了最终调用 chamerMatching 函数导致 python 解释器崩溃并因某种原因停止工作外,其他一切都很好 运行,消息如下所示:

关于函数的文档绝对,我不明白为什么。

编辑: 上面的代码现在包括 运行 的所有必需行,下面是 template.png.

不知道您是否还需要这些信息。但我的研究还需要倒角匹配。这是我在遇到与您相同的困境后发现的。

http://code.opencv.org/issues/3602

:)