Carnet UPC
Photo processing for university ID cards with face detection and automatic adjustment.


The problem
Adapting a photo by hand to the size, background and weight an ID card requires is repetitive.
What I built
A computer vision pipeline in FastAPI: MediaPipe detects the face, rembg removes the background, and OpenCV and Pillow fit the image to 240 × 288 pixels. The interface is in Next.js.
Outcome
It automates preparing photos for ID cards. No public demo yet.
Decisions that mattered
- 01
Specialized processing
MediaPipe frames the face, rembg (ONNX) separates the figure, and OpenCV and Pillow handle size, DPI and weight.
- 02
Validate from the start
The TypeScript interface validates the input before sending it to the decoupled backend.
Technologies
- Next.js
- FastAPI
- MediaPipe
- rembg
- OpenCV
- Cloudinary
C4 model. The pulsing line is the main path of a request.
Level 1 · who uses the system and what it connects to
Level 2 · the applications and data stores it is made of
Level 3 · the components inside the API
- Person
- System
- Container
- External
- Main path
- 01Photo
- 02Detection
- 03Segmentation
- 04Fitting
- 05Download