OpenCV minMaxLoc_1
MinMaxLoc_1 is minMaxLoc_0's identical twin — pick the _0, here's why they both exist
- src
- mask
- float_0
- float_1
- literal_2
- literal_3
Short version: minMaxLoc_1 is a byte-for-byte identical wrapper to minMaxLoc_0. Same src + optional mask inputs, same four outputs (min value, max value, min location, max location as a string literal). Use whichever your workflow loads with; the result is the same. This article is mostly the story of why there are two of them - because it explains a lot about this whole pack.
Where the duplicate came from
geroldmeisinger/opencv-comfyui is auto-generated. The author parses OpenCV's type stubs (cv2/__init__.pyi) and emits one node per overload it finds. cv2.minMaxLoc is declared twice in the stubs - once for MatLike, once for UMat - so the generator emitted minMaxLoc_0 and minMaxLoc_1. But the generator maps both array types to the same NPARRAY slot, so the two wrappers collapse into the same node. The _0/_1 numbering is leftover from parsing, not a meaningful difference.
You'll see the same pattern all over the pack: moments_0/_1, morphologyEx_0/_1, multiply_0/_1, normalize_0/_1, and so on. The exception is norm, where _0/_1 and _2/_3 have different signatures (one array vs. two). When the inputs in the info_schema are identical, treat the variants as the same node.
What it actually does
cv2.minMaxLoc(src, mask) scans a single-channel array and returns the global minimum value, maximum value, and both locations. In a ComfyUI context: read the value range of a mask/depth map before normalizing, locate the brightest pixel of a heatmap, sanity-check that a segmentation mask isn't empty (a mask of all zeros gives min=max=0). The two location outputs are STRING literals like (3, 5) because Point is a composite type - parse them if you need real coordinates.
Requires grayscale input - a 3-channel array throws error: (-215:Assertion failed) img.type() == CV_8UC1. Grayscale with cvtColor code 6 first.
Installing
Manager, search "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
Restart. Dependency is opencv-contrib-python; you almost certainly already have OpenCV installed.
The pipeline
IMAGE → Image2Nparray → minMaxLoc_1 → .... Image2Nparray converts RGB→BGR and only accepts batch_size==1 (slice batches with ImageFromBatch). This node's outputs are floats and strings, not images - they don't go through Nparrays2Image.
Troubleshooting
CV_8UC1assertion - grayscale input required; usecvtColorcode 6.'NoneType' object has no attribute 'shape'- you fed a non-image output intoNparrays2Image; the float/string outputs here are exactly that kind of non-image.- "Which one do I use?" -
_0. It genuinely does not matter, but pick_0so your workflow matches the docs you'll find online.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| maskopt | NPARRAY | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| float_0 | FLOAT | — |
| float_1 | FLOAT | — |
| literal_2 | STRING | — |
| literal_3 | STRING | — |