OpenCV log_1
OpenCV log_1 — the other natural-log node, and the story behind the duplicate
- src
- dst
- nparray
log_1 is the twin of log_0 - literally the same cv2.log call with the same two inputs and the same nparray output. The only interesting thing about the _1 suffix is why it exists, and once you know that, every _0/_1 node in this pack stops being mysterious.
OpenCV's Python type stubs list every function twice: once for regular MatLike arrays and once for OpenCL-accelerated UMat arrays. This pack's generator walks those stubs and numbers the overloads it finds. log_0 is the MatLike overload, log_1 is the UMat overload - and since neither overload survived translation into ComfyUI with any difference, you get two identical nodes. There's no performance distinction here (no UMat/GPU path is actually wired up, the author confirmed - the pack runs on nparrays on the CPU).
So, the function
Element-wise natural log. Every pixel becomes ln(pixel). Two practical consequences:
- Dynamic-range compression. The log curve squeezes the bright end and expands the dark end. This is the classic stretch for overexposed or high-dynamic-range content - feed a blown-out frame through and the highlight detail stops being a wall of white.
- Float output.
cv2.logreturns float32 values, andln(255)is only ~5.5, so a raw preview looks nearly black. You must normalize (scale and shift) before the result reads as an image. This trips up everyone who wires it straight into a preview and sees nothing.
Inputs are just src (NPARRAY) and an optional dst out-parameter - leave dst alone; the result is on the nparray output.
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.
Troubleshooting
- "Where's my image?" - normalize the float output first (a stretch-to-range node, or
normalize_0from this pack). 'NoneType' object has no attribute 'shape'- the README flags this: some nparrays in this pack aren't displayable images without further processing. Log output is exactly that case.- Batch error -
batch_size==1only; useImageFromBatch.
Honestly, log_1 is a one-trick node for a specific problem (compressing bright dynamic range in a float pipeline). If that's your problem, use either twin. If it's not, keep walking - the pack wraps 600+ cv2 functions and most of them you'll never need.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |