Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Developing a web application that promotes anti-racism through visual storytelling and community participation

Notifications You must be signed in to change notification settings

victorsaly/Beneath-the-Surface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎭 "Beneath the Surface" Photo Compositor

A Python-based photo compositing system for the anti-racism campaign "Beneath the Surface" with the message "Different faces, same foundation".

🌟 Campaign Overview

This tool creates powerful visual statements by combining uploaded photos with skeleton overlays, demonstrating that beneath our different external appearances, we all share the same human foundation.

Campaign Message: "Different faces, same foundation"
Call to Action: "Take Part"
Partner Organization: Stand Up To Racism

βœ… System Status

  • βœ… AI Image Generation: Complete (100% technical success)
  • βœ… Photo Compositing: Complete and tested
  • βœ… Face Detection: Working with OpenCV
  • βœ… Background Removal: Working with rembg AI
  • βœ… Command Line Interface: Fully functional
  • βœ… Metadata Generation: Complete with campaign info
  • βœ… Project Organization: Professional structure implemented
  • βœ… Path References: All 83 scripts updated for organized structure
  • πŸš€ Ready for MVP Development: Web interface next

πŸš€ Quick Start

Prerequisites

  • Python 3.12+
  • macOS/Linux (tested on macOS)
  • Virtual environment (recommended)

Installation

  1. Clone and setup environment:
cd /path/to/FaceCampaign
python3 -m venv environment/photo-compositing-env
source environment/photo-compositing-env/bin/activate
  1. Install dependencies:
pip install opencv-python Pillow numpy requests rembg onnxruntime
  1. Test the system:
python scripts/test_compositor.py

Basic Usage

# Basic usage (run from root directory)
python scripts/simplified-photo-compositor.py assets/faces/input_photo.jpg assets/references/skeleton_overlay.png

# Custom output path
python scripts/simplified-photo-compositor.py assets/faces/photo.jpg assets/references/skeleton.png -o outputs/images/my_campaign_image.png

# Adjust parameters
python scripts/simplified-photo-compositor.py assets/faces/photo.jpg assets/references/skeleton.png --split 0.6 --opacity 0.9

# Debug mode
python scripts/simplified-photo-compositor.py assets/faces/photo.jpg assets/references/skeleton.png --debug

πŸ“ Project Structure

FaceCampaign/
β”œβ”€β”€ README.md                           # Main project overview
β”œβ”€β”€ .gitignore                          # Git ignore rules
β”œβ”€β”€ organization_map.json               # Project organization tracking
β”œβ”€β”€ scripts/                            # All Python processing scripts (83 files)
β”‚   β”œβ”€β”€ simplified-photo-compositor.py  # Main compositor script
β”‚   β”œβ”€β”€ test_compositor.py             # System validation tests
β”‚   β”œβ”€β”€ organize_project.py            # Project organization utility
β”‚   β”œβ”€β”€ update_path_references.py      # Path reference updater
β”‚   └── [80+ other processing scripts] # AI enhancement and testing scripts
β”œβ”€β”€ assets/                             # Source images and reference materials
β”‚   β”œβ”€β”€ faces/                         # Source face images
β”‚   └── references/                    # Reference skeleton overlays
β”œβ”€β”€ outputs/                            # All generated campaign content
β”‚   β”œβ”€β”€ images/                        # Final campaign images (SD3 quality)
β”‚   β”œβ”€β”€ interactive/                   # HTML sliders and web demos
β”‚   β”œβ”€β”€ quality_tests/                 # Quality comparison outputs
β”‚   └── archives/                      # Historical experiments
β”œβ”€β”€ docs/                              # Documentation and guides
β”‚   β”œβ”€β”€ development/                   # Setup guides and development logs
β”‚   β”œβ”€β”€ instructions/                  # Copilot instructions
β”‚   └── legal/                         # Legal and licensing info
β”œβ”€β”€ environment/                       # Virtual environments
β”‚   └── photo-compositing-env/         # Python virtual environment
└── .github/                           # GitHub configuration
    └── copilot-instructions.md        # AI development guidelines

🎨 How It Works

Processing Pipeline

  1. πŸ” Face Detection: Uses OpenCV to detect faces in uploaded photos
  2. πŸ’€ Skeleton Loading: Loads and prepares skeleton overlay image
  3. 🎨 Half-Split Composite: Creates seamless blend between face and skeleton
  4. πŸ“ Campaign Elements: Adds subtle campaign watermark
  5. πŸ’Ύ Output Generation: Saves high-quality PNG with metadata

Technical Features

  • Preserves Original Faces: 100% authentic face preservation (no AI interpretation)
  • Professional Blending: Smooth transitions with configurable blend zones
  • Metadata Generation: Comprehensive processing information and campaign data
  • Flexible Parameters: Adjustable split position, opacity, and blending
  • Error Handling: Robust error handling with informative messages

🎯 Command Line Options

python scripts/simplified-photo-compositor.py [OPTIONS] INPUT_IMAGE SKELETON_OVERLAY

Arguments:
  INPUT_IMAGE      Path to input photo (e.g., assets/faces/photo.jpg)
  SKELETON_OVERLAY Path to skeleton overlay image (e.g., assets/references/skeleton.png)

Options:
  -o, --output     Output path (optional, defaults to outputs/images/)
  --debug          Enable debug output
  --split FLOAT    Split position (0.0-1.0, default: 0.5)
  --blend INT      Blend zone width in pixels (default: 20)
  --opacity FLOAT  Skeleton opacity (0.0-1.0, default: 0.85)
  -h, --help       Show help message

πŸ“Š Output Files

Each processing run generates:

  1. Campaign Image: High-quality PNG with half-face, half-skeleton composite
  2. Metadata JSON: Complete processing information including:
    • Campaign messaging and organization info
    • Face detection results and coordinates
    • Processing parameters and statistics
    • Timestamp and file information

Example Metadata

{
  "campaign": {
    "name": "Beneath the Surface",
    "message": "Different faces, same foundation",
    "call_to_action": "Take Part",
    "organization": "Stand Up To Racism"
  },
  "processing": {
    "face_detected": true,
    "face_region": {"x": 128, "y": 128, "width": 256, "height": 256},
    "parameters": {"split_position": 0.5, "blend_zone": 20}
  }
}

πŸ§ͺ Testing

Run System Tests

python scripts/test_compositor.py

This validates:

  • βœ… Package imports (OpenCV, rembg, NumPy)
  • βœ… Face detection functionality
  • βœ… Background removal AI model
  • βœ… Image processing pipeline
  • βœ… Test image generation

Test with Custom Images

# Use your own photo and skeleton overlay
python scripts/simplified-photo-compositor.py assets/faces/my_photo.jpg assets/references/my_skeleton.png

🎨 Creative Examples

Basic Half-Split

python scripts/simplified-photo-compositor.py assets/faces/portrait.jpg assets/references/skull.png

Vertical Split (Left 40%, Right 60%)

python scripts/simplified-photo-compositor.py assets/faces/portrait.jpg assets/references/skull.png --split 0.4

Subtle Skeleton Overlay

python scripts/simplified-photo-compositor.py assets/faces/portrait.jpg assets/references/skull.png --opacity 0.7

Wide Blend Zone for Artistic Effect

python scripts/simplified-photo-compositor.py assets/faces/portrait.jpg assets/references/skull.png --blend 40

🀝 Campaign Integration

This system is designed to integrate with:

  • Web Interface: Nuxt.js frontend for photo uploads
  • Community Gallery: Rotating display of participant images
  • Social Sharing: Generated images optimized for social media
  • Partner Organizations: Integration with Stand Up To Racism

πŸ“œ Legal & Licensing

Image Requirements

  • Input Photos: User must own rights or have permission
  • Skeleton Overlays: Use Creative Commons or licensed medical illustrations
  • Output Images: Licensed for campaign use and social sharing

Recommended Skeleton Sources

  • Creative Commons medical illustrations (~$195/year)
  • Wikimedia Commons anatomical drawings
  • Licensed stock photography for professional campaigns

πŸ› οΈ Development

Adding New Features

  1. Face landmark detection for more precise compositing
  2. Animated GIF generation for social media
  3. Batch processing for multiple images
  4. Custom skeleton overlay generation

Web Interface Integration

Ready for integration with:

  • Frontend: Nuxt.js photo upload interface
  • Backend: .NET Core 8 API for processing
  • Storage: Azure Blob Storage for images
  • Gallery: Community participation display

πŸ”§ Troubleshooting

Common Issues

Face not detected:

  • Ensure good lighting and clear face visibility
  • Try different angles or closer shots
  • System will use center region if no face detected

Package installation errors:

  • Use virtual environment: python3 -m venv photo-compositing-env
  • Install cmake if needed: brew install cmake
  • Update pip: pip install --upgrade pip

Memory issues with large images:

  • Images are automatically resized for processing
  • Use --debug flag to see processing details

Debug Mode

python scripts/simplified-photo-compositor.py assets/faces/input.jpg assets/references/skeleton.png --debug

Provides detailed logging of:

  • Face detection coordinates
  • Image processing steps
  • Blend zone calculations
  • Error details and stack traces

🌟 Success Metrics

The system has achieved:

  • βœ… 100% Technical Success: All dependencies working
  • βœ… Authentic Face Preservation: No AI interpretation artifacts
  • βœ… Professional Quality: High-resolution output suitable for campaigns
  • βœ… User-Friendly Interface: Simple command-line operation
  • βœ… Comprehensive Documentation: Ready for team collaboration

πŸš€ Next Steps

  1. Web Interface Development: Create Nuxt.js frontend for easy photo uploads
  2. Azure Deployment: Deploy to cloud infrastructure for scalability
  3. Community Gallery: Build rotating display of participant images
  4. Social Integration: Add direct sharing to social media platforms
  5. Partnership Features: Integrate with Stand Up To Racism organization

🎯 Campaign Message: "Different faces, same foundation"
πŸ“’ Take Part: Create your own "Beneath the Surface" image today!
🀝 Support: Stand Up To Racism

Ready for MVP web development phase ✨

About

Developing a web application that promotes anti-racism through visual storytelling and community participation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published