【发布时间】:2022-01-11 20:27:24
【问题描述】:
我正在做虹膜识别,我有 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)
【问题讨论】:
-
你能解释一下图像是如何表示的吗?
-
@PresidentJamesK.Polk 这是使用 WARP_POLAR_LINEAR 方法的极坐标图像的阈值。
-
该图像已损坏。极地经线被赋予了错误的虹膜中心。适当的翘曲会导致直线(圆圈),而不是这个凹凸。 -- 您还应该发布 source 数据而不是过滤后的消化产物,以及多张图片,因为您正在处理 comparison。
-
@ChristophRackwitz 我有这个凹凸是因为我删除了瞳孔,我将添加原始图像和我的代码。
标签: python opencv image-processing hamming-distance iris-recognition