OpenCV norm_1
Norm_1 — identical to norm_0, the single-array norm twin
- src1
- mask
- float
norm_1 is the identical twin of norm_0: same src1 + normType inputs, same optional mask, same single float output, same cv2.norm call. The _0 article has the full guide to the norm types (L1 = 2, L2 = 4, INF = 1, L2SQR = 5) and the practical uses. This article is the short version, because there's nothing new here except the numbering.
One paragraph version
cv2.norm(src1, normType) reduces an array to a scalar describing its magnitude. L2 (code 4) is the "energy"; L1 (code 2) is the sum of absolute values, more robust to outliers; INF (code 1) is just the biggest single element. Practical uses: verify a gradient map isn't flat, measure how much signal a feature map contains, or gate downstream processing on "is this array empty-ish or dense?" The output is a float - wire it anywhere a scalar makes sense, and don't feed it into Nparrays2Image.
Why there are two
geroldmeisinger/opencv-comfyui auto-generates one node per OpenCV overload, and cv2.norm is declared for both MatLike and UMat. Both map to the pack's NPARRAY type, so norm_0 and norm_1 are functionally identical. Pick _0.
(One genuinely different pair: norm_2/norm_3 take a second array and measure the distance between two arrays - different signature, different job. Don't confuse the two families.)
Installing
ComfyUI Manager → "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
restart. Dependency: opencv-contrib-python.
Troubleshooting
- Zero when you expected a large number - check
normType; INF reports only the max element, not total energy. - Wrong input type -
src1must be anNPARRAY(fromImage2Nparrayor another OpenCV node), not a raw ComfyIMAGE. - Which variant -
_0.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| src1 | NPARRAY | — | |
| normType | INT | — | |
| maskopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |