Angular 21 web application for real-time facial recognition with age, gender, and emotion detection using webcam feed or uploaded images.
Live Application | Source Code
- Real-time webcam feed with start/stop controls
- Face detection with visual bounding boxes
- Age estimation and gender detection with confidence scores
- Emotion recognition (7 emotions: happy, sad, angry, surprised, neutral, fearful, disgusted)
- Multiple face detection
- Image upload with progress indicator
- Interactive tooltips on hover showing face details
- Responsive design for desktop and mobile
- Framework: Angular 21+ with TypeScript (Standalone Components)
- State Management: NgRx (Redux pattern)
- UI Framework: Tailwind CSS 4
- Facial Recognition: face-api.js (TensorFlow.js)
- Build Tool: Angular CLI 21 with Vite
- RxJS: Reactive programming for async operations
- Node.js v18.x or higher
- npm v10.x or higher
- Angular CLI v21.x or higher:
npm install -g @angular/cli@21
-
Clone the repository:
git clone https://github.com/isabelccc/webcam.git cd webcam -
Install dependencies:
npm install
-
Models are included in
src/assets/models/. If needed, download from face-api.js-models and place insrc/assets/models/:src/assets/models/ ├── tiny_face_detector/ ├── age_gender_model/ └── face_expression/
Development server:
npm startAvailable at http://localhost:4200
Production build:
npm run buildOutput in dist/webcam/browser
webcam/
├── src/
│ ├── app/
│ │ ├── models/ # TypeScript interfaces
│ │ ├── service/ # Business logic services
│ │ ├── store/ # NgRx store (actions, reducers, effects, selectors)
│ │ ├── app.ts # Main component
│ │ ├── app.html # Template
│ │ ├── app.css # Styles
│ │ └── app.config.ts # App configuration
│ ├── assets/models/ # face-api.js models
│ └── main.ts # Bootstrap
├── angular.json
└── package.json
- Click "Start Webcam" and allow camera permissions
- Faces are detected automatically with colored bounding boxes
- Hover over any face to see tooltip with details
- View all detected faces in the list below
- Click "Stop Webcam" to stop the feed
- Click "Choose Image" to select a photo
- Wait for processing (progress bar shown)
- Colored boxes appear around detected faces
- Hover over face boxes to see detailed information
- Actions: User interactions dispatch actions
- Effects: Handle async operations (face detection, image processing)
- Reducers: Update application state
- Selectors: Components subscribe to state changes
- Components: Display UI and dispatch actions
- Webcam access via
getUserMedia()API - Load pre-trained TensorFlow.js models on initialization
- Process video frames every 500ms using face-api.js
- Apply confidence threshold (0.6 for images, 0.3 for video) to filter false positives
- Detect faces, estimate age/gender, recognize emotions
- Draw colored bounding boxes on canvas overlay
- Show interactive tooltips on hover
Deployed on AWS (S3 + CloudFront).
Quick steps:
- Build:
npm run build - Upload
dist/webcam/browser/*to S3 bucket - Configure CloudFront distribution with HTTPS
- Chrome/Edge (recommended)
- Firefox
- Safari
- Requires HTTPS for webcam access (localhost works for development)
npm install # Install dependencies
npm start # Start development server
npm run build # Build for production
npm test # Run testsThis project is created for demonstration purposes.
isabel chen