=contours2[0]
cnt3=contours3[0]
ret0=cv2.matchShapes(cnt1,cnt1,1,0.0)
ret1=cv2.matchShapes(cnt1,cnt2,1,0.0...)
ret2=cv2.matchShapes(cnt1,cnt3,1,0.0)
print("相同图像的matchShape=",ret0)
print("相似图像的matchShape=",ret1)...相同图像的matchShape= 0.0
相似图像的matchShape= 0.19863853606386983
不相似图像的matchShape= 0.11567279132076783
算法:形状匹配是通过...对于图像A,图像B:
retval=cv2.matchShapes(contour1, contour2, method, parameter)
contour1表示第1个轮廓或灰度图像
contour2...表示第2个轮廓或灰度图像
method表示比较两个图像的Hu矩的方法
parameter表示应用于method的特定参数