Nodes/opencv-comfyui/OpenCV LUT_1
ComfyUI Node

OpenCV LUT_1

OpenCV LUT_1 — the duplicate lookup-table node, and how to actually feed it a LUT

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV LUT_1
  • src
  • lut
  • dst
  • nparray

LUT_1 is the twin of LUT_0: same cv2.LUT call, same inputs, same output. The pack generates _0/_1 duplicates for every function because OpenCV's stubs declare each one for regular matrices and for OpenCL UMat images, and the generator numbered the overloads. Neither is "better" - they're the same door. Pick the closer one.

What you'd use it for: lookup-table color grading. You give it a table that maps every possible pixel value to a new value, and it recolors the image in one pass. This is how film emulation, contrast curves, and stylized color palettes get applied in a deterministic, zero-model-cost way. It's the same operation your camera's "picture style" or a pro colorist's LUT file performs.

The inputs, and the one that hurts

  • src - NPARRAY in, via Image2Nparray. Back to an image via Nparrays2Image.
  • lut - an NPARRAY lookup table, 256 entries for an 8-bit image. This is the friction point. There's no curve editor in the pack - the README's own todo list includes "widgets for composite types" as future work. So your options are: build the table with a numpy-capable custom node, load one from a node that emits NPARRAY, or skip the pack for this job and use a dedicated LUT/color-grading pack that ships a friendlier UI. Being honest about that saves you an afternoon.
  • dst - optional out-parameter. Leave it. Result is on the nparray output.

The LUT applies to 8-bit values, which matches what Image2Nparray produces (uint8), so the range story is fine for normal images.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python

Restart, or ComfyUI Manager → "opencv". Dependencies: opencv-contrib-python, numpy, torch. No model downloads.

Troubleshooting

  • "I can't build a lut in the UI" - correct, and it's the pack's known gap. Either bring an array source or use a dedicated grading pack.
  • Output looks wrong / colors shifted - remember nparrays are BGR. If you hand-built a table expecting RGB ordering, the grade will be off; Nparrays2Image flips back to RGB on the way out.
  • Batch error - batch_size==1 only; slice with ImageFromBatch.

Bottom line: the mechanism is excellent and instant - LUT grading is a legitimate, powerful post step, and this pack implements it faithfully. The missing piece is purely ergonomic: you need an array source to feed lut. If that's not a blocker for you, LUT_0/LUT_1 are a real color-grading tool.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
lutNPARRAY
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY