Nodes/opencv-comfyui/OpenCV norm_3
ComfyUI Node

OpenCV norm_3

Norm_3 — identical to norm_2, the two-image distance twin

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV norm_3
  • src1
  • src2
  • mask
  • float
normType

norm_3 is the exact twin of norm_2: same src1/src2/normType inputs, same optional mask, same single float output, same cv2.norm(src1, src2) call. The _2 article has the full guide - this is the short version.

One paragraph version

cv2.norm(src1, src2, normType) measures the distance between two arrays: norm(src1 - src2). L2 (code 4) is the Euclidean distance - the default "how different" measure. L1 (code 2) is the sum of absolute differences, more forgiving of one big outlier. INF (code 1) is the single worst pixel difference. Feed it two frames and you've got a shot/scene-change detector (threshold the float); feed it an edit and its reference and you've got a drift measurement. Both inputs must match in size and dtype; the output is relative, so use it for comparisons within one pipeline, not as an absolute metric.

Why there are two

geroldmeisinger/opencv-comfyui emits one node per OpenCV overload, and cv2.norm has a MatLike and a UMat declaration that both collapse onto the pack's NPARRAY type. So norm_2 and norm_3 are functionally identical. Same pattern for norm_0/norm_1, and every other _0/_1 pair in the pack. Pick _2.

Don't cross the families, though: norm_0/norm_1 take one array and report its magnitude; norm_2/norm_3 take two and report their distance. Different signature, different job.

Installing

ComfyUI Manager → "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

restart. Dependency: opencv-contrib-python.

Troubleshooting

  • Size/dtype mismatch - match the two inputs; grayscale both (cvtColor code 6) if comparing luminance.
  • Zero for two visibly different images - check they're actually different dtype/range; a 0–1 float array vs a 0–255 uint8 array both "look" the same but differ by a factor of 255.
  • Which variant - _2.
Categoryimage/OpenCV

Inputs (4)

NameTypeDefaultDescription
src1NPARRAY
src2NPARRAY
normTypeINT
maskoptNPARRAY

Outputs (1)

NameTypeDescription
floatFLOAT