def match_hists(hists):
matches = {}
idx = 0
for i in range(len(hists)):
for j in range(len(hists[i])):
matches['{}_{}'.format(i,j)] = idx
idx += 1
for i in range(len(hists)):
for j in range(i+1, len(hists)):
for k in range(len(hists[i])):
corrs = []
for l in range(len(hists[j])):
corr = cv2.compareHist(hists[i][k], hists[j][l], cv2.cv.CV_COMP_INTERSECT)
corrs.append(corr)
corrs = np.array(corrs)
idxs = np.argsort(corrs)
if corrs[idxs[-1]] > 0.80:
matches['{}_{}'.format(j, idxs[-1])] = matches['{}_{}'.format(i, k)]
return matches
评论列表
文章目录