Skip to content

liuh886/GhostCam

Repository files navigation

👻 GhostCam

English | 简体中文

GhostCam is a minimalist, headless background removal service designed for developers, streamers, and online instructors. It generates a transparent, click-through, and real-time controllable "ghostly portrait" on your desktop, allowing your portrait to blend perfectly with the background while you demonstrate code or explain slides.


✨ Key Features

  • AI Edge Optimization: Based on the latest MediaPipe Tasks API, with built-in Gaussian feathering and edge tightening logic for smooth and natural portrait edges.
  • Ghost Mode (Opacity): Supports 0% - 100% global opacity adjustment, giving the portrait a "ghostly" transparency.
  • Full Transparency & Click-Through: Supports "Lock" mode, where mouse clicks pass completely through the portrait window, allowing normal coding or operations.
  • High-Performance Preview: Rendered using native Win32 APIs with extremely low latency and minimal CPU/GPU usage.
  • Multi-Shape Windows: Supports switching between Circle and Rectangle shapes.

🛠️ Installation & Preparation

1. Install Drivers (Required)

GhostCam requires a virtual camera driver to output to OBS or Teams:

  1. Navigate to the project directory: drivers/UnityCapture/Install/.
  2. Right-click Install.bat -> Run as Administrator.

2. Environment Setup

pip install -r requirements.txt
pip install .

📖 Usage Guide

GhostCam operates in a "Service + Command" dual-window mode.

Step 1: Start the Core Service (Window A)

Open a terminal and start the AI processing engine:

ghostcam run

The AI model (~5MB) will be downloaded automatically on the first run. A preview window will appear in the bottom-right corner after startup.

Step 2: Real-time Effect Control (Window B)

Keep Window A open, open another new terminal window, and use the following commands to adjust effects in real-time:

🎭 Visual Style

  • Ghost Opacity: ghostcam opacity 80% (Makes the portrait transparent, 70%-90% recommended)
  • Shape Switch: ghostcam circle (Circle) or ghostcam rect (Rectangle)
  • HUD Border: ghostcam border #00FF00 (Add green border) or ghostcam border off

📏 Layout & Interaction

  • Window Scaling: ghostcam scale 1.5 (Scale 1.5x)
  • Lock/Click-Through: ghostcam lock (Window becomes fixed and mouse clicks pass through)
  • Unlock: ghostcam unlock (Restores draggable state)

📺 Toggle Controls

  • Hide/Show: ghostcam off / ghostcam on
  • Stop Service: ghostcam stop

💡 Pro Tips

  1. Recommended Streaming Setup:

    • Run ghostcam circle to switch to a circular shape.
    • Run ghostcam opacity 85% to enable Ghost Mode.
    • Move to a suitable screen position, then run ghostcam lock.
    • Add a "Video Capture Device" in OBS and select Unity Video Capture.
  2. Fixing Edge Artifacts:

    • If edges appear too thick, ensure there is adequate lighting. GhostCam has built-in feathering logic; it works best when used with opacity.
  3. Changing Cameras:

    • If you have multiple cameras, run ghostcam list to see indices, then modify device_index in main.py.

⚖️ License

MIT License.

About

An ultra-light, headless virtual camera for real-time background replacement, blur, and solid-color backgrounds on Windows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors