Nodes/comfyui_cv/CV Array Statistic
ComfyUI Node

CV Array Statistic

Reduces a whole array to ONE value per channel (median, mean, min, max or std), returning a 1-D NPARRAY you can broadcast straight into cv2 arithmetic (subtract, compare, add...) - the same shape 'CV Scalar' emits. The MEDIAN is the robust estimate of a field's DOMINANT value: e.g. the background / camera motion of an optical-flow field, which the median recovers even when a moving object contaminates a large minority of pixels (the mean gets dragged toward it). Subtract it from the field and threshold the residual to segment whatever moves differently. NaN/Inf are ignored.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Array Statistic
  • nparray
  • value
  • text
statisticmedian (robust dominant value)
Categoryimage/CV/low-level

Inputs (2)

NameTypeDefaultDescription
nparrayNPARRAY2-D [H,W] or 3-D [H,W,C] array to reduce (e.g. an optical-flow field HxWx2).
statisticCOMBOmedian (robust dominant value)Reduction applied over every pixel, per channel. Median = the dominant value (robust to outliers); mean = the average (sensitive to them); std = the spread.

Outputs (2)

NameTypeDescription
valueNPARRAY1-D float64, one element per input channel - broadcastable into cv2.subtract / compare / add like 'CV Scalar'.
textSTRINGThe value(s) as a readable '(a, b, ...)' string - wire into core 'Preview as Text' (PreviewAny) to display.