File size: 1,944 Bytes
2b1c753
20c856c
 
 
 
2b1c753
 
 
20c856c
2b1c753
20c856c
 
 
 
 
 
 
 
 
0b6961f
 
20c856c
 
2b1c753
 
0b6961f
20c856c
0b6961f
20c856c
 
 
0b6961f
 
 
 
 
20c856c
 
0b6961f
 
20c856c
 
 
 
 
 
 
 
 
 
0b6961f
20c856c
 
 
 
 
 
 
 
 
 
 
 
 
0b6961f
20c856c
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
title: CorridorKey
emoji: 🎬
colorFrom: yellow
colorTo: yellow
sdk: gradio
sdk_version: 6.9.0
app_file: app.py
python_version: "3.10"
pinned: false
tags:
  - green-screen
  - background-removal
  - video-matting
  - alpha-matting
  - vfx
  - corridor-digital
  - transparency
  - onnx
  - pytorch
  - zerogpu
  - mcp-server
short_description: Remove green background from video, even transparent objects
---

# CorridorKey Green Screen Matting

Remove green screen backgrounds from video. Handles transparent objects (glass, water, cloth) that traditional chroma key cannot.

Based on [CorridorKey](https://github.com/nikopueringer/CorridorKey) by Corridor Digital.

## Inference Paths

- **GPU (ZeroGPU H200)**: PyTorch GreenFormer with batched inference (batch 32 at 1024, batch 8 at 2048)
- **CPU (fallback)**: ONNX Runtime sequential inference (batch 1)

## Pipeline

1. **BiRefNet** - Generates coarse foreground mask (ONNX)
2. **CorridorKey GreenFormer** - Refines alpha matte + extracts clean foreground (PyTorch on GPU, ONNX on CPU)
3. **Compositing** - Despill, despeckle, composite on new background

## API

### REST API

**Step 1: Submit request**
```bash
curl -X POST "https://luminia-corridorkey.hf.space/gradio_api/call/process_video" \
  -H "Content-Type: application/json" \
  -d '{"data": ["video.mp4", "1024", 5, "Hybrid (auto)", true, 400]}'
```

**Step 2: Get result**
```bash
curl "https://luminia-corridorkey.hf.space/gradio_api/call/process_video/{event_id}"
```

### MCP (Model Context Protocol)

**MCP Config:**
```json
{
  "mcpServers": {
    "corridorkey": {
      "url": "https://luminia-corridorkey.hf.space/gradio_api/mcp/"
    }
  }
}
```

## Credits

- [CorridorKey](https://github.com/nikopueringer/CorridorKey) by Niko Pueringer / Corridor Digital
- [EZ-CorridorKey](https://github.com/edenaion/EZ-CorridorKey) UI reference by edenaion
- [BiRefNet](https://github.com/ZhengPeng7/BiRefNet) by ZhengPeng7