ImagePRO-Python 0.4.1__tar.gz → 0.5.1__tar.gz
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.
- {imagepro_python-0.4.1/src/ImagePRO_Python.egg-info → imagepro_python-0.5.1}/PKG-INFO +2 -1
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/pyproject.toml +4 -2
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py +1 -1
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/body_analysis/hand_tracking.py +1 -1
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py +1 -1
- imagepro_python-0.5.1/src/ImagePRO/human_analysis/face_analysis/face_comparison.py +60 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py +1 -1
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py +1 -1
- {imagepro_python-0.4.1 → imagepro_python-0.5.1/src/ImagePRO_Python.egg-info}/PKG-INFO +2 -1
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO_Python.egg-info/SOURCES.txt +1 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO_Python.egg-info/requires.txt +1 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/LICENSE +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/setup.cfg +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/__init__.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/__init__.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/body_analysis/__init__.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/face_analysis/__init__.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/human_analysis/face_analysis/face_detection.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/object_analysis/object_detection.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/__init__.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/blur.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/contrast.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/crop.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/dataset_generator.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/grayscale.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/resize.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/rotate.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/sharpen.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/utils/__init__.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/utils/io_handler.py +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO_Python.egg-info/dependency_links.txt +0 -0
- {imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO_Python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ImagePRO-Python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: clean, modular, and easy-to-use Python library for image processing tasks.
|
|
5
5
|
Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -16,4 +16,5 @@ Requires-Dist: numpy<3.0,>=1.24
|
|
|
16
16
|
Requires-Dist: opencv-python<5.0,>=4.8
|
|
17
17
|
Requires-Dist: ultralytics<9.0,>=8.2.0
|
|
18
18
|
Requires-Dist: mediapipe<1.0,>=0.10.0
|
|
19
|
+
Requires-Dist: insightface<1.0,>=0.7
|
|
19
20
|
Dynamic: license-file
|
|
@@ -7,7 +7,7 @@ where = ["src"]
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "ImagePRO-Python"
|
|
10
|
-
version = "0.
|
|
10
|
+
version = "0.5.1"
|
|
11
11
|
description = "clean, modular, and easy-to-use Python library for image processing tasks."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = "==3.10.*"
|
|
@@ -25,8 +25,10 @@ dependencies = [
|
|
|
25
25
|
"numpy>=1.24,<3.0",
|
|
26
26
|
"opencv-python>=4.8,<5.0",
|
|
27
27
|
"ultralytics>=8.2.0,<9.0",
|
|
28
|
-
"mediapipe>=0.10.0,<1.0",
|
|
28
|
+
"mediapipe>=0.10.0,<1.0",
|
|
29
|
+
"insightface>=0.7,<1.0",
|
|
29
30
|
]
|
|
30
31
|
|
|
32
|
+
|
|
31
33
|
[tool.hatch.build.targets.wheel]
|
|
32
34
|
packages = ["src/ImagePRO"]
|
|
@@ -99,7 +99,7 @@ def detect_body_pose(
|
|
|
99
99
|
|
|
100
100
|
def detect_body_pose_live():
|
|
101
101
|
"""Starts webcam and shows real-time body pose detection. Press ESC to exit."""
|
|
102
|
-
cap = cv2.VideoCapture(0)
|
|
102
|
+
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
|
|
103
103
|
if not cap.isOpened():
|
|
104
104
|
raise RuntimeError("Failed to open webcam.")
|
|
105
105
|
|
|
@@ -115,7 +115,7 @@ def detect_hands_live(max_hands: int = 2, min_confidence: float = 0.7):
|
|
|
115
115
|
if not isinstance(min_confidence, (int, float)) or not (0.0 <= min_confidence <= 1.0):
|
|
116
116
|
raise ValueError("'min_confidence' must be a float between 0.0 and 1.0.")
|
|
117
117
|
|
|
118
|
-
cap = cv2.VideoCapture(0)
|
|
118
|
+
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
|
|
119
119
|
if not cap.isOpened():
|
|
120
120
|
raise RuntimeError("Failed to open webcam.")
|
|
121
121
|
|
|
@@ -131,7 +131,7 @@ def analyze_eye_status_live(min_confidence: float = 0.7, threshold: float = 0.2)
|
|
|
131
131
|
if not isinstance(min_confidence, (int, float)) or not (0 <= min_confidence <= 1):
|
|
132
132
|
raise ValueError("'min_confidence' must be between 0 and 1.")
|
|
133
133
|
|
|
134
|
-
cap = cv2.VideoCapture(0)
|
|
134
|
+
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
|
|
135
135
|
if not cap.isOpened():
|
|
136
136
|
raise RuntimeError("Cannot access webcam.")
|
|
137
137
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from insightface.app import FaceAnalysis
|
|
2
|
+
import cv2
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
def compare_faces(src_image_path_1, src_image_path_2, app=None):
|
|
6
|
+
"""
|
|
7
|
+
Compare two face images using FaceAnalysis embeddings.
|
|
8
|
+
|
|
9
|
+
This function calculates the cosine similarity between the embeddings
|
|
10
|
+
of two detected faces to check if they belong to the same person.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
src_image_path_1 (str | Path): Path to the first image.
|
|
14
|
+
src_image_path_2 (str | Path): Path to the second image.
|
|
15
|
+
app (FaceAnalysis, optional): Pre-loaded FaceAnalysis model instance.
|
|
16
|
+
If not provided, it will be initialized inside the function.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
bool | str:
|
|
20
|
+
- True : Faces match (cosine similarity > 0.5).
|
|
21
|
+
- False : Faces do not match.
|
|
22
|
+
- 'No Face Detected' : If no face is found in either image.
|
|
23
|
+
"""
|
|
24
|
+
# Prepare FaceAnalysis model if not provided
|
|
25
|
+
if app is None:
|
|
26
|
+
app = FaceAnalysis(
|
|
27
|
+
name="buffalo_l",
|
|
28
|
+
providers=["CPUExecutionProvider"],
|
|
29
|
+
)
|
|
30
|
+
app.prepare(ctx_id=0) # Run on CPU
|
|
31
|
+
|
|
32
|
+
# Helper function to read an image and convert to RGB
|
|
33
|
+
def load_rgb(path):
|
|
34
|
+
img = cv2.imread(str(path))
|
|
35
|
+
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB) if img is not None else None
|
|
36
|
+
|
|
37
|
+
# Load and preprocess both images
|
|
38
|
+
img1 = load_rgb(src_image_path_1)
|
|
39
|
+
img2 = load_rgb(src_image_path_2)
|
|
40
|
+
|
|
41
|
+
if img1 is None or img2 is None:
|
|
42
|
+
return 'Invalid Image Path'
|
|
43
|
+
|
|
44
|
+
# Detect faces in both images
|
|
45
|
+
faces1 = app.get(img1)
|
|
46
|
+
faces2 = app.get(img2)
|
|
47
|
+
|
|
48
|
+
# Ensure a face was detected in both images
|
|
49
|
+
if not faces1 or not faces2:
|
|
50
|
+
return 'No Face Detected'
|
|
51
|
+
|
|
52
|
+
# Get the embeddings of the first detected face in each image
|
|
53
|
+
emb1 = faces1[0].embedding
|
|
54
|
+
emb2 = faces2[0].embedding
|
|
55
|
+
|
|
56
|
+
# Compute cosine similarity between the embeddings
|
|
57
|
+
sim = np.dot(emb1, emb2) / (np.linalg.norm(emb1) * np.linalg.norm(emb2))
|
|
58
|
+
|
|
59
|
+
# Return match result based on threshold
|
|
60
|
+
return True if sim > 0.5 else False
|
|
@@ -181,7 +181,7 @@ def analyze_face_mesh_live(max_faces: int = 1, min_confidence: float = 0.7):
|
|
|
181
181
|
if not isinstance(min_confidence, (int, float)) or not (0 <= min_confidence <= 1):
|
|
182
182
|
raise ValueError("'min_confidence' must be between 0 and 1.")
|
|
183
183
|
|
|
184
|
-
cap = cv2.VideoCapture(0)
|
|
184
|
+
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
|
|
185
185
|
if not cap.isOpened():
|
|
186
186
|
raise RuntimeError("Unable to open webcam.")
|
|
187
187
|
|
|
@@ -130,7 +130,7 @@ def estimate_head_pose_live(max_faces: int = 1, min_confidence: float = 0.7):
|
|
|
130
130
|
if not isinstance(min_confidence, (int, float)) or not (0 <= min_confidence <= 1):
|
|
131
131
|
raise ValueError("'min_confidence' must be between 0 and 1.")
|
|
132
132
|
|
|
133
|
-
cap = cv2.VideoCapture(0)
|
|
133
|
+
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
|
|
134
134
|
if not cap.isOpened():
|
|
135
135
|
raise RuntimeError("Failed to access webcam.")
|
|
136
136
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ImagePRO-Python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: clean, modular, and easy-to-use Python library for image processing tasks.
|
|
5
5
|
Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
|
|
6
6
|
License: MIT
|
|
@@ -16,4 +16,5 @@ Requires-Dist: numpy<3.0,>=1.24
|
|
|
16
16
|
Requires-Dist: opencv-python<5.0,>=4.8
|
|
17
17
|
Requires-Dist: ultralytics<9.0,>=8.2.0
|
|
18
18
|
Requires-Dist: mediapipe<1.0,>=0.10.0
|
|
19
|
+
Requires-Dist: insightface<1.0,>=0.7
|
|
19
20
|
Dynamic: license-file
|
|
@@ -7,6 +7,7 @@ src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py
|
|
|
7
7
|
src/ImagePRO/human_analysis/body_analysis/hand_tracking.py
|
|
8
8
|
src/ImagePRO/human_analysis/face_analysis/__init__.py
|
|
9
9
|
src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py
|
|
10
|
+
src/ImagePRO/human_analysis/face_analysis/face_comparison.py
|
|
10
11
|
src/ImagePRO/human_analysis/face_analysis/face_detection.py
|
|
11
12
|
src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py
|
|
12
13
|
src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/object_analysis/object_detection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO/pre_processing/dataset_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{imagepro_python-0.4.1 → imagepro_python-0.5.1}/src/ImagePRO_Python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|