Nodes/comfyui_cv/CV Cascade Detect
ComfyUI Node

CV Cascade Detect

The classic Viola-Jones detector (cv2.CascadeClassifier): a cascade of boosted Haar or LBP stages that rejects non-objects in a few operations and only spends real work on promising windows. It needs no GPU and no ONNX runtime, which is why it still matters - and it is the historical counterpart to the pack's neural detectors ('CV YuNet Face Detect' is far more accurate on faces; compare them side by side). Trained cascades are XML files in ComfyUI/models/cascades; OpenCV 5 no longer ships any, so download them from the opencv 4.x branch (data/haarcascades, data/lbpcascades) - they still load here. Data only: feed 'bboxes' to the core 'Draw BBoxes'. Zero detections is a valid result (found=false), never an error.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Cascade Detect
  • image
  • found
  • bboxes
  • boxes
  • centers
  • scores
  • count
cascade
scale_factor1.10
min_neighbors5
min_size30
max_size0
equalize_histtrue
min_confidence0.0
Categoryimage/CV/ml

Inputs (8)

NameTypeDefaultDescription
imageNPARRAY,IMAGEImage to search. An IMAGE batch uses its first frame; converted to grayscale internally. 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.
cascadeCOMBOCascade XML from ComfyUI/models/cascades (haarcascade_frontalface_default.xml, haarcascade_eye.xml, lbpcascade_* ...). Each file detects exactly ONE object class.
scale_factorFLOAT1.101.01–2How much the search window grows between pyramid levels. 1.1 = 10% per step: smaller finds more objects at more sizes and is much slower; 1.3+ is fast and misses objects between steps.
min_neighborsINT50–100How many overlapping detections a window must collect to be kept. This is the precision knob: raise it to kill false positives, lower it if real objects are missed.
min_sizeINT300–10000Ignore objects smaller than this many pixels on a side. 0 = no lower limit (much slower on big images).
max_sizeINT00–10000Ignore objects larger than this many pixels on a side. 0 = no upper limit.
equalize_histoptBOOLEANtrueRun cv2.equalizeHist first. Haar cascades were trained on equalized crops, so this is the standard pre-processing and usually helps on dim or unevenly-lit photos.
min_confidenceoptFLOAT0.00–1000Drop detections whose stage weight (the cascade's own confidence, from detectMultiScale3) is below this. 0 keeps everything - raise it to rank and trim without touching min_neighbors.

Outputs (6)

NameTypeDescription
foundBOOLEANTrue when at least one object was detected - branch on it with 'Basic data handling: IfElse'.
bboxesBOUNDING_BOXOne {x, y, width, height, score, label} dict per detection (score = the cascade's stage weight) - feed the core 'Draw BBoxes' node.
boxesNPARRAYNx4 int32 (x, y, w, h) - the same detections as a raw array, e.g. to seed 'CV Track Window'.
centersNPARRAYNx2 float32 detection centres - feed 'CV Draw Points' or an 'CV Kalman Filter Step'.
scoresNPARRAY(N,) float32 stage weights: how strongly the cascade voted for each detection. Higher = more confident.
countINTHow many objects were detected; 0 is valid, not an error.