A beautiful Material Design mobile app for real-time face morphing, built with KivyMD.
- Material Design 3 UI with dark theme
- Navigation Drawer for category selection (Animals, Celebrities, Historical Figures, Races, Addons)
- Real-time preview area for morphed images
- Morph intensity slider (0-100%)
- Camera controls (start/stop streaming)
- Save options (image and video)
- Clean architecture ready for backend integration
task5_gui/
├── main.py # App entry point
├── main.kv # UI layout (KivyMD)
├── ui/
│ ├── __init__.py
│ ├── screens.py # Main screen logic
│ └── components.py # Reusable UI components
├── requirements.txt # Python dependencies
├── buildozer.spec # Android build configuration
└── README.md
-
Install dependencies:
pip install -r requirements.txt
-
Run the app:
python main.py
-
Install Buildozer:
pip install buildozer
-
Build APK:
buildozer android debug
-
Find APK:
bin/facemorphstudio-1.0-debug.apk
The UI is ready for your backend team to integrate. Look for comments marked:
# ==========================================
# BACKEND INTEGRATION POINT #X
# ==========================================- Initialize morphing engine (
screens.py-__init__) - Load target images (
select_category()) - Apply morphing (
call_backend_morph()) - Camera capture (
start_camera_stream()) - Frame processing (
on_frame_received()) - Update preview (
update_preview()) - Save functionality (
save_current_frame(),save_video())
def call_backend_morph(self, frame, target, alpha):
"""Your morphing algorithm here"""
# Load target
target_data = self.morph_engine.get_target(target)
# Morph
morphed = self.morph_engine.blend(frame, target_data, alpha)
return morphed
def on_frame_received(self, dt):
"""Camera frame processing"""
ret, frame = self.camera.read()
if ret and self.selected_target:
morphed = self.call_backend_morph(frame, self.selected_target, self.morph_alpha)
self.update_preview(morphed)The preview widget accepts frames as:
- Type: NumPy array (
np.ndarray) - Shape:
(height, width, 3) - Color: RGB (not BGR!)
- Data type:
uint8(0-255)
Example:
import numpy as np
# Your morphed frame
frame = np.array(...) # Shape: (480, 640, 3), dtype: uint8
# Update preview
self.update_preview(frame)- App title
- Menu button (opens navigation drawer)
- Info button
- Category selection with icons
- Beautiful header
- Smooth animations
- Large preview card (400dp height)
- Live/Offline status chip
- Placeholder when camera is off
- Automatic texture updates
- Range: 0% (real face) to 100% (full morph)
- Real-time value display
- Smooth hint animations
- Select Target: Choose morph target from category
- Start Camera: Begin camera stream
- Stop Camera: End camera stream
- Save Image: Save current frame
- Save Video: Record morphing session
Edit main.py to change colors:
def build(self):
self.theme_cls.primary_palette = "DeepPurple" # Change to your color
self.theme_cls.accent_palette = "Pink" # Change accent
self.theme_cls.theme_style = "Dark" # "Light" or "Dark"- Camera frames should be passed to
on_frame_received(dt)at ~30 FPS - Morphing function should be implemented in
call_backend_morph() - Face detection can be added in
on_frame_received()before morphing - Save functions need actual file I/O implementation
- Target loading should load images/models based on category and target name
- Implement face detection
- Add morphing algorithm
- Setup camera capture (OpenCV/MediaPipe)
- Implement save image functionality
- Implement video recording
- Load actual target images
- Add error handling
- Optimize for real-time performance
MIT License - Feel free to modify and use!
UI designed with KivyMD - Material Design for Kivy Built for Face Morphing Project
Need help? Check the integration points in ui/screens.py!