**opencv中 cv.matchShapes() 可以检测两个形状之间的相似度,返回值越小,越相似。**先读入下面这张图片:
进行实验:
import numpy as np
import cv2 as cv
img = cv.imread('shapes.jpg', 0)
_, thresh = cv.threshold(img, 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)
contours, hierarchy = cv.findContours