Walid BENMAAROUF
Back to projects
C++17OpenCV 4.xQt 6OpenGL (via Qt)

Slice Defender

Satisfying slicing mechanics in 3D.

Demo coming soonGitHub

Overview

Technical Overview

System Architecture

  • End-to-end real-time pipeline: Webcam → Vision Processing → Coordinate Mapping → 3D Rendering
  • Tight coupling between OpenCV frame processing and Qt event loop via QTimer (~30 FPS)

Computer Vision Pipeline (OpenCV)

  • Frame acquisition using VideoCapture
  • Color-space conversion RGB → YCrCb
  • Adaptive contrast enhancement using CLAHE on Cr/Cb channels
  • Skin mask extraction via thresholding
  • Noise reduction using morphological opening/closing
  • Contour filtering to isolate hand region
  • Distance Transform to estimate palm center
  • Haar Cascade (detectMultiScale) as a fallback detection mechanism

Interaction & Mapping

  • Palm center coordinates normalized and mirrored
  • 2D camera space mapped to 3D world coordinates

Rendering & UI (Qt + OpenGL)

  • Real-time 3D sword movement in OpenGL scene
  • Qt-based GUI (camera preview, score, timer)
  • Modular separation between vision, UI, and rendering layers
  • Custom OpenGL scene embedded in Qt (QOpenGLWidget) with a manually designed 3D background
  • Dynamic projectile system: multiple shapes spawned at random positions following projectile-motion trajectories
  • Sword–projectile interaction model: sword position driven by palm tracking and mapped to 3D world space
  • Collision detection based on cylindrical hit volume and radius-threshold intersection (||P_sword - P_proj|| < r)
  • Successful intersections trigger explosion effects and score updates
  • Qt-based HUD integrating camera preview, timer, score, with clean separation between vision, game logic, and rendering layers

Performance

  • C++17 implementation
  • Stable real-time interaction at ~30 FPS

At a glance

Slugslice-defender
Tech6 items
RepoOpen

Demo

Preview video. (Muted looping hero + playable demo.)

Tech

Tech Stack

6 items
C++17
core application, real-time processing, and game logic
OpenCV 4.x
webcam capture, skin segmentation, palm detection, and tracking
Qt 6
GUI framework, event loop (QTimer), windowing, and layout management
OpenGL (via Qt)
real-time 3D rendering, scene management, sword and projectile visualization
qmake / .pro
build configuration and project management
Haar Cascade Classifier
fallback palm detection for robustness under challenging conditions

Details

Project info

Next steps

  • • Enhance processing speed for real time use
  • • Implement on embedded electronic system