CAPA - Craniofacial Analysis & Prediction Architecture SDK
Project description
CAPA SDK
Craniofacial Analysis & Prediction Architecture
A Python SDK for advanced craniofacial analysis based on 15+ peer-reviewed scientific papers.
Features
- WD Analysis: Bizygomatic width measurement and classification
- Forehead Analysis: Frontal inclination angle measurement
- Morphology Analysis: Face shape classification and facial proportions
- Neoclassical Canons: Classical facial proportion analysis
- Multi-Angle Support: Combine results from multiple images
- Quality Control: Adaptive quality assessment and validation
Installation
pip install capa-sdk
Or install from source:
git clone https://github.com/yarel2l/capa-sdk.git
cd capa-sdk
pip install -e .
Dependencies
- Python 3.9+
- OpenCV
- dlib
- MediaPipe
- face-recognition
- scikit-learn
- scipy
- numpy
- Pillow
- matplotlib
Required Model File
Download the dlib 68-point facial landmark model:
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
bzip2 -d shape_predictor_68_face_landmarks.dat.bz2
Quick Start
from capa import CoreAnalyzer
# Initialize analyzer
analyzer = CoreAnalyzer()
# Analyze an image
result = analyzer.analyze_image("photo.jpg")
# Access results
if result.wd_result:
print(f"WD Value: {result.wd_result.wd_value:.3f}")
print(f"Classification: {result.wd_result.primary_classification.value}")
if result.forehead_result:
print(f"Forehead Angle: {result.forehead_result.forehead_geometry.slant_angle_degrees:.1f}")
if result.morphology_result:
print(f"Face Shape: {result.morphology_result.shape_classification.primary_shape.value}")
# Always shutdown when done
analyzer.shutdown()
Analysis Modes
from capa import CoreAnalyzer, AnalysisConfiguration, AnalysisMode
config = AnalysisConfiguration(
mode=AnalysisMode.STANDARD, # FAST, STANDARD, THOROUGH, SCIENTIFIC
enable_wd_analysis=True,
enable_forehead_analysis=True,
enable_morphology_analysis=True,
)
analyzer = CoreAnalyzer(config=config)
Multi-Angle Analysis
from capa import MultiAngleAnalyzer, AngleSpecification
analyzer = MultiAngleAnalyzer()
angle_specs = [
AngleSpecification(angle_type='frontal', image_path='front.jpg'),
AngleSpecification(angle_type='profile', image_path='side.jpg'),
]
result = analyzer.analyze_multiple_angles(
angle_specs=angle_specs,
subject_id="subject_001"
)
print(f"Combined Confidence: {result.combined_confidence*100:.1f}%")
analyzer.shutdown()
Using Individual Modules
from capa.modules import WDAnalyzer, ForeheadAnalyzer, MorphologyAnalyzer
import cv2
image = cv2.imread("photo.jpg")
# WD Analysis only
wd_analyzer = WDAnalyzer()
wd_result = wd_analyzer.analyze(image)
# Forehead Analysis only
forehead_analyzer = ForeheadAnalyzer()
forehead_result = forehead_analyzer.analyze(image)
# Morphology Analysis only
morphology_analyzer = MorphologyAnalyzer()
morphology_result = morphology_analyzer.analyze(image)
Scientific Foundation
CAPA is built on 15+ peer-reviewed scientific papers. All referenced papers are included in the data/ folder for easy access.
WD Analysis (Bizygomatic Width)
| Paper | Local PDF |
|---|---|
| Bizygomatic Width and Personality Traits of the Relational Field | View PDF |
| Bizygomatic Width and its Association with Social and Personality Traits in Males | View PDF |
| Association between self-reported impulsiveness and gray matter volume | View PDF |
Forehead Analysis (Frontal Inclination)
| Paper | Local PDF |
|---|---|
| The Slant of the Forehead as a Craniofacial Feature of Impulsiveness | View PDF |
| Correlation between Impulsiveness, Cortical Thickness and Slant of The Forehead | View PDF |
| La impulsividad y su asociacion con la inclinacion de la frente | View PDF |
| Frontonasal dysmorphology in bipolar disorder by 3D laser surface imaging | View PDF |
Morphology Analysis (Face Shape)
| Paper | Local PDF |
|---|---|
| The validity of eight neoclassical facial canons in the Turkish adults | View PDF |
| Evaluation of Face Shape in Turkish Individuals | View PDF |
| Accuracy and precision of a 3D anthropometric facial analysis | View PDF |
| Determinacion del Indice Facial Total y Cono Facial | View PDF |
Neoclassical Canons
| Paper | Local PDF |
|---|---|
| Assessing Facial Beauty of Sabah Ethnic Groups Using Farkas Principles | View PDF |
Additional Morphology Papers
| Paper | Local PDF |
|---|---|
| Morphology Studies | View PDF 1 / View PDF 2 |
External References
- Farkas, L.G. (1994). Anthropometry of the Head and Face. Raven Press, New York.
- Gonzalez-Jose, R. et al. (2005). Functional-craniology approach to the influence of economic strategy on skull morphology. American Journal of Physical Anthropology.
- Kolar, J.C. & Salter, E.M. (1997). Craniofacial Anthropometry: Practical Measurement of the Head and Face for Clinical, Surgical, and Research Use. Charles C Thomas Publisher.
Documentation
Full documentation is available in the docs/ directory:
| Document | Description |
|---|---|
| Getting Started | Installation and basic usage |
| Configuration | Analysis modes and settings |
| API Reference | Complete API documentation |
| Scientific Foundation | Research papers and methodology |
| Examples | Code examples and use cases |
API Reference
Main Classes
| Class | Description |
|---|---|
CoreAnalyzer |
Main orchestrator for comprehensive analysis |
MultiAngleAnalyzer |
Multi-angle analysis coordinator |
ResultsIntegrator |
Combines results from multiple sources |
Scientific Modules
| Module | Description |
|---|---|
WDAnalyzer |
Bizygomatic width analysis |
ForeheadAnalyzer |
Frontal inclination analysis |
MorphologyAnalyzer |
Face shape classification |
NeoclassicalCanonsAnalyzer |
Classical proportion analysis |
Result Types
| Type | Description |
|---|---|
ComprehensiveAnalysisResult |
Complete analysis result |
WDResult |
WD analysis result |
ForeheadResult |
Forehead analysis result |
MorphologyResult |
Morphology analysis result |
Examples
See the examples/ directory for complete usage examples:
basic_analysis.py- Simple single-image analysismulti_angle_analysis.py- Multi-angle analysisindividual_modules.py- Using modules directly
License
Dual License - See LICENSE for full terms
| Use Type | License | Cost |
|---|---|---|
| Personal projects | Non-Commercial License | Free |
| Academic research | Non-Commercial License | Free |
| Educational use | Non-Commercial License | Free |
| Non-profit internal use | Non-Commercial License | Free |
| Commercial use | Commercial License Required | Contact us |
Patent Notice
This software implements methods covered by US Patent 10,885,309: "System and method for evaluating personality using anthropometric measurement of a person's face"
The Non-Commercial License includes a limited patent license for non-commercial use only. Commercial use without a Commercial License may constitute patent infringement.
Commercial Licensing
For commercial licensing inquiries, contact:
- Email: yarelleyva2@gmail.com
- GitHub: Open an issue
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Disclaimer
This SDK provides measurements and classifications based on peer-reviewed scientific research. Results should be interpreted by qualified professionals and should not be used as the sole basis for any clinical, psychological, or employment decisions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file capa_sdk-1.1.0.tar.gz.
File metadata
- Download URL: capa_sdk-1.1.0.tar.gz
- Upload date:
- Size: 172.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab4857798dd51b35330a09ef4c3a014232363d6cc359a90b1c21ca60f32790a9
|
|
| MD5 |
9dfc1eaba28acc89767cebc7af032389
|
|
| BLAKE2b-256 |
51f35b712e6eca4df34556000f11054f92fe46325602f00a935229f10c598631
|
File details
Details for the file capa_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: capa_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 163.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cac25176d00517dc9899f045f734c1b361bc1bad86412eb435c4f8030ae41922
|
|
| MD5 |
863188eaed09ec7526a45d1db4a15c4d
|
|
| BLAKE2b-256 |
79048529bac87b4529b06381779ac00066fb06e9ad9e4cb3514751bf6df6b602
|