OpenCV cvtColorTwoPlane_0
For When Your Image Comes in Two Stacked Planes
- src1
- src2
- dst
- nparray
OpenCV cvtColorTwoPlane_0 is the specialized cousin of cvtColor. Where the normal cvtColor converts a single image between color spaces, this one converts a two-plane (semi-planar) format like NV12 into a full color image - which means it takes two nparrays: a luma plane and a chroma plane.
It's from geroldmeisinger/opencv-comfyui, the auto-generated pack wrapping ~635 cv2 functions. As always here: it's a raw wrapper (cv2.cvtColorTwoPlane(src1, src2, code, dst, hint)), it's numbered because the generator made one node per overload, and the README's expect dragons warning applies.
When you'd actually need this
Almost never in a normal txt2img/img2img workflow. Two-plane YUV formats are what raw camera pipelines and hardware video decoders hand you - NV12 stores all the luma (Y) in one plane and interleaved U/V chroma in a second plane, and it's the default byte layout for most webcam and capture hardware. If you're pulling camera frames into ComfyUI (a live cam → ControlNet pipeline, for instance), your frames may arrive as YUV in this shape before anyone converts them to BGR. That's the gap cvtColorTwoPlane_0 fills: two nparrays in, one BGR image out, no intermediate step.
The rest of us can read this article and close the tab - cvtColor with the right code handles every single-plane conversion you'll touch.
Inputs and outputs
src1(NPARRAY) - the luma plane (Y).src2(NPARRAY) - the chroma plane (UV for NV12).code(INT) - the conversion enum;cv2.COLOR_YUV2BGR_NV12and friends. Unlike the friendly small numbers ofcvtColor(6, 8), these are large enum values you'll want to look up in the OpenCV docs.hint(INT) - conversion hint,0to keep it simple.dst(NPARRAY, optional) - out-parameter; skip it.nparray(NPARRAY, output) - the converted image.
Install
ComfyUI Manager (search opencv-comfyui) or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart ComfyUI. No models. Remember opencv-contrib-python is the correct package name, not the README's opencv-python-contrib.
Gotchas
The two-plane formats assume very specific shapes - chroma is typically half the luma resolution - so if your planes don't line up, you'll get assertion errors rather than a helpful message. Also keep the pack-wide rules in mind: only batch_size==1 images, and both planes need to be proper nparrays on the OpenCV side of the Image2Nparray bridge. And since cvtColorTwoPlane_0 and _1 are the usual MatLike/UMat overload twins, grab whichever; they're interchangeable.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src1 | NPARRAY | — | |
| src2 | NPARRAY | — | |
| code | INT | — | |
| hint | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |