我正在做虹膜识别,我有 2 个虹膜阈值图像。如何使用 Python 在 2 个图像之间进行汉明距离?谢谢
这里有极坐标变换之前的原始图像:
和代码:
img_crop1 = cv.imread('crop_1.png')
polar_img = cv.warpPolar(
img_crop1, (256, 1024), (self.iris_1[0], self.iris_1[1]), self.iris_1[2] * 2, cv.WARP_POLAR_LINEAR)
# Rotate it sideways to be more visually pleasing
polar_img = cv.rotate(polar_img, cv.ROTATE_90_COUNTERCLOCKWISE)
# crop image
polar_img = polar_img[int(polar_img.shape[0] / 2)
: polar_img.shape[0], 0: polar_img.shape[1]]
polar_img = cv.cvtColor(polar_img, cv.COLOR_BGR2GRAY)
_, threshold = cv.threshold(polar_img, 100, 255, cv.THRESH_BINARY)
cv.imwrite("foreground.png", threshold)