ComfyUI Node
CV Mosaic (RGB -> Bayer CFA)
Mosaics a 3-channel RGB image down to a single-channel Bayer Colour-Filter-Array (CFA): at each pixel it keeps only the ONE channel that a real Bayer sensor would sample there, following a 2x2 pattern. This is the inverse of cv2.demosaicing - use it to build a synthetic CFA from a ground-truth RGB (no licence-safe RAW Bayer sample exists), then demosaic it back and score the reconstruction (PSNR / absdiff) to see the zipper / moire artifacts each algorithm leaves. The pattern names the top-left 2x2 layout (RGGB = Red at (0,0)); feed the result into a cv2.demosaicing node whose code is COLOR_Bayer<pattern>2RGB(_VNG/_EA).
CV Mosaic (RGB -> Bayer CFA)
- nparray
- cfa
◄patternRGGB►
Categoryimage/CV/low-level
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| nparray | NPARRAY | RGB image [H,W,3] (channel 0 = R). Use 'Image -> CV Array' in RGB mode to produce it. A single-channel input is treated as already-mosaiced and passed through unchanged. | |
| pattern | COMBO | RGGB | CFA layout of the top-left 2x2 block. RGGB = R at (0,0), G at (0,1) and (1,0), B at (1,1) - the most common sensor. Must match the demosaicing code downstream (COLOR_Bayer<pattern>2RGB...). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cfa | NPARRAY | Single-channel [H,W] CFA (same dtype as the input) - one colour sample per pixel. Feed it into cv2.demosaicing. |