facemorph 0.1.0__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.
- facemorph-0.1.0/LICENSE +21 -0
- facemorph-0.1.0/PKG-INFO +165 -0
- facemorph-0.1.0/README.md +124 -0
- facemorph-0.1.0/pyproject.toml +37 -0
- facemorph-0.1.0/setup.cfg +4 -0
- facemorph-0.1.0/setup.py +4 -0
- facemorph-0.1.0/src/facemorph/__init__.py +15 -0
- facemorph-0.1.0/src/facemorph/alignment.py +345 -0
- facemorph-0.1.0/src/facemorph/cli.py +54 -0
- facemorph-0.1.0/src/facemorph/indices.py +105 -0
- facemorph-0.1.0/src/facemorph/landmarks.py +143 -0
- facemorph-0.1.0/src/facemorph/morphing.py +507 -0
- facemorph-0.1.0/src/facemorph.egg-info/PKG-INFO +165 -0
- facemorph-0.1.0/src/facemorph.egg-info/SOURCES.txt +18 -0
- facemorph-0.1.0/src/facemorph.egg-info/dependency_links.txt +1 -0
- facemorph-0.1.0/src/facemorph.egg-info/entry_points.txt +2 -0
- facemorph-0.1.0/src/facemorph.egg-info/requires.txt +6 -0
- facemorph-0.1.0/src/facemorph.egg-info/top_level.txt +1 -0
- facemorph-0.1.0/tests/test_alignment.py +13 -0
- facemorph-0.1.0/tests/test_morphing.py +196 -0
facemorph-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Robert Sorete
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
facemorph-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: facemorph
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Face morphing and alignment package using MediaPipe and OpenCV
|
|
5
|
+
Author: FaceMorph Contributors
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Robert Sorete
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://pypi.org/project/facemorph/
|
|
29
|
+
Project-URL: Repository, https://github.com/Robys01/Face-Morphing
|
|
30
|
+
Project-URL: Issues, https://github.com/Robys01/Face-Morphing/issues
|
|
31
|
+
Requires-Python: <3.13,>=3.9
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Requires-Dist: numpy>=1.26
|
|
35
|
+
Requires-Dist: opencv-python>=4.9
|
|
36
|
+
Requires-Dist: scipy>=1.13
|
|
37
|
+
Requires-Dist: mediapipe<0.10.30,>=0.10.11
|
|
38
|
+
Requires-Dist: Pillow>=10.0
|
|
39
|
+
Requires-Dist: tqdm>=4.66
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# Face Morphing
|
|
43
|
+
|
|
44
|
+
Smooth, fast, and robust, `facemorph` is a simple face morphing package that creates smooth transitions between faces. It uses Delaunay triangulation and piecewise affine warping.
|
|
45
|
+
Optional face alignment ensures more natural results.
|
|
46
|
+
|
|
47
|
+
- Landmarks: **MediaPipe**
|
|
48
|
+
- Warping: **OpenCV**
|
|
49
|
+
- Triangulation: **SciPy**
|
|
50
|
+
- Math: **NumPy**
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<img src="assets/demo_01.gif" alt="FaceMorph demo 1" width="380" />
|
|
55
|
+
<img src="assets/demo_02.gif" alt="FaceMorph demo 2" width="380" />
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install facemorph
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or from this repo:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/Robys01/Face-Morphing.git
|
|
70
|
+
cd Face-Morphing
|
|
71
|
+
pip install -e .
|
|
72
|
+
```
|
|
73
|
+
## Requirements
|
|
74
|
+
|
|
75
|
+
- Python **3.9 - 3.12**
|
|
76
|
+
- Works on Linux / macOS / Windows
|
|
77
|
+
- Key dependencies: `mediapipe`, `opencv-python`, `scipy`, `numpy`
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## CLI Usage
|
|
81
|
+
|
|
82
|
+
Morph all images from a folder:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
facemorph --input-dir images_dir
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If `--output` is not provided, FaceMorph auto-generates a name like:
|
|
89
|
+
`output_24.02.2026_02.22.17_20fps.mp4`
|
|
90
|
+
|
|
91
|
+
Skip alignment:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
facemorph --input-dir images_dir --no-align
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use parallel workers for speed:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
facemorph --input-dir images_dir --workers 4
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Other options:
|
|
104
|
+
- `--duration 3.0`: Seconds per transition
|
|
105
|
+
- `--fps 30`: Video frame rate
|
|
106
|
+
- `--output output.mp4`: Custom output file
|
|
107
|
+
- `--aligned-dir aligned_images`: Directory for aligned images
|
|
108
|
+
- `--output-size 1024`: Video resolution (aligned only)
|
|
109
|
+
- `--guideline`: Draw triangulation lines
|
|
110
|
+
- `--workers`: Number of parallel workers (default: 1)
|
|
111
|
+
- `--show-native-logs`: Show MediaPipe logs
|
|
112
|
+
|
|
113
|
+
> If an image contains multiple faces, FaceMorph automatically uses the largest detected face.
|
|
114
|
+
> Also, it skips images where it does not detect a face.
|
|
115
|
+
|
|
116
|
+
## Python API
|
|
117
|
+
|
|
118
|
+
### Morph Images
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from facemorph import morph_folder, morph_images
|
|
122
|
+
|
|
123
|
+
# Morph a folder of images
|
|
124
|
+
morph_folder(
|
|
125
|
+
input_dir="images_dir",
|
|
126
|
+
output_path="output.mp4",
|
|
127
|
+
align=True,
|
|
128
|
+
workers=4,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# Morph specific images
|
|
132
|
+
paths = ["a.jpg", "b.jpg", "c.jpg"]
|
|
133
|
+
morph_images(paths, duration=3.0, fps=30, workers=4)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Align Faces Only
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from facemorph import align_folder, align_images, align_image
|
|
140
|
+
|
|
141
|
+
# Align a folder
|
|
142
|
+
aligned_paths = align_folder(
|
|
143
|
+
input_dir="images",
|
|
144
|
+
output_dir="aligned_images",
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Align specific images
|
|
148
|
+
aligned_paths = align_images(
|
|
149
|
+
image_paths=["images/1.png", "images/2.png"],
|
|
150
|
+
output_dir="aligned_images_custom",
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
# Align a single image
|
|
154
|
+
align_image(
|
|
155
|
+
source_path="images/1.png",
|
|
156
|
+
destination_path="aligned_images/1_aligned.png",
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
164
|
+
|
|
165
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Face Morphing
|
|
2
|
+
|
|
3
|
+
Smooth, fast, and robust, `facemorph` is a simple face morphing package that creates smooth transitions between faces. It uses Delaunay triangulation and piecewise affine warping.
|
|
4
|
+
Optional face alignment ensures more natural results.
|
|
5
|
+
|
|
6
|
+
- Landmarks: **MediaPipe**
|
|
7
|
+
- Warping: **OpenCV**
|
|
8
|
+
- Triangulation: **SciPy**
|
|
9
|
+
- Math: **NumPy**
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="assets/demo_01.gif" alt="FaceMorph demo 1" width="380" />
|
|
14
|
+
<img src="assets/demo_02.gif" alt="FaceMorph demo 2" width="380" />
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install facemorph
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or from this repo:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/Robys01/Face-Morphing.git
|
|
29
|
+
cd Face-Morphing
|
|
30
|
+
pip install -e .
|
|
31
|
+
```
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- Python **3.9 - 3.12**
|
|
35
|
+
- Works on Linux / macOS / Windows
|
|
36
|
+
- Key dependencies: `mediapipe`, `opencv-python`, `scipy`, `numpy`
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## CLI Usage
|
|
40
|
+
|
|
41
|
+
Morph all images from a folder:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
facemorph --input-dir images_dir
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If `--output` is not provided, FaceMorph auto-generates a name like:
|
|
48
|
+
`output_24.02.2026_02.22.17_20fps.mp4`
|
|
49
|
+
|
|
50
|
+
Skip alignment:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
facemorph --input-dir images_dir --no-align
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use parallel workers for speed:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
facemorph --input-dir images_dir --workers 4
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Other options:
|
|
63
|
+
- `--duration 3.0`: Seconds per transition
|
|
64
|
+
- `--fps 30`: Video frame rate
|
|
65
|
+
- `--output output.mp4`: Custom output file
|
|
66
|
+
- `--aligned-dir aligned_images`: Directory for aligned images
|
|
67
|
+
- `--output-size 1024`: Video resolution (aligned only)
|
|
68
|
+
- `--guideline`: Draw triangulation lines
|
|
69
|
+
- `--workers`: Number of parallel workers (default: 1)
|
|
70
|
+
- `--show-native-logs`: Show MediaPipe logs
|
|
71
|
+
|
|
72
|
+
> If an image contains multiple faces, FaceMorph automatically uses the largest detected face.
|
|
73
|
+
> Also, it skips images where it does not detect a face.
|
|
74
|
+
|
|
75
|
+
## Python API
|
|
76
|
+
|
|
77
|
+
### Morph Images
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from facemorph import morph_folder, morph_images
|
|
81
|
+
|
|
82
|
+
# Morph a folder of images
|
|
83
|
+
morph_folder(
|
|
84
|
+
input_dir="images_dir",
|
|
85
|
+
output_path="output.mp4",
|
|
86
|
+
align=True,
|
|
87
|
+
workers=4,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Morph specific images
|
|
91
|
+
paths = ["a.jpg", "b.jpg", "c.jpg"]
|
|
92
|
+
morph_images(paths, duration=3.0, fps=30, workers=4)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Align Faces Only
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from facemorph import align_folder, align_images, align_image
|
|
99
|
+
|
|
100
|
+
# Align a folder
|
|
101
|
+
aligned_paths = align_folder(
|
|
102
|
+
input_dir="images",
|
|
103
|
+
output_dir="aligned_images",
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Align specific images
|
|
107
|
+
aligned_paths = align_images(
|
|
108
|
+
image_paths=["images/1.png", "images/2.png"],
|
|
109
|
+
output_dir="aligned_images_custom",
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Align a single image
|
|
113
|
+
align_image(
|
|
114
|
+
source_path="images/1.png",
|
|
115
|
+
destination_path="aligned_images/1_aligned.png",
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
123
|
+
|
|
124
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "facemorph"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Face morphing and alignment package using MediaPipe and OpenCV"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9, <3.13"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "FaceMorph Contributors" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy>=1.26",
|
|
17
|
+
"opencv-python>=4.9",
|
|
18
|
+
"scipy>=1.13",
|
|
19
|
+
"mediapipe>=0.10.11, <0.10.30",
|
|
20
|
+
"Pillow>=10.0",
|
|
21
|
+
"tqdm>=4.66",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://pypi.org/project/facemorph/"
|
|
26
|
+
Repository = "https://github.com/Robys01/Face-Morphing"
|
|
27
|
+
Issues = "https://github.com/Robys01/Face-Morphing/issues"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
facemorph = "facemorph.cli:main"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
package-dir = {"" = "src"}
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
include = ["facemorph*"]
|
facemorph-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from facemorph.alignment import align_folder, align_image, align_images
|
|
2
|
+
from facemorph.landmarks import MediaPipeLandmarkDetector
|
|
3
|
+
from facemorph.morphing import morph_folder, morph_images
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"__version__",
|
|
9
|
+
"MediaPipeLandmarkDetector",
|
|
10
|
+
"align_image",
|
|
11
|
+
"align_images",
|
|
12
|
+
"align_folder",
|
|
13
|
+
"morph_images",
|
|
14
|
+
"morph_folder",
|
|
15
|
+
]
|