OpenCV borderInterpolate_0
The OpenCV helper node you'll almost certainly never use
- int
Let's be straight with each other: OpenCV borderInterpolate_0 is not a node you're going to build a workflow around. It's a low-level helper from deep inside OpenCV's image filtering machinery, and the fact that it exists as a ComfyUI node is a side effect of the way this pack was built - the author auto-generated a node for essentially every top-level standalone cv2 function, including the internal utilities that were never meant to face users. The README warns "expect dragons"; this is one of the dragons, and it's a small one.
What it does, mechanically: cv2.borderInterpolate(p, len, borderType) answers a single question - "if I'm reading a pixel at coordinate p and the border mode wants me to extend past the edge of a row of length len, which coordinate should I actually read?" It's the math behind the BORDER_REFLECT, BORDER_WRAP and friends that every filter node uses under the hood. In other words, it's the rule that border modes follow, exposed as a function.
The node takes three INTs and hands back one INT:
- p - the (possibly out-of-range) coordinate you want.
- len - the length of the border in that direction.
- borderType - the border mode constant (0 = CONSTANT, 1 = REPLICATE, 2 = REFLECT, 3 = WRAP, 4 = DEFAULT...).
Output: a single int - the real, in-range coordinate you should sample instead.
So when is it useful? If you're doing your own array gymnastics in a ComfyUI pipeline - computing, say, what coordinate a reflected index maps to so you can slice an array yourself - this node does that computation deterministically without you reimplementing border logic. That's a genuinely narrow niche, and for it to matter you have to be doing the kind of low-level numpy-style work that ComfyUI normally hides from you. For everyone else: this is a node whose entire value is "it exists, and now you know what the name means when you see it in a pack listing."
Install and usage
Standard for the pack: ComfyUI Manager → opencv-comfyui, or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes and restart. Requires opencv-contrib-python. No NPARRAY in or out here - it's pure integers, which actually makes this one of the few nodes in the pack that doesn't care about the BGR/batch-size conventions. It just computes a number.
That's the whole story. There's no deeper gotcha to warn you about because there's no real workflow trap - the trap is reaching for it expecting image output and getting an integer, which the node's int output makes obvious. Bookmark it if you like completeness; you'll likely never wire it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| p | INT | — | |
| len | INT | — | |
| borderType | INT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int | INT | — |