ImagePRO-Python 1.2.2__tar.gz → 1.3.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.
Files changed (57) hide show
  1. {imagepro_python-1.2.2/src/ImagePRO_Python.egg-info → imagepro_python-1.3.1}/PKG-INFO +46 -18
  2. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/pyproject.toml +21 -7
  3. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/readme.md +40 -17
  4. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/__init__.py +2 -2
  5. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/body_analysis/__init__.py +4 -0
  6. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py +26 -5
  7. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/body_analysis/hand_tracking.py +28 -6
  8. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/face_analysis/__init__.py +5 -1
  9. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py +22 -4
  10. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/face_analysis/face_comparison.py +15 -3
  11. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/face_analysis/face_detection.py +5 -2
  12. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py +36 -18
  13. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py +14 -4
  14. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/object_analysis/__init__.py +3 -0
  15. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/object_analysis/object_detection.py +24 -13
  16. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/__init__.py +4 -1
  17. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/blur.py +10 -10
  18. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/contrast.py +4 -7
  19. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/crop.py +4 -5
  20. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/dataset_generator.py +16 -10
  21. imagepro_python-1.3.1/src/ImagePRO/pre_processing/histogram.py +81 -0
  22. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/resize.py +2 -2
  23. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/rotate.py +6 -7
  24. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/sharpen.py +16 -13
  25. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/utils/image.py +7 -6
  26. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/utils/result.py +10 -7
  27. {imagepro_python-1.2.2 → imagepro_python-1.3.1/src/ImagePRO_Python.egg-info}/PKG-INFO +46 -18
  28. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO_Python.egg-info/SOURCES.txt +21 -1
  29. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO_Python.egg-info/requires.txt +6 -0
  30. imagepro_python-1.3.1/tests/test_blur.py +148 -0
  31. imagepro_python-1.3.1/tests/test_body_pose_estimation.py +80 -0
  32. imagepro_python-1.3.1/tests/test_contrast.py +116 -0
  33. imagepro_python-1.3.1/tests/test_crop.py +82 -0
  34. imagepro_python-1.3.1/tests/test_dataset_generator.py +72 -0
  35. imagepro_python-1.3.1/tests/test_eye_status_analysis.py +109 -0
  36. imagepro_python-1.3.1/tests/test_face_comparison.py +67 -0
  37. imagepro_python-1.3.1/tests/test_face_detection.py +111 -0
  38. imagepro_python-1.3.1/tests/test_face_mesh_analysis.py +202 -0
  39. imagepro_python-1.3.1/tests/test_grayscale.py +61 -0
  40. imagepro_python-1.3.1/tests/test_hand_tracking.py +102 -0
  41. imagepro_python-1.3.1/tests/test_head_pose_estimation.py +92 -0
  42. imagepro_python-1.3.1/tests/test_histogram.py +45 -0
  43. imagepro_python-1.3.1/tests/test_image.py +78 -0
  44. imagepro_python-1.3.1/tests/test_integration.py +102 -0
  45. imagepro_python-1.3.1/tests/test_object_detection.py +101 -0
  46. imagepro_python-1.3.1/tests/test_resize.py +45 -0
  47. imagepro_python-1.3.1/tests/test_result.py +169 -0
  48. imagepro_python-1.3.1/tests/test_rotate.py +85 -0
  49. imagepro_python-1.3.1/tests/test_sharpen.py +76 -0
  50. imagepro_python-1.2.2/src/ImagePRO/pre_processing/histogram.py +0 -93
  51. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/LICENSE +0 -0
  52. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/setup.cfg +0 -0
  53. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/human_analysis/__init__.py +0 -0
  54. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/pre_processing/grayscale.py +0 -0
  55. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO/utils/__init__.py +0 -0
  56. {imagepro_python-1.2.2 → imagepro_python-1.3.1}/src/ImagePRO_Python.egg-info/dependency_links.txt +0 -0
  57. {imagepro_python-1.2.2 → imagepro_python-1.3.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: 1.2.2
3
+ Version: 1.3.1
4
4
  Summary: Professional & modular image processing library with OpenCV, MediaPipe, and YOLO integration.
5
5
  Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
6
6
  License: MIT
@@ -32,14 +32,19 @@ Provides-Extra: yolo
32
32
  Requires-Dist: ultralytics<9.0,>=8.2; extra == "yolo"
33
33
  Provides-Extra: mediapipe
34
34
  Requires-Dist: mediapipe<=0.10.11,>=0.10.0; extra == "mediapipe"
35
+ Requires-Dist: numpy<2.0,>=1.24; extra == "mediapipe"
35
36
  Provides-Extra: insightface
36
37
  Requires-Dist: insightface<0.8,>=0.7; extra == "insightface"
37
38
  Requires-Dist: onnxruntime<2.0,>=1.16; extra == "insightface"
39
+ Requires-Dist: numpy<2.0,>=1.24; extra == "insightface"
38
40
  Provides-Extra: full
39
41
  Requires-Dist: mediapipe<=0.10.11,>=0.10.0; extra == "full"
40
42
  Requires-Dist: ultralytics<9.0,>=8.2; extra == "full"
41
43
  Requires-Dist: insightface<0.8,>=0.7; extra == "full"
42
44
  Requires-Dist: onnxruntime<2.0,>=1.16; extra == "full"
45
+ Requires-Dist: numpy<2.0,>=1.24; extra == "full"
46
+ Provides-Extra: dev
47
+ Requires-Dist: pytest<9.0,>=8.0; extra == "dev"
43
48
  Dynamic: license-file
44
49
 
45
50
  # ImagePRO
@@ -50,11 +55,10 @@ Dynamic: license-file
50
55
 
51
56
  Whether you're working on computer vision pipelines, preprocessing images for AI models, or simply automating batch image edits — **ImagePRO** gives you powerful tools with minimal effort.
52
57
 
53
- ## ✨ Features
58
+ ## Features
54
59
 
55
60
  ### **Image I/O & Management**
56
61
  - Flexible input/output handling (file paths or numpy arrays)
57
- - Batch processing capabilities
58
62
  - Multiple format support (JPEG, PNG, CSV, etc.)
59
63
 
60
64
  ### **Pre-processing & Enhancement**
@@ -71,15 +75,23 @@ Whether you're working on computer vision pipelines, preprocessing images for AI
71
75
  ### **Object Detection**
72
76
  - **YOLO Integration**: Multiple accuracy levels (nano to extra-large)
73
77
  - **Flexible Models**: Pre-trained or custom model support
74
- - **Batch Processing**: Efficient handling of multiple images
75
78
 
76
- ## 🚀 Installation
79
+ ## Installation
77
80
 
78
81
  ### From PyPI
79
82
  ```bash
80
83
  pip install ImagePRO-Python
84
+
85
+ # Or with optional extras:
86
+ pip install "ImagePRO-Python[yolo]" # YOLO object detection
87
+ pip install "ImagePRO-Python[mediapipe]" # MediaPipe human analysis
88
+ pip install "ImagePRO-Python[insightface]" # InsightFace face comparison
89
+ pip install "ImagePRO-Python[full]" # Everything
90
+ pip install "ImagePRO-Python[dev]" # Test tooling (pytest)
81
91
  ```
82
92
 
93
+ > **Note**: The base install is lightweight — AI backends (MediaPipe, Ultralytics, InsightFace) are optional and imported lazily, only when you call a function that actually needs them. `import ImagePRO` never loads these dependencies. If a backend is missing, the function you call raises an `ImportError` telling you exactly which extra to install.
94
+
83
95
  ### From Source
84
96
  ```bash
85
97
  git clone https://github.com/parsasafaie/ImagePRO.git
@@ -109,7 +121,7 @@ pip install -r requirements/full.txt
109
121
 
110
122
  See the [Directory Structure](/PROJECT_STRUCTURE.md#directory-structure) section in [PROJECT_STRUCTURE.md](/PROJECT_STRUCTURE.md) for details on which modules need which requirements.
111
123
 
112
- ## 📖 Quick Start
124
+ ## Quick Start
113
125
 
114
126
  ```python
115
127
  from ImagePRO.pre_processing.blur import apply_average_blur
@@ -126,9 +138,9 @@ image = Image.from_path("person_and_objects.jpg")
126
138
  blur_result = apply_average_blur(image=image)
127
139
  blur_result.save_as_img("blurred_output.jpg")
128
140
 
129
- # Analyze face mesh (468 landmarks)
141
+ # Analyze face mesh (468 landmarks per detected face)
130
142
  face_mesh_result = analyze_face_mesh(image=image)
131
- print(f"Detected {len(face_mesh_result.data)} face landmarks")
143
+ print(f"Detected {len(face_mesh_result.data)} face(s)")
132
144
  face_mesh_result.save_as_csv("face_landmarks.csv")
133
145
 
134
146
  # Detect body pose (33 landmarks)
@@ -138,8 +150,7 @@ print(f"Body pose data: {body_pose_result.data}")
138
150
  # Detect objects with YOLO
139
151
  object_detection_result = detect_objects(
140
152
  image=image,
141
- accuracy_level=3, # 1=nano, 2=small, 3=medium, 4=large, 5=extra-large
142
- confidence=0.5
153
+ accuracy_level=3 # 1=nano, 2=small, 3=medium, 4=large, 5=extra-large
143
154
  )
144
155
  print(f"Detected {len(object_detection_result.data)} objects")
145
156
  object_detection_result.save_as_img("detections.jpg")
@@ -147,7 +158,7 @@ object_detection_result.save_as_img("detections.jpg")
147
158
 
148
159
  > **Note**: These are basic examples. Each module contains many more functions with extensive customization options. Explore the module-specific README files for detailed documentation.
149
160
 
150
- ## 📚 Documentation
161
+ ## Documentation
151
162
 
152
163
  Each module includes comprehensive documentation with detailed examples:
153
164
 
@@ -160,24 +171,40 @@ Each module includes comprehensive documentation with detailed examples:
160
171
 
161
172
  For detailed project structure and development guidelines, see [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md).
162
173
 
163
- ## 🏗️ Architecture
174
+ ## Architecture
164
175
 
165
176
  ImagePRO is built with a modular architecture designed for extensibility and maintainability:
166
177
 
167
178
  - **Clean Separation of Concerns**: Each module handles a specific domain
168
179
  - **Consistent API Patterns**: All functions follow the same input/output conventions
169
180
  - **Shared Utilities**: Common `Image` and `Result` classes for unified I/O
181
+ - **Lazy Optional Imports**: Heavy AI dependencies (MediaPipe, Ultralytics, InsightFace) are only imported inside the functions that use them, keeping `import ImagePRO` fast and independent of installed extras
170
182
  - **Professional Error Handling**: Comprehensive validation with clear error messages
171
183
  - **Type Safety**: Full type hints throughout the codebase
172
184
  - **Documentation**: Google-style docstrings for all functions
173
185
 
174
186
  ### Key Design Principles
175
- - **Immutable Design**: Image objects are immutable, operations return new instances
187
+ - **Non-Destructive Operations**: Operations never write into the input image; they return results in new `Result` objects (note: `crop_image` returns a view into the source array)
176
188
  - **Functional Style**: Stateless functions that can be easily composed
177
189
  - **Result Objects**: Unified return type containing image, data, and metadata
178
190
  - **Keyword Arguments**: All optional parameters use keyword-only syntax
179
191
 
180
- ## 🤝 Contributing
192
+ ## Testing
193
+
194
+ The test suite uses pytest:
195
+
196
+ ```bash
197
+ # Install with test tooling (editable install + dev extra)
198
+ pip install -e ".[dev]"
199
+
200
+ # Run the suite (optional heavy dependencies are mocked; base deps are enough)
201
+ pytest
202
+
203
+ # Include performance smoke guards
204
+ pytest --run-performance
205
+ ```
206
+
207
+ ## Contributing
181
208
 
182
209
  Contributions are welcome! Please feel free to submit a Pull Request.
183
210
 
@@ -185,9 +212,10 @@ Contributions are welcome! Please feel free to submit a Pull Request.
185
212
  1. Fork the repository
186
213
  2. Create a virtual environment: `python -m venv .venv`
187
214
  3. Install dependencies: `pip install -r requirements/full.txt`
188
- 4. Follow the coding standards outlined in [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)
189
- 5. Add tests for new features
190
- 6. Update documentation as needed
215
+ 4. Install for development with test tooling: `pip install -e ".[dev]"`
216
+ 5. Follow the coding standards outlined in [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)
217
+ 6. Add tests for new features and run `pytest`
218
+ 7. Update documentation as needed
191
219
 
192
220
  ### Reporting Issues
193
221
  If you encounter any bugs or have feature requests, please open an issue on the GitHub repository with:
@@ -196,5 +224,5 @@ If you encounter any bugs or have feature requests, please open an issue on the
196
224
  - Expected vs. actual behavior
197
225
  - Environment details (OS, Python version, etc.)
198
226
 
199
- ## 📄 License
227
+ ## License
200
228
  This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details.
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "ImagePRO-Python"
10
- version = "1.2.2"
10
+ version = "1.3.1"
11
11
  description = "Professional & modular image processing library with OpenCV, MediaPipe, and YOLO integration."
12
12
  readme = "readme.md"
13
13
  requires-python = ">=3.9,<3.13"
@@ -54,20 +54,37 @@ yolo = [
54
54
  "ultralytics>=8.2,<9.0"
55
55
  ]
56
56
 
57
+ # mediapipe<=0.10.11 and insightface 0.7.x ship binaries built against
58
+ # the NumPy 1.x ABI, so groups that include them cap numpy below 2.0.
57
59
  mediapipe = [
58
- "mediapipe>=0.10.0,<=0.10.11"
60
+ "mediapipe>=0.10.0,<=0.10.11",
61
+ "numpy>=1.24,<2.0"
59
62
  ]
60
63
 
61
64
  insightface = [
62
65
  "insightface>=0.7,<0.8",
63
- "onnxruntime>=1.16,<2.0"
66
+ "onnxruntime>=1.16,<2.0",
67
+ "numpy>=1.24,<2.0"
64
68
  ]
65
69
 
66
70
  full = [
67
71
  "mediapipe>=0.10.0,<=0.10.11",
68
72
  "ultralytics>=8.2,<9.0",
69
73
  "insightface>=0.7,<0.8",
70
- "onnxruntime>=1.16,<2.0"
74
+ "onnxruntime>=1.16,<2.0",
75
+ "numpy>=1.24,<2.0"
76
+ ]
77
+
78
+ dev = [
79
+ "pytest>=8.0,<9.0"
80
+ ]
81
+
82
+ [tool.pytest.ini_options]
83
+ testpaths = ["tests"]
84
+ pythonpath = ["src"]
85
+ addopts = "-ra"
86
+ markers = [
87
+ "perf: performance smoke tests (run with --run-performance)"
71
88
  ]
72
89
 
73
90
  [project.urls]
@@ -75,6 +92,3 @@ Homepage = "https://github.com/parsasafaie/ImagePRO"
75
92
  Repository = "https://github.com/parsasafaie/ImagePRO.git"
76
93
  Documentation = "https://github.com/parsasafaie/ImagePRO#readme"
77
94
  Issues = "https://github.com/parsasafaie/ImagePRO/issues"
78
-
79
- [tool.hatch.build.targets.wheel]
80
- packages = ["ImagePRO"]
@@ -6,11 +6,10 @@
6
6
 
7
7
  Whether you're working on computer vision pipelines, preprocessing images for AI models, or simply automating batch image edits — **ImagePRO** gives you powerful tools with minimal effort.
8
8
 
9
- ## ✨ Features
9
+ ## Features
10
10
 
11
11
  ### **Image I/O & Management**
12
12
  - Flexible input/output handling (file paths or numpy arrays)
13
- - Batch processing capabilities
14
13
  - Multiple format support (JPEG, PNG, CSV, etc.)
15
14
 
16
15
  ### **Pre-processing & Enhancement**
@@ -27,15 +26,23 @@ Whether you're working on computer vision pipelines, preprocessing images for AI
27
26
  ### **Object Detection**
28
27
  - **YOLO Integration**: Multiple accuracy levels (nano to extra-large)
29
28
  - **Flexible Models**: Pre-trained or custom model support
30
- - **Batch Processing**: Efficient handling of multiple images
31
29
 
32
- ## 🚀 Installation
30
+ ## Installation
33
31
 
34
32
  ### From PyPI
35
33
  ```bash
36
34
  pip install ImagePRO-Python
35
+
36
+ # Or with optional extras:
37
+ pip install "ImagePRO-Python[yolo]" # YOLO object detection
38
+ pip install "ImagePRO-Python[mediapipe]" # MediaPipe human analysis
39
+ pip install "ImagePRO-Python[insightface]" # InsightFace face comparison
40
+ pip install "ImagePRO-Python[full]" # Everything
41
+ pip install "ImagePRO-Python[dev]" # Test tooling (pytest)
37
42
  ```
38
43
 
44
+ > **Note**: The base install is lightweight — AI backends (MediaPipe, Ultralytics, InsightFace) are optional and imported lazily, only when you call a function that actually needs them. `import ImagePRO` never loads these dependencies. If a backend is missing, the function you call raises an `ImportError` telling you exactly which extra to install.
45
+
39
46
  ### From Source
40
47
  ```bash
41
48
  git clone https://github.com/parsasafaie/ImagePRO.git
@@ -65,7 +72,7 @@ pip install -r requirements/full.txt
65
72
 
66
73
  See the [Directory Structure](/PROJECT_STRUCTURE.md#directory-structure) section in [PROJECT_STRUCTURE.md](/PROJECT_STRUCTURE.md) for details on which modules need which requirements.
67
74
 
68
- ## 📖 Quick Start
75
+ ## Quick Start
69
76
 
70
77
  ```python
71
78
  from ImagePRO.pre_processing.blur import apply_average_blur
@@ -82,9 +89,9 @@ image = Image.from_path("person_and_objects.jpg")
82
89
  blur_result = apply_average_blur(image=image)
83
90
  blur_result.save_as_img("blurred_output.jpg")
84
91
 
85
- # Analyze face mesh (468 landmarks)
92
+ # Analyze face mesh (468 landmarks per detected face)
86
93
  face_mesh_result = analyze_face_mesh(image=image)
87
- print(f"Detected {len(face_mesh_result.data)} face landmarks")
94
+ print(f"Detected {len(face_mesh_result.data)} face(s)")
88
95
  face_mesh_result.save_as_csv("face_landmarks.csv")
89
96
 
90
97
  # Detect body pose (33 landmarks)
@@ -94,8 +101,7 @@ print(f"Body pose data: {body_pose_result.data}")
94
101
  # Detect objects with YOLO
95
102
  object_detection_result = detect_objects(
96
103
  image=image,
97
- accuracy_level=3, # 1=nano, 2=small, 3=medium, 4=large, 5=extra-large
98
- confidence=0.5
104
+ accuracy_level=3 # 1=nano, 2=small, 3=medium, 4=large, 5=extra-large
99
105
  )
100
106
  print(f"Detected {len(object_detection_result.data)} objects")
101
107
  object_detection_result.save_as_img("detections.jpg")
@@ -103,7 +109,7 @@ object_detection_result.save_as_img("detections.jpg")
103
109
 
104
110
  > **Note**: These are basic examples. Each module contains many more functions with extensive customization options. Explore the module-specific README files for detailed documentation.
105
111
 
106
- ## 📚 Documentation
112
+ ## Documentation
107
113
 
108
114
  Each module includes comprehensive documentation with detailed examples:
109
115
 
@@ -116,24 +122,40 @@ Each module includes comprehensive documentation with detailed examples:
116
122
 
117
123
  For detailed project structure and development guidelines, see [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md).
118
124
 
119
- ## 🏗️ Architecture
125
+ ## Architecture
120
126
 
121
127
  ImagePRO is built with a modular architecture designed for extensibility and maintainability:
122
128
 
123
129
  - **Clean Separation of Concerns**: Each module handles a specific domain
124
130
  - **Consistent API Patterns**: All functions follow the same input/output conventions
125
131
  - **Shared Utilities**: Common `Image` and `Result` classes for unified I/O
132
+ - **Lazy Optional Imports**: Heavy AI dependencies (MediaPipe, Ultralytics, InsightFace) are only imported inside the functions that use them, keeping `import ImagePRO` fast and independent of installed extras
126
133
  - **Professional Error Handling**: Comprehensive validation with clear error messages
127
134
  - **Type Safety**: Full type hints throughout the codebase
128
135
  - **Documentation**: Google-style docstrings for all functions
129
136
 
130
137
  ### Key Design Principles
131
- - **Immutable Design**: Image objects are immutable, operations return new instances
138
+ - **Non-Destructive Operations**: Operations never write into the input image; they return results in new `Result` objects (note: `crop_image` returns a view into the source array)
132
139
  - **Functional Style**: Stateless functions that can be easily composed
133
140
  - **Result Objects**: Unified return type containing image, data, and metadata
134
141
  - **Keyword Arguments**: All optional parameters use keyword-only syntax
135
142
 
136
- ## 🤝 Contributing
143
+ ## Testing
144
+
145
+ The test suite uses pytest:
146
+
147
+ ```bash
148
+ # Install with test tooling (editable install + dev extra)
149
+ pip install -e ".[dev]"
150
+
151
+ # Run the suite (optional heavy dependencies are mocked; base deps are enough)
152
+ pytest
153
+
154
+ # Include performance smoke guards
155
+ pytest --run-performance
156
+ ```
157
+
158
+ ## Contributing
137
159
 
138
160
  Contributions are welcome! Please feel free to submit a Pull Request.
139
161
 
@@ -141,9 +163,10 @@ Contributions are welcome! Please feel free to submit a Pull Request.
141
163
  1. Fork the repository
142
164
  2. Create a virtual environment: `python -m venv .venv`
143
165
  3. Install dependencies: `pip install -r requirements/full.txt`
144
- 4. Follow the coding standards outlined in [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)
145
- 5. Add tests for new features
146
- 6. Update documentation as needed
166
+ 4. Install for development with test tooling: `pip install -e ".[dev]"`
167
+ 5. Follow the coding standards outlined in [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)
168
+ 6. Add tests for new features and run `pytest`
169
+ 7. Update documentation as needed
147
170
 
148
171
  ### Reporting Issues
149
172
  If you encounter any bugs or have feature requests, please open an issue on the GitHub repository with:
@@ -152,5 +175,5 @@ If you encounter any bugs or have feature requests, please open an issue on the
152
175
  - Expected vs. actual behavior
153
176
  - Environment details (OS, Python version, etc.)
154
177
 
155
- ## 📄 License
178
+ ## License
156
179
  This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details.
@@ -15,7 +15,7 @@ Features:
15
15
  - Real-time processing capabilities
16
16
  """
17
17
 
18
- __version__ = "1.0.0"
18
+ __version__ = "1.3.1"
19
19
  __author__ = "Parsa Safaie"
20
20
  __email__ = "parsasafaie.2568@proton.me"
21
21
 
@@ -27,7 +27,7 @@ from . import object_analysis
27
27
 
28
28
  __all__ = [
29
29
  "utils",
30
- "pre_processing",
30
+ "pre_processing",
31
31
  "human_analysis",
32
32
  "object_analysis"
33
33
  ]
@@ -1,5 +1,9 @@
1
1
  # Body Analysis Module
2
2
  # Provides body pose estimation and hand tracking capabilities
3
+ #
4
+ # The mediapipe dependency is optional and imported lazily inside the
5
+ # functions that need it, so both submodules are safe to import without
6
+ # any AI extras installed.
3
7
 
4
8
  from . import body_pose_estimation
5
9
  from . import hand_tracking
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import sys
4
4
  from pathlib import Path
5
+ from typing import TYPE_CHECKING
5
6
 
6
7
  # Add src directory to path for absolute imports
7
8
  _file_path = Path(__file__).resolve()
@@ -13,10 +14,11 @@ from ImagePRO.utils.image import Image
13
14
  from ImagePRO.utils.result import Result
14
15
 
15
16
  import cv2
16
- import mediapipe as mp
17
+
18
+ if TYPE_CHECKING: # mediapipe is imported lazily inside the functions
19
+ import mediapipe as mp
17
20
 
18
21
  # Constants
19
- mp_pose = mp.solutions.pose
20
22
  TOTAL_LANDMARKS = 33
21
23
  DEFAULT_CONFIDENCE = 0.7
22
24
  LANDMARK_RADIUS = 3
@@ -64,11 +66,21 @@ def detect_body_pose(
64
66
  raise ValueError("'min_confidence' must be between 0.0 and 1.0")
65
67
 
66
68
  if landmarks_idx is not None and (
67
- not isinstance(landmarks_idx, list)
69
+ not isinstance(landmarks_idx, list)
68
70
  or not all(isinstance(i, int) for i in landmarks_idx)
69
71
  ):
70
72
  raise TypeError("'landmarks_idx' must be a list of integers")
71
73
 
74
+ try:
75
+ import mediapipe as mp
76
+ except ImportError as err:
77
+ raise ImportError(
78
+ "The optional 'mediapipe' dependency is required for body pose "
79
+ 'detection. Install it with: pip install "ImagePRO-Python[mediapipe]"'
80
+ ) from err
81
+
82
+ mp_pose = mp.solutions.pose
83
+
72
84
  # Initialize detector if needed
73
85
  if pose_obj is None:
74
86
  pose_obj = mp_pose.Pose(
@@ -97,7 +109,8 @@ def detect_body_pose(
97
109
  img_copy,
98
110
  result.pose_landmarks,
99
111
  mp_pose.POSE_CONNECTIONS,
100
- landmark_drawing_spec=mp.solutions.drawing_styles.get_default_pose_landmarks_style()
112
+ landmark_drawing_spec=mp.solutions.drawing_styles
113
+ .get_default_pose_landmarks_style()
101
114
  )
102
115
  else:
103
116
  # Draw only selected points
@@ -132,13 +145,21 @@ def detect_body_pose_live() -> None:
132
145
  Raises:
133
146
  RuntimeError: If camera cannot be accessed
134
147
  """
148
+ try:
149
+ import mediapipe as mp
150
+ except ImportError as err:
151
+ raise ImportError(
152
+ "The optional 'mediapipe' dependency is required for body pose "
153
+ 'detection. Install it with: pip install "ImagePRO-Python[mediapipe]"'
154
+ ) from err
155
+
135
156
  # Initialize camera
136
157
  cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
137
158
  if not cap.isOpened():
138
159
  raise RuntimeError("Cannot access webcam")
139
160
 
140
161
  # Initialize pose detector in tracking mode
141
- pose_obj = mp_pose.Pose(
162
+ pose_obj = mp.solutions.pose.Pose(
142
163
  min_detection_confidence=DEFAULT_CONFIDENCE,
143
164
  static_image_mode=False
144
165
  )
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import sys
4
4
  from pathlib import Path
5
+ from typing import TYPE_CHECKING
5
6
 
6
7
  # Add src directory to path for absolute imports
7
8
  _file_path = Path(__file__).resolve()
@@ -13,10 +14,11 @@ from ImagePRO.utils.image import Image
13
14
  from ImagePRO.utils.result import Result
14
15
 
15
16
  import cv2
16
- import mediapipe as mp
17
+
18
+ if TYPE_CHECKING: # mediapipe is imported lazily inside the functions
19
+ import mediapipe as mp
17
20
 
18
21
  # Constants
19
- mp_hands = mp.solutions.hands
20
22
  DEFAULT_MAX_HANDS = 2
21
23
  DEFAULT_MIN_CONFIDENCE = 0.7
22
24
  TOTAL_HAND_LANDMARKS = 21
@@ -74,11 +76,21 @@ def detect_hands(
74
76
  raise ValueError("'min_confidence' must be between 0.0 and 1.0")
75
77
 
76
78
  if landmarks_idx is not None and (
77
- not isinstance(landmarks_idx, list)
79
+ not isinstance(landmarks_idx, list)
78
80
  or not all(isinstance(i, int) for i in landmarks_idx)
79
81
  ):
80
82
  raise TypeError("'landmarks_idx' must be a list of integers")
81
83
 
84
+ try:
85
+ import mediapipe as mp
86
+ except ImportError as err:
87
+ raise ImportError(
88
+ "The optional 'mediapipe' dependency is required for hand "
89
+ 'tracking. Install it with: pip install "ImagePRO-Python[mediapipe]"'
90
+ ) from err
91
+
92
+ mp_hands = mp.solutions.hands
93
+
82
94
  # Initialize detector if needed
83
95
  if hands_obj is None:
84
96
  hands_obj = mp_hands.Hands(
@@ -109,8 +121,10 @@ def detect_hands(
109
121
  image=img_copy,
110
122
  landmark_list=hand_landmarks,
111
123
  connections=mp_hands.HAND_CONNECTIONS,
112
- landmark_drawing_spec=mp.solutions.drawing_styles.get_default_hand_landmarks_style(),
113
- connection_drawing_spec=mp.solutions.drawing_styles.get_default_hand_connections_style()
124
+ landmark_drawing_spec=mp.solutions.drawing_styles
125
+ .get_default_hand_landmarks_style(),
126
+ connection_drawing_spec=mp.solutions.drawing_styles
127
+ .get_default_hand_connections_style()
114
128
  )
115
129
  else:
116
130
  # Draw only selected points
@@ -166,13 +180,21 @@ def detect_hands_live(
166
180
  if not isinstance(min_confidence, (int, float)) or not (0.0 <= min_confidence <= 1.0):
167
181
  raise ValueError("'min_confidence' must be between 0.0 and 1.0")
168
182
 
183
+ try:
184
+ import mediapipe as mp
185
+ except ImportError as err:
186
+ raise ImportError(
187
+ "The optional 'mediapipe' dependency is required for hand "
188
+ 'tracking. Install it with: pip install "ImagePRO-Python[mediapipe]"'
189
+ ) from err
190
+
169
191
  # Initialize camera
170
192
  cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
171
193
  if not cap.isOpened():
172
194
  raise RuntimeError("Cannot access webcam")
173
195
 
174
196
  # Initialize hand detector in tracking mode
175
- hands_obj = mp_hands.Hands(
197
+ hands_obj = mp.solutions.hands.Hands(
176
198
  min_detection_confidence=min_confidence,
177
199
  max_num_hands=max_hands,
178
200
  static_image_mode=False
@@ -1,5 +1,9 @@
1
1
  # Face Analysis Module
2
2
  # Provides facial landmark detection, pose estimation, and eye status analysis
3
+ #
4
+ # The mediapipe and insightface dependencies are optional and imported
5
+ # lazily inside the functions that need them, so every submodule is safe
6
+ # to import regardless of which extras are installed.
3
7
 
4
8
  from . import eye_status_analysis
5
9
  from . import face_comparison
@@ -10,7 +14,7 @@ from . import head_pose_estimation
10
14
  __all__ = [
11
15
  "eye_status_analysis",
12
16
  "face_comparison",
13
- "face_detection",
17
+ "face_detection",
14
18
  "face_mesh_analysis",
15
19
  "head_pose_estimation"
16
20
  ]
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import sys
4
4
  from pathlib import Path
5
+ from typing import TYPE_CHECKING
5
6
 
6
7
  # Add src directory to path for absolute imports
7
8
  _file_path = Path(__file__).resolve()
@@ -14,10 +15,11 @@ from ImagePRO.utils.image import Image
14
15
  from ImagePRO.utils.result import Result
15
16
 
16
17
  import cv2
17
- import mediapipe as mp
18
+
19
+ if TYPE_CHECKING: # mediapipe is imported lazily inside the functions
20
+ import mediapipe as mp
18
21
 
19
22
  # Constants
20
- mp_face_mesh = mp.solutions.face_mesh
21
23
  DEFAULT_MIN_CONFIDENCE = 0.7
22
24
  DEFAULT_THRESHOLD = 0.2
23
25
  RIGHT_EYE_INDICES = [386, 374, 263, 362] # MediaPipe right eye landmarks
@@ -65,12 +67,20 @@ def analyze_eye_status(
65
67
  if not 0 <= min_confidence <= 1:
66
68
  raise ValueError("'min_confidence' must be between 0 and 1")
67
69
 
70
+ try:
71
+ import mediapipe as mp
72
+ except ImportError as err:
73
+ raise ImportError(
74
+ "The optional 'mediapipe' dependency is required for eye status "
75
+ 'analysis. Install it with: pip install "ImagePRO-Python[mediapipe]"'
76
+ ) from err
77
+
68
78
  # Get image dimensions
69
79
  h, w = image.shape[:2]
70
80
 
71
81
  # Initialize detector if needed
72
82
  if face_mesh_obj is None:
73
- face_mesh_obj = mp_face_mesh.FaceMesh(
83
+ face_mesh_obj = mp.solutions.face_mesh.FaceMesh(
74
84
  min_detection_confidence=min_confidence,
75
85
  refine_landmarks=True,
76
86
  static_image_mode=True
@@ -173,13 +183,21 @@ def analyze_eye_status_live(
173
183
  if not 0 <= min_confidence <= 1:
174
184
  raise ValueError("'min_confidence' must be between 0 and 1")
175
185
 
186
+ try:
187
+ import mediapipe as mp
188
+ except ImportError as err:
189
+ raise ImportError(
190
+ "The optional 'mediapipe' dependency is required for eye status "
191
+ 'analysis. Install it with: pip install "ImagePRO-Python[mediapipe]"'
192
+ ) from err
193
+
176
194
  # Initialize webcam
177
195
  cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
178
196
  if not cap.isOpened():
179
197
  raise RuntimeError("Failed to access webcam")
180
198
 
181
199
  # Initialize face mesh detector for video
182
- face_mesh = mp_face_mesh.FaceMesh(
200
+ face_mesh = mp.solutions.face_mesh.FaceMesh(
183
201
  max_num_faces=1,
184
202
  min_detection_confidence=min_confidence,
185
203
  refine_landmarks=True,