如何使用flutter通过图像获取指纹

问题描述 投票:0回答:1

我正在使用opencv包https://pub.dev/packages/opencv_4但无法从图像中清晰地获取指纹。

我正在使用这个功能。

 Uint8List? _byte = await Cv2.morphologyEx(
        pathFrom: CVPathFrom.GALLERY_CAMERA,
        pathString: photoFinger.path,
        operation: Cv2.COLOR_BayerGB2RGB ,
        kernelSize:  [30, 30],
      );

我有使用 openvcv lib 的 python 代码,但不知道如何将其转换为 dart。使用 openCv dart 包。

python代码是:

import cv2

# Read the input image
img = cv2.imread('input_image.jpg', cv2.IMREAD_GRAYSCALE)

# Apply Gaussian blur to remove noise
img = cv2.GaussianBlur(img, (5, 5), 0)

# Apply adaptive thresholding to segment the fingerprint
img = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 11, 5)

# Apply morphological operations to remove small objects and fill in gaps
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3, 3))
img = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel, iterations=1)
img = cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel, iterations=1)

# Estimate the orientation field of the fingerprint
sobel_x = cv2.Sobel(img, cv2.CV_32F, 1, 0, ksize=3)
sobel_y = cv2.Sobel(img, cv2.CV_32F, 0, 1, ksize=3)
theta = cv2.phase(sobel_x, sobel_y)

# Apply non-maximum suppression to thin the ridges
theta_quantized = np.round(theta / (np.pi / 8)) % 8
thin = cv2.ximgproc.thinning(img, thinningType=cv2.ximgproc.THINNING_ZHANGSUEN, thinningIterations=5)

# Extract minutiae points from the fingerprint
minutiae = cv2.ximgproc.getFastFeatureDetector().detect(thin)

# Display the output image with minutiae points
img_with_minutiae = cv2.drawKeypoints(img, minutiae, None, color=(0, 255, 0), flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv2.imshow('Output Image', img_with_minutiae)
cv2.waitKey(0)
cv2.destroyAllWindows()
flutter image dart fingerprint
1个回答
0
投票

你有解决这个问题的方法吗

© www.soinside.com 2019 - 2024. All rights reserved.