Nodes/comfyui_cv/CV HOG Features
ComfyUI Node

CV HOG Features

Histogram-of-Oriented-Gradients descriptor per frame (cv2.HOGDescriptor): each input frame is grayscaled, resized to win_size x win_size and reduced to one fixed-length gradient-orientation feature row - the classic hand-crafted descriptor for training a shape/digit classifier ('CV Train Classifier'). The defaults (win 20, cell 10, block 10, stride 5, 9 bins) give the 81-dim descriptor of OpenCV's digits.py tutorial. Geometry rules (raised as errors, they are configuration mistakes): win_size and block_size must be multiples of cell_size, and (win_size - block_size) must be a multiple of block_stride. An empty IMAGE batch yields an empty (0, D) array.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV HOG Features
  • image
  • features
  • dims
  • count
win_size20
cell_size10
block_size10
block_stride5
nbins9
Categoryimage/CV/ml

Inputs (6)

NameTypeDefaultDescription
imageNPARRAY,IMAGEFrames to describe: an IMAGE batch gives one feature row per frame; an NPARRAY (gray/BGR/BGRA) is a single frame. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
win_sizeINT208–512Square window size in px - every frame is resized to this before computing. Bigger keeps more detail but grows the descriptor.
cell_sizeINT102–256Histogram cell size in px. win_size and block_size must be multiples of it.
block_sizeINT102–256Normalization block size in px (a multiple of cell_size, at most win_size).
block_strideINT51–256Block step in px; (win_size - block_size) must be a multiple of it.
nbinsINT92–32Orientation bins per histogram (9 is the standard).

Outputs (3)

NameTypeDescription
featuresNPARRAY(N, D) float32, one HOG row per frame - feeds 'CV Train Classifier' or 'CV Stack Feature Classes'.
dimsINTDescriptor length D (81 with the defaults).
countINTFrames described.