How royshil/obs-backgroundremoval works
This repository is an OBS Studio plugin for portrait background removal and low-light enhancement. The primary workflow is an OBS video filter capturing a frame, running a selected model through ONNX Runtime, then rendering the processed result. Separate model adapters support segmentation, depth and enhancement; macOS also has a CoreML rendering pipeline. The README documents CPU/GPU acceleration and both product capabilities. Several macOS implementation files and model adapters were not sampled, so those branches are shown only where the tree or README supports them.
Main entry points: background-filter.cpp Background filter · enhance-filter.cpp Enhancement filter · plugin-main.cpp Plugin registration · MediaPipeLandscapePipeline.hpp Landscape pipeline
Components 19
OBS Plugin
- Plugin registration
src/plugin-main.cpp - Background filter
src/background-filter.cpp - Enhancement filter
src/enhance-filter.cpp - Filter frame data
src/FilterData.hpp - OBS image capture
src/obs-utils/obs-utils.cpp
Inference
- ONNX sessions
src/ort-utils/ort-session-utils.cpp - Model adapters
src/models/Model.hpp - Segmentation models
src/models/ModelSelfieMulticlass.hpp - Depth model
src/models/ModelTCMonoDepth.hpp - Enhancement models
src/models/ModelTBEFN.hpp
macOS Rendering
- macOS filter context
src/macos/BackgroundRemoval/FilterContext.cpp - Landscape pipeline
src/macos/BackgroundRemoval/MediaPipeLandscapePipeline.hpp - Mask processing
src/macos/ImageProcessing.hpp - Render effect
src/macos/BackgroundRemoval/MainEffect.cpp
Plugin Support
- About dialog
src/UI/AboutDialog.cpp - About integration
src/UI/AboutDialogIntegration.cpp - Update checker
src/UpdateConfig/UpdateConfigCommon.cpp - Aligned buffers
src/Memory/AlignedBuffer.cpp
Other components
- OBS user
Connections 22
- OBS user → Plugin registration: uses plugin
- Plugin registration → Background filter: registers filter
src/plugin-main.cpp - Plugin registration → Enhancement filter: registers filter
src/plugin-main.cpp - Background filter → Filter frame data: uses state
src/FilterData.hpp - Enhancement filter → Filter frame data: uses state
src/FilterData.hpp - Background filter → OBS image capture: captures frames
src/background-filter.cpp - Enhancement filter → OBS image capture: captures frames
src/enhance-filter.cpp - Background filter → ONNX sessions: creates session
src/background-filter.cpp - Enhancement filter → ONNX sessions: creates session
src/enhance-filter.cpp - ONNX sessions → Model adapters: runs inference
src/ort-utils/ort-session-utils.cpp - Background filter → Segmentation models: selects model
src/background-filter.cpp - Background filter → Depth model: selects model
src/background-filter.cpp - Enhancement filter → Enhancement models: selects model
src/enhance-filter.cpp - macOS filter context → Landscape pipeline: creates pipeline
src/macos/BackgroundRemoval/FilterContext.cpp - Landscape pipeline → Mask processing: processes masks
src/macos/BackgroundRemoval/MediaPipeLandscapePipeline.hpp - Landscape pipeline → Render effect: renders effect
- Landscape pipeline → Aligned buffers: allocates buffers
src/macos/BackgroundRemoval/MediaPipeLandscapePipeline.hpp - Plugin registration → About integration: integrates dialog
src/plugin-main.cpp - About integration → About dialog: opens dialog
src/UI/AboutDialogIntegration.cpp - About integration → Update checker: checks versions
src/UI/AboutDialogIntegration.cpp - Background filter → Update checker: checks versions
src/background-filter.cpp - Enhancement filter → Update checker: checks versions
src/enhance-filter.cpp