0% found this document useful (0 votes)
5 views6 pages

Python Code For Biometric

The document describes a process for fingerprint image processing, including loading an image, applying binary thresholding, histogram equalization, and skeletonization to extract minutiae points. It then details the conversion of these minutiae into a QR code by resizing, compressing the image, and encoding it into a QR format. Finally, the QR code is saved and displayed.

Uploaded by

jsksjs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Python Code For Biometric

The document describes a process for fingerprint image processing, including loading an image, applying binary thresholding, histogram equalization, and skeletonization to extract minutiae points. It then details the conversion of these minutiae into a QR code by resizing, compressing the image, and encoding it into a QR format. Finally, the QR code is saved and displayed.

Uploaded by

jsksjs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

import cv2

import numpy as np
import [Link] as plt

# Load the fingerprint image


image = [Link]('[Link]', cv2.IMREAD_GRAYSCALE)

# Display the original image


[Link](image, cmap='gray')
[Link]('Original Image')
[Link]()

# Apply binary thresholding

_, binary_image = [Link](image, 127, 255, cv2.THRESH_BINARY)

# Display the binary image


[Link](binary_image, cmap='gray')
[Link]('Binary Image')
[Link]()
# Apply histogram equalization for enhancement
enhanced_image = [Link](image)

# Display the enhanced image


[Link](enhanced_image, cmap='gray')
[Link]('Enhanced Image')
[Link]()
from [Link] import skeletonize

# Invert the binary image for skeletonization


binary_inverted = [Link](binary_image // 255)
skeleton = np.uint8(binary_inverted) * 255

#Perform skeletonization
#skeleton = skeletonize(binary_inverted)

# Display the skeletonized image


[Link](skeleton, cmap='gray')
[Link]('Skeleton Image')
[Link]()
from [Link] import corner_harris, corner_peaks

# Detect corners in the skeleton image


corners = corner_peaks(corner_harris(skeleton), min_distance=10)

# Display the minutiae points on the skeleton image


[Link](skeleton, cmap='gray')
[Link](corners[:, 1], corners[:, 0], color='red', s=10)
[Link]('Minutiae on Skeleton Image')
[Link]()
Minutia to Qr.

import qrcode
from PIL import Image
import io

# Step 1: Load the fingerprint minutia image


image_path = "[Link]"
image = [Link](image_path)

# Step 2: Resize the image to reduce its size (even more)


image = [Link](([Link] // 4, [Link] // 4)) # Further
reduce size

# Step 3: Convert the image to grayscale to further reduce size


image = [Link]("L")

# Step 4: Convert the image to a byte array with higher compression


byte_arr = [Link]()
[Link](byte_arr, format='JPEG', quality=10) # Compress the image
with lower quality
image_bytes = byte_arr.getvalue()
# Step 5: Encode the byte array into a QR code
qr = [Link](
version=None, # Automatically find the best version for the data
error_correction=[Link].ERROR_CORRECT_L, # Error
correction level
box_size=10, # Size of each box in the QR code grid
border=4, # Thickness of the border (in boxes)
)
qr.add_data(image_bytes)
[Link](fit=True)

# Step 6: Create an image from the QR Code instance


qr_img = qr.make_image(fill='black', back_color='white')

# Save the QR code image


qr_code_image_path = "minutia_qr_code.png"
qr_img.save(qr_code_image_path)

# Display the QR code (optional)


qr_img.show()

print(f"QR code saved as {qr_code_image_path}")

You might also like