ImagePRO-Python 1.1.0__tar.gz → 1.2.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-1.2.1/PKG-INFO +200 -0
- imagepro_python-1.2.1/pyproject.toml +80 -0
- imagepro_python-1.2.1/readme.md +156 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/body_analysis/body_pose_estimation.py +11 -2
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/body_analysis/hand_tracking.py +11 -2
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/face_analysis/eye_status_analysis.py +11 -2
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/face_analysis/face_comparison.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/face_analysis/face_detection.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/face_analysis/face_mesh_analysis.py +11 -2
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/face_analysis/head_pose_estimation.py +11 -2
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/object_analysis/object_detection.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/blur.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/contrast.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/crop.py +8 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/dataset_generator.py +37 -16
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/grayscale.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/histogram.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/resize.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/rotate.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/sharpen.py +9 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/utils/result.py +16 -1
- imagepro_python-1.2.1/src/ImagePRO_Python.egg-info/PKG-INFO +200 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO_Python.egg-info/SOURCES.txt +1 -0
- imagepro_python-1.2.1/src/ImagePRO_Python.egg-info/requires.txt +19 -0
- imagepro_python-1.1.0/PKG-INFO +0 -35
- imagepro_python-1.1.0/pyproject.toml +0 -56
- imagepro_python-1.1.0/src/ImagePRO_Python.egg-info/PKG-INFO +0 -35
- imagepro_python-1.1.0/src/ImagePRO_Python.egg-info/requires.txt +0 -13
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/LICENSE +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/setup.cfg +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/body_analysis/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/human_analysis/face_analysis/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/object_analysis/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/pre_processing/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/utils/__init__.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/utils/image.py +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO_Python.egg-info/dependency_links.txt +0 -0
- {imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO_Python.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ImagePRO-Python
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: Professional & modular image processing library with OpenCV, MediaPipe, and YOLO integration.
|
|
5
|
+
Author-email: Parsa Safaie <parsasafaie.2568@proton.me>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/parsasafaie/ImagePRO
|
|
8
|
+
Project-URL: Repository, https://github.com/parsasafaie/ImagePRO.git
|
|
9
|
+
Project-URL: Documentation, https://github.com/parsasafaie/ImagePRO#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/parsasafaie/ImagePRO/issues
|
|
11
|
+
Keywords: opencv,mediapipe,computer-vision,face,pose,yolo,image-processing
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Requires-Python: <3.13,>=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: numpy<2.1.0,>=1.24
|
|
29
|
+
Requires-Dist: opencv-python<5.0,>=4.8
|
|
30
|
+
Requires-Dist: matplotlib<4.0,>=3.7
|
|
31
|
+
Provides-Extra: yolo
|
|
32
|
+
Requires-Dist: ultralytics<9.0,>=8.2; extra == "yolo"
|
|
33
|
+
Provides-Extra: mediapipe
|
|
34
|
+
Requires-Dist: mediapipe<=0.10.11,>=0.10.0; extra == "mediapipe"
|
|
35
|
+
Provides-Extra: insightface
|
|
36
|
+
Requires-Dist: insightface<0.8,>=0.7; extra == "insightface"
|
|
37
|
+
Requires-Dist: onnxruntime<2.0,>=1.16; extra == "insightface"
|
|
38
|
+
Provides-Extra: full
|
|
39
|
+
Requires-Dist: mediapipe<=0.10.11,>=0.10.0; extra == "full"
|
|
40
|
+
Requires-Dist: ultralytics<9.0,>=8.2; extra == "full"
|
|
41
|
+
Requires-Dist: insightface<0.8,>=0.7; extra == "full"
|
|
42
|
+
Requires-Dist: onnxruntime<2.0,>=1.16; extra == "full"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# ImagePRO
|
|
46
|
+
|
|
47
|
+
> **Professional & Modular Image Processing Library in Python**
|
|
48
|
+
|
|
49
|
+
**ImagePRO** is a clean, modular, and easy-to-use Python library for image processing tasks, built with OpenCV, MediaPipe, YOLO, and InsightFace. Designed to be extensible for developers, ImagePRO provides a consistent API across all modules with comprehensive error handling and professional-grade documentation.
|
|
50
|
+
|
|
51
|
+
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
|
+
|
|
53
|
+
## ✨ Features
|
|
54
|
+
|
|
55
|
+
### **Image I/O & Management**
|
|
56
|
+
- Flexible input/output handling (file paths or numpy arrays)
|
|
57
|
+
- Batch processing capabilities
|
|
58
|
+
- Multiple format support (JPEG, PNG, CSV, etc.)
|
|
59
|
+
|
|
60
|
+
### **Pre-processing & Enhancement**
|
|
61
|
+
- **Basic Operations**: Resize, crop, rotate (90°, 180°, 270°, custom angles), grayscale conversion
|
|
62
|
+
- **Filtering**: Blur filters (average, Gaussian, median, bilateral), sharpening filters (Laplacian, Unsharp Masking)
|
|
63
|
+
- **Enhancement**: Contrast enhancement (CLAHE, GHE, stretching)
|
|
64
|
+
- **Dataset Generation**: Automated image capture with preprocessing pipeline
|
|
65
|
+
|
|
66
|
+
### **Human Analysis**
|
|
67
|
+
- **Face Analysis**: 468-point mesh, head pose estimation, eye status detection, face comparison, face cropping
|
|
68
|
+
- **Body Analysis**: Pose estimation, hand tracking (21 landmarks)
|
|
69
|
+
- **Real-time Processing**: Live webcam analysis for all modules
|
|
70
|
+
|
|
71
|
+
### **Object Detection**
|
|
72
|
+
- **YOLO Integration**: Multiple accuracy levels (nano to extra-large)
|
|
73
|
+
- **Flexible Models**: Pre-trained or custom model support
|
|
74
|
+
- **Batch Processing**: Efficient handling of multiple images
|
|
75
|
+
|
|
76
|
+
## 🚀 Installation
|
|
77
|
+
|
|
78
|
+
### From PyPI
|
|
79
|
+
```bash
|
|
80
|
+
pip install ImagePRO-Python
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### From Source
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/parsasafaie/ImagePRO.git
|
|
86
|
+
cd ImagePRO
|
|
87
|
+
|
|
88
|
+
python -m venv .venv
|
|
89
|
+
|
|
90
|
+
source .venv/bin/activate # macOS/Linux
|
|
91
|
+
.venv\Scripts\activate # Windows
|
|
92
|
+
|
|
93
|
+
# Base dependencies
|
|
94
|
+
pip install -r requirements/base.txt
|
|
95
|
+
|
|
96
|
+
# Optional dependencies
|
|
97
|
+
# For YOLO object detection
|
|
98
|
+
pip install -r requirements/yolo.txt
|
|
99
|
+
|
|
100
|
+
# For MediaPipe human analysis
|
|
101
|
+
pip install -r requirements/mediapipe.txt
|
|
102
|
+
|
|
103
|
+
# For InsightFace advanced face analysis
|
|
104
|
+
pip install -r requirements/insightface.txt
|
|
105
|
+
|
|
106
|
+
# Or install everything
|
|
107
|
+
pip install -r requirements/full.txt
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
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
|
+
|
|
112
|
+
## 📖 Quick Start
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from ImagePRO.pre_processing.blur import apply_average_blur
|
|
116
|
+
from ImagePRO.human_analysis.face_analysis.face_mesh_analysis import analyze_face_mesh
|
|
117
|
+
from ImagePRO.human_analysis.body_analysis.body_pose_estimation import detect_body_pose
|
|
118
|
+
from ImagePRO.object_analysis.object_detection import detect_objects
|
|
119
|
+
from ImagePRO.utils.image import Image
|
|
120
|
+
|
|
121
|
+
# Load an image
|
|
122
|
+
image = Image.from_path("person_and_objects.jpg")
|
|
123
|
+
# Or from numpy array: image = Image.from_array(np_array)
|
|
124
|
+
|
|
125
|
+
# Apply average blur
|
|
126
|
+
blur_result = apply_average_blur(image=image)
|
|
127
|
+
blur_result.save_as_img("blurred_output.jpg")
|
|
128
|
+
|
|
129
|
+
# Analyze face mesh (468 landmarks)
|
|
130
|
+
face_mesh_result = analyze_face_mesh(image=image)
|
|
131
|
+
print(f"Detected {len(face_mesh_result.data)} face landmarks")
|
|
132
|
+
face_mesh_result.save_as_csv("face_landmarks.csv")
|
|
133
|
+
|
|
134
|
+
# Detect body pose (33 landmarks)
|
|
135
|
+
body_pose_result = detect_body_pose(image=image)
|
|
136
|
+
print(f"Body pose data: {body_pose_result.data}")
|
|
137
|
+
|
|
138
|
+
# Detect objects with YOLO
|
|
139
|
+
object_detection_result = detect_objects(
|
|
140
|
+
image=image,
|
|
141
|
+
accuracy_level=3, # 1=nano, 2=small, 3=medium, 4=large, 5=extra-large
|
|
142
|
+
confidence=0.5
|
|
143
|
+
)
|
|
144
|
+
print(f"Detected {len(object_detection_result.data)} objects")
|
|
145
|
+
object_detection_result.save_as_img("detections.jpg")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> **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
|
+
|
|
150
|
+
## 📚 Documentation
|
|
151
|
+
|
|
152
|
+
Each module includes comprehensive documentation with detailed examples:
|
|
153
|
+
|
|
154
|
+
- **[Pre-processing](src/ImagePRO/pre_processing/README.md)**: Image manipulation, filtering, and enhancement
|
|
155
|
+
- **[Human Analysis](src/ImagePRO/human_analysis/README.md)**: Face and body analysis tools
|
|
156
|
+
- [Face Analysis](src/ImagePRO/human_analysis/face_analysis/README.md): Face mesh, pose estimation, eye status, comparison
|
|
157
|
+
- [Body Analysis](src/ImagePRO/human_analysis/body_analysis/README.md): Body pose and hand tracking
|
|
158
|
+
- **[Object Analysis](src/ImagePRO/object_analysis/README.md)**: YOLO-based object detection
|
|
159
|
+
- **[Utils](src/ImagePRO/utils/README.md)**: Shared utilities and I/O handling
|
|
160
|
+
|
|
161
|
+
For detailed project structure and development guidelines, see [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md).
|
|
162
|
+
|
|
163
|
+
## 🏗️ Architecture
|
|
164
|
+
|
|
165
|
+
ImagePRO is built with a modular architecture designed for extensibility and maintainability:
|
|
166
|
+
|
|
167
|
+
- **Clean Separation of Concerns**: Each module handles a specific domain
|
|
168
|
+
- **Consistent API Patterns**: All functions follow the same input/output conventions
|
|
169
|
+
- **Shared Utilities**: Common `Image` and `Result` classes for unified I/O
|
|
170
|
+
- **Professional Error Handling**: Comprehensive validation with clear error messages
|
|
171
|
+
- **Type Safety**: Full type hints throughout the codebase
|
|
172
|
+
- **Documentation**: Google-style docstrings for all functions
|
|
173
|
+
|
|
174
|
+
### Key Design Principles
|
|
175
|
+
- **Immutable Design**: Image objects are immutable, operations return new instances
|
|
176
|
+
- **Functional Style**: Stateless functions that can be easily composed
|
|
177
|
+
- **Result Objects**: Unified return type containing image, data, and metadata
|
|
178
|
+
- **Keyword Arguments**: All optional parameters use keyword-only syntax
|
|
179
|
+
|
|
180
|
+
## 🤝 Contributing
|
|
181
|
+
|
|
182
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
183
|
+
|
|
184
|
+
### Development Setup
|
|
185
|
+
1. Fork the repository
|
|
186
|
+
2. Create a virtual environment: `python -m venv .venv`
|
|
187
|
+
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
|
|
191
|
+
|
|
192
|
+
### Reporting Issues
|
|
193
|
+
If you encounter any bugs or have feature requests, please open an issue on the GitHub repository with:
|
|
194
|
+
- Description of the problem or feature request
|
|
195
|
+
- Steps to reproduce (for bugs)
|
|
196
|
+
- Expected vs. actual behavior
|
|
197
|
+
- Environment details (OS, Python version, etc.)
|
|
198
|
+
|
|
199
|
+
## 📄 License
|
|
200
|
+
This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[tool.setuptools.packages.find]
|
|
6
|
+
where = ["src"]
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "ImagePRO-Python"
|
|
10
|
+
version = "1.2.1"
|
|
11
|
+
description = "Professional & modular image processing library with OpenCV, MediaPipe, and YOLO integration."
|
|
12
|
+
readme = "readme.md"
|
|
13
|
+
requires-python = ">=3.9,<3.13"
|
|
14
|
+
license = { text = "MIT" }
|
|
15
|
+
|
|
16
|
+
authors = [
|
|
17
|
+
{ name = "Parsa Safaie", email = "parsasafaie.2568@proton.me" }
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
keywords = [
|
|
21
|
+
"opencv",
|
|
22
|
+
"mediapipe",
|
|
23
|
+
"computer-vision",
|
|
24
|
+
"face",
|
|
25
|
+
"pose",
|
|
26
|
+
"yolo",
|
|
27
|
+
"image-processing"
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 4 - Beta",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"Intended Audience :: Science/Research",
|
|
34
|
+
"Programming Language :: Python :: 3",
|
|
35
|
+
"Programming Language :: Python :: 3.9",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"License :: OSI Approved :: MIT License",
|
|
40
|
+
"Operating System :: OS Independent",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
42
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
43
|
+
"Topic :: Software Development :: Libraries :: Python Modules"
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
dependencies = [
|
|
47
|
+
"numpy>=1.24,<2.1.0",
|
|
48
|
+
"opencv-python>=4.8,<5.0",
|
|
49
|
+
"matplotlib>=3.7,<4.0"
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.optional-dependencies]
|
|
53
|
+
yolo = [
|
|
54
|
+
"ultralytics>=8.2,<9.0"
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
mediapipe = [
|
|
58
|
+
"mediapipe>=0.10.0,<=0.10.11"
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
insightface = [
|
|
62
|
+
"insightface>=0.7,<0.8",
|
|
63
|
+
"onnxruntime>=1.16,<2.0"
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
full = [
|
|
67
|
+
"mediapipe>=0.10.0,<=0.10.11",
|
|
68
|
+
"ultralytics>=8.2,<9.0",
|
|
69
|
+
"insightface>=0.7,<0.8",
|
|
70
|
+
"onnxruntime>=1.16,<2.0"
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[project.urls]
|
|
74
|
+
Homepage = "https://github.com/parsasafaie/ImagePRO"
|
|
75
|
+
Repository = "https://github.com/parsasafaie/ImagePRO.git"
|
|
76
|
+
Documentation = "https://github.com/parsasafaie/ImagePRO#readme"
|
|
77
|
+
Issues = "https://github.com/parsasafaie/ImagePRO/issues"
|
|
78
|
+
|
|
79
|
+
[tool.hatch.build.targets.wheel]
|
|
80
|
+
packages = ["ImagePRO"]
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# ImagePRO
|
|
2
|
+
|
|
3
|
+
> **Professional & Modular Image Processing Library in Python**
|
|
4
|
+
|
|
5
|
+
**ImagePRO** is a clean, modular, and easy-to-use Python library for image processing tasks, built with OpenCV, MediaPipe, YOLO, and InsightFace. Designed to be extensible for developers, ImagePRO provides a consistent API across all modules with comprehensive error handling and professional-grade documentation.
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
### **Image I/O & Management**
|
|
12
|
+
- Flexible input/output handling (file paths or numpy arrays)
|
|
13
|
+
- Batch processing capabilities
|
|
14
|
+
- Multiple format support (JPEG, PNG, CSV, etc.)
|
|
15
|
+
|
|
16
|
+
### **Pre-processing & Enhancement**
|
|
17
|
+
- **Basic Operations**: Resize, crop, rotate (90°, 180°, 270°, custom angles), grayscale conversion
|
|
18
|
+
- **Filtering**: Blur filters (average, Gaussian, median, bilateral), sharpening filters (Laplacian, Unsharp Masking)
|
|
19
|
+
- **Enhancement**: Contrast enhancement (CLAHE, GHE, stretching)
|
|
20
|
+
- **Dataset Generation**: Automated image capture with preprocessing pipeline
|
|
21
|
+
|
|
22
|
+
### **Human Analysis**
|
|
23
|
+
- **Face Analysis**: 468-point mesh, head pose estimation, eye status detection, face comparison, face cropping
|
|
24
|
+
- **Body Analysis**: Pose estimation, hand tracking (21 landmarks)
|
|
25
|
+
- **Real-time Processing**: Live webcam analysis for all modules
|
|
26
|
+
|
|
27
|
+
### **Object Detection**
|
|
28
|
+
- **YOLO Integration**: Multiple accuracy levels (nano to extra-large)
|
|
29
|
+
- **Flexible Models**: Pre-trained or custom model support
|
|
30
|
+
- **Batch Processing**: Efficient handling of multiple images
|
|
31
|
+
|
|
32
|
+
## 🚀 Installation
|
|
33
|
+
|
|
34
|
+
### From PyPI
|
|
35
|
+
```bash
|
|
36
|
+
pip install ImagePRO-Python
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### From Source
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/parsasafaie/ImagePRO.git
|
|
42
|
+
cd ImagePRO
|
|
43
|
+
|
|
44
|
+
python -m venv .venv
|
|
45
|
+
|
|
46
|
+
source .venv/bin/activate # macOS/Linux
|
|
47
|
+
.venv\Scripts\activate # Windows
|
|
48
|
+
|
|
49
|
+
# Base dependencies
|
|
50
|
+
pip install -r requirements/base.txt
|
|
51
|
+
|
|
52
|
+
# Optional dependencies
|
|
53
|
+
# For YOLO object detection
|
|
54
|
+
pip install -r requirements/yolo.txt
|
|
55
|
+
|
|
56
|
+
# For MediaPipe human analysis
|
|
57
|
+
pip install -r requirements/mediapipe.txt
|
|
58
|
+
|
|
59
|
+
# For InsightFace advanced face analysis
|
|
60
|
+
pip install -r requirements/insightface.txt
|
|
61
|
+
|
|
62
|
+
# Or install everything
|
|
63
|
+
pip install -r requirements/full.txt
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
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
|
+
|
|
68
|
+
## 📖 Quick Start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from ImagePRO.pre_processing.blur import apply_average_blur
|
|
72
|
+
from ImagePRO.human_analysis.face_analysis.face_mesh_analysis import analyze_face_mesh
|
|
73
|
+
from ImagePRO.human_analysis.body_analysis.body_pose_estimation import detect_body_pose
|
|
74
|
+
from ImagePRO.object_analysis.object_detection import detect_objects
|
|
75
|
+
from ImagePRO.utils.image import Image
|
|
76
|
+
|
|
77
|
+
# Load an image
|
|
78
|
+
image = Image.from_path("person_and_objects.jpg")
|
|
79
|
+
# Or from numpy array: image = Image.from_array(np_array)
|
|
80
|
+
|
|
81
|
+
# Apply average blur
|
|
82
|
+
blur_result = apply_average_blur(image=image)
|
|
83
|
+
blur_result.save_as_img("blurred_output.jpg")
|
|
84
|
+
|
|
85
|
+
# Analyze face mesh (468 landmarks)
|
|
86
|
+
face_mesh_result = analyze_face_mesh(image=image)
|
|
87
|
+
print(f"Detected {len(face_mesh_result.data)} face landmarks")
|
|
88
|
+
face_mesh_result.save_as_csv("face_landmarks.csv")
|
|
89
|
+
|
|
90
|
+
# Detect body pose (33 landmarks)
|
|
91
|
+
body_pose_result = detect_body_pose(image=image)
|
|
92
|
+
print(f"Body pose data: {body_pose_result.data}")
|
|
93
|
+
|
|
94
|
+
# Detect objects with YOLO
|
|
95
|
+
object_detection_result = detect_objects(
|
|
96
|
+
image=image,
|
|
97
|
+
accuracy_level=3, # 1=nano, 2=small, 3=medium, 4=large, 5=extra-large
|
|
98
|
+
confidence=0.5
|
|
99
|
+
)
|
|
100
|
+
print(f"Detected {len(object_detection_result.data)} objects")
|
|
101
|
+
object_detection_result.save_as_img("detections.jpg")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> **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
|
+
|
|
106
|
+
## 📚 Documentation
|
|
107
|
+
|
|
108
|
+
Each module includes comprehensive documentation with detailed examples:
|
|
109
|
+
|
|
110
|
+
- **[Pre-processing](src/ImagePRO/pre_processing/README.md)**: Image manipulation, filtering, and enhancement
|
|
111
|
+
- **[Human Analysis](src/ImagePRO/human_analysis/README.md)**: Face and body analysis tools
|
|
112
|
+
- [Face Analysis](src/ImagePRO/human_analysis/face_analysis/README.md): Face mesh, pose estimation, eye status, comparison
|
|
113
|
+
- [Body Analysis](src/ImagePRO/human_analysis/body_analysis/README.md): Body pose and hand tracking
|
|
114
|
+
- **[Object Analysis](src/ImagePRO/object_analysis/README.md)**: YOLO-based object detection
|
|
115
|
+
- **[Utils](src/ImagePRO/utils/README.md)**: Shared utilities and I/O handling
|
|
116
|
+
|
|
117
|
+
For detailed project structure and development guidelines, see [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md).
|
|
118
|
+
|
|
119
|
+
## 🏗️ Architecture
|
|
120
|
+
|
|
121
|
+
ImagePRO is built with a modular architecture designed for extensibility and maintainability:
|
|
122
|
+
|
|
123
|
+
- **Clean Separation of Concerns**: Each module handles a specific domain
|
|
124
|
+
- **Consistent API Patterns**: All functions follow the same input/output conventions
|
|
125
|
+
- **Shared Utilities**: Common `Image` and `Result` classes for unified I/O
|
|
126
|
+
- **Professional Error Handling**: Comprehensive validation with clear error messages
|
|
127
|
+
- **Type Safety**: Full type hints throughout the codebase
|
|
128
|
+
- **Documentation**: Google-style docstrings for all functions
|
|
129
|
+
|
|
130
|
+
### Key Design Principles
|
|
131
|
+
- **Immutable Design**: Image objects are immutable, operations return new instances
|
|
132
|
+
- **Functional Style**: Stateless functions that can be easily composed
|
|
133
|
+
- **Result Objects**: Unified return type containing image, data, and metadata
|
|
134
|
+
- **Keyword Arguments**: All optional parameters use keyword-only syntax
|
|
135
|
+
|
|
136
|
+
## 🤝 Contributing
|
|
137
|
+
|
|
138
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
139
|
+
|
|
140
|
+
### Development Setup
|
|
141
|
+
1. Fork the repository
|
|
142
|
+
2. Create a virtual environment: `python -m venv .venv`
|
|
143
|
+
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
|
|
147
|
+
|
|
148
|
+
### Reporting Issues
|
|
149
|
+
If you encounter any bugs or have feature requests, please open an issue on the GitHub repository with:
|
|
150
|
+
- Description of the problem or feature request
|
|
151
|
+
- Steps to reproduce (for bugs)
|
|
152
|
+
- Expected vs. actual behavior
|
|
153
|
+
- Environment details (OS, Python version, etc.)
|
|
154
|
+
|
|
155
|
+
## 📄 License
|
|
156
|
+
This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details.
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
5
11
|
|
|
6
12
|
from ImagePRO.utils.image import Image
|
|
7
13
|
from ImagePRO.utils.result import Result
|
|
8
14
|
|
|
15
|
+
import cv2
|
|
16
|
+
import mediapipe as mp
|
|
17
|
+
|
|
9
18
|
# Constants
|
|
10
19
|
mp_pose = mp.solutions.pose
|
|
11
20
|
TOTAL_LANDMARKS = 33
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
5
11
|
|
|
6
12
|
from ImagePRO.utils.image import Image
|
|
7
13
|
from ImagePRO.utils.result import Result
|
|
8
14
|
|
|
15
|
+
import cv2
|
|
16
|
+
import mediapipe as mp
|
|
17
|
+
|
|
9
18
|
# Constants
|
|
10
19
|
mp_hands = mp.solutions.hands
|
|
11
20
|
DEFAULT_MAX_HANDS = 2
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
5
11
|
|
|
6
12
|
from ImagePRO.human_analysis.face_analysis.face_mesh_analysis import analyze_face_mesh
|
|
7
13
|
from ImagePRO.utils.image import Image
|
|
8
14
|
from ImagePRO.utils.result import Result
|
|
9
15
|
|
|
16
|
+
import cv2
|
|
17
|
+
import mediapipe as mp
|
|
18
|
+
|
|
10
19
|
# Constants
|
|
11
20
|
mp_face_mesh = mp.solutions.face_mesh
|
|
12
21
|
DEFAULT_MIN_CONFIDENCE = 0.7
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
11
|
+
|
|
3
12
|
import os
|
|
4
13
|
|
|
5
14
|
import cv2
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
11
|
+
|
|
3
12
|
import cv2
|
|
4
13
|
import mediapipe as mp
|
|
5
14
|
import numpy as np
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
5
11
|
|
|
6
12
|
from ImagePRO.utils.image import Image
|
|
7
13
|
from ImagePRO.utils.result import Result
|
|
8
14
|
|
|
15
|
+
import cv2
|
|
16
|
+
import mediapipe as mp
|
|
17
|
+
|
|
9
18
|
# Constants
|
|
10
19
|
mp_face_mesh = mp.solutions.face_mesh
|
|
11
20
|
mp_drawing_utils = mp.solutions.drawing_utils
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[3] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
5
11
|
|
|
6
12
|
from ImagePRO.human_analysis.face_analysis.face_mesh_analysis import analyze_face_mesh
|
|
7
13
|
from ImagePRO.utils.image import Image
|
|
8
14
|
from ImagePRO.utils.result import Result
|
|
9
15
|
|
|
16
|
+
import cv2
|
|
17
|
+
import mediapipe as mp
|
|
18
|
+
|
|
10
19
|
# Constants
|
|
11
20
|
mp_face_mesh = mp.solutions.face_mesh
|
|
12
21
|
DEFAULT_MAX_FACES = 1
|
{imagepro_python-1.1.0 → imagepro_python-1.2.1}/src/ImagePRO/object_analysis/object_detection.py
RENAMED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[2] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
11
|
+
|
|
3
12
|
from ultralytics import YOLO
|
|
4
13
|
|
|
5
14
|
from ImagePRO.utils.image import Image
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[2] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
11
|
+
|
|
3
12
|
import cv2
|
|
4
13
|
|
|
5
14
|
from ImagePRO.utils.image import Image
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[2] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
11
|
+
|
|
3
12
|
import cv2
|
|
4
13
|
|
|
5
14
|
from ImagePRO.utils.image import Image
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
# Add src directory to path for absolute imports
|
|
7
|
+
_file_path = Path(__file__).resolve()
|
|
8
|
+
_src_path = _file_path.parents[2] # Go up to src directory
|
|
9
|
+
if str(_src_path) not in sys.path:
|
|
10
|
+
sys.path.insert(0, str(_src_path))
|
|
3
11
|
|
|
4
12
|
from ImagePRO.utils.image import Image
|
|
5
13
|
from ImagePRO.utils.result import Result
|