ezeyeauth 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: ezeyeauth
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Author-email: JohnnyTech <johndrostan@outlook.com>
6
+ License-Expression: MIT
7
+ Keywords: authentication,biometrics,eye,iris,recognition
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: open-iris
10
+ Requires-Dist: opencv-python==4.7.0.68
11
+ Description-Content-Type: text/markdown
12
+
13
+ # EZEyeAuth
14
+
15
+ ### Authentication Using Iris-Scanner
16
+
17
+
18
+ #### How to enroll
19
+ ```python
20
+ from ezeyeauth import Authenticator
21
+ auth = Authenticator()
22
+ auth.enroll("/path/to/left/iris.png", "/path/to/right/iris.png")
23
+ ```
24
+
25
+ #### How to authenticate
26
+ ```python
27
+ from ezeyeauth import Authenticator
28
+ auth = Authenticator()
29
+ match = auth.auth("/path/to/left/iris.png", "/path/to/right/iris.png")
30
+ print(match)
31
+
32
+ ```
33
+
34
+
@@ -0,0 +1,4 @@
1
+ src/__init__.py,sha256=hjZfW-UJ3tJJkV4rGqGIjv-nDzEXCwQBFdOEY2Q5d7M,1554
2
+ ezeyeauth-0.1.0.dist-info/METADATA,sha256=eD9NpcTNjpCDO-b6z3ZQ3u9Zi0t3soKOQq7TEmzsSII,745
3
+ ezeyeauth-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
4
+ ezeyeauth-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
src/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ import cv2
2
+ import iris # Openiris is MIT licenced
3
+ import pickle
4
+ import os
5
+
6
+ THRESHOLD = 0.32
7
+ TEMPLATE_DIR = os.path.expanduser("~/.horizon/iris")
8
+
9
+ class Authenticator:
10
+ def __init__(self):
11
+ self.iris_pipeline = iris.IRISPipeline()
12
+ self.matcher = iris.HammingDistanceMatcher()
13
+
14
+ def enroll(self, img_left, img_right):
15
+ os.makedirs(TEMPLATE_DIR, exist_ok=True)
16
+ left_out = self.iris_pipeline(iris.IRImage(img_data=img_left, eye_side="left"))
17
+ right_out = self.iris_pipeline(iris.IRImage(img_data=img_right, eye_side="right"))
18
+ with open(f"{TEMPLATE_DIR}/owner_left.pkl", "wb") as f:
19
+ pickle.dump(left_out["iris_template"], f)
20
+ with open(f"{TEMPLATE_DIR}/owner_right.pkl", "wb") as f:
21
+ pickle.dump(right_out["iris_template"], f)
22
+
23
+ def load_templates(self):
24
+ with open(f"{TEMPLATE_DIR}/owner_left.pkl", "rb") as f:
25
+ left = pickle.load(f)
26
+ with open(f"{TEMPLATE_DIR}/owner_right.pkl", "rb") as f:
27
+ right = pickle.load(f)
28
+ return left, right
29
+
30
+ def auth(self, img_left, img_right):
31
+ owner_left, owner_right = self.load_templates()
32
+ left_out = self.iris_pipeline(iris.IRImage(img_data=img_left, eye_side="left"))
33
+ right_out = self.iris_pipeline(iris.IRImage(img_data=img_right, eye_side="right"))
34
+ left_dist = self.matcher.run(owner_left, left_out["iris_template"])
35
+ right_dist = self.matcher.run(owner_right, right_out["iris_template"])
36
+ return left_dist < THRESHOLD and right_dist < THRESHOLD