Nodes/comfyui_cv/CV QR Detect
ComfyUI Node

CV QR Detect

Detects and decodes every QR code in an image with OpenCV's built-in detector - no model files, unlike 'CV WeChat QR Detect' (cv2.dnn). Two detectors: the classic scanline one (finder-pattern scan, tunable eps_x/eps_y, alignment-marker refinement) and the ArUco-based one, which is usually better on small, rotated or perspective-distorted codes. 'curved' mode runs detectAndDecodeCurved for a SINGLE code wrapped around a cylinder/bottle (classic detector only). Outputs are DATA only: feed 'bboxes' to the core 'Draw BBoxes' node, 'corners' + 'connections' to 'OpenCV Draw Connections' for the exact quad, 'corners' + 'labels' to 'CV Draw Labels' for the text, 'text' to 'Preview as Text', and 'straight_codes' to 'Preview Image' to see the rectified binarized symbols. Zero codes is a valid result (empty outputs, found=false). A code that is located but unreadable comes out with a quad and an EMPTY string. Codes written in Structured Append mode decode into one joined message on the first part, the rest blank. Processes a single image (the first frame of a batch).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV QR Detect
  • image
  • found
  • qr_count
  • text
  • bboxes
  • corners
  • connections
  • texts
  • labels
  • straight_codes
detector
mode
eps_x0.20
eps_y0.10
use_alignment_markerstrue
Categoryimage/CV/codes

Inputs (6)

NameTypeDefaultDescription
imageNPARRAY,IMAGEImage to scan. An IMAGE batch uses its first frame; an NPARRAY (gray/BGR, any dtype) is treated as one 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.
detectorCOMBOclassic: cv2.QRCodeDetector, the scanline finder-pattern detector (honours eps_x/eps_y and use_alignment_markers). ArUco-based: cv2.QRCodeDetectorAruco, which reuses the ArUco marker machinery - more robust on small, rotated or warped codes, and ignores the classic knobs.
modeCOMBOmulti: detectAndDecodeMulti - every code in the image (the normal choice). curved: detectAndDecodeCurved - ONE code on a curved surface, rectified before decoding; classic detector only, and it fails on some flat codes, so only use it for genuinely curved ones.
eps_xoptFLOAT0.200–1Classic detector only: tolerance of the HORIZONTAL scan for the 1:1:3:1:1 finder-pattern ratio. Raise it for blurry/low-contrast codes, lower it to reject false finders.
eps_yoptFLOAT0.100–1Classic detector only: the same tolerance for the VERTICAL scan of the finder pattern.
use_alignment_markersoptBOOLEANtrueClassic detector only: refine the corner positions with the code's alignment markers (OpenCV's default). Turning it off is faster and can help on damaged codes whose markers are unreliable.

Outputs (9)

NameTypeDescription
foundBOOLEANTrue when at least one code was located. Feed a 'Basic data handling: IfElse' to branch instead of gating a node with a boolean widget.
qr_countINTNumber of QR codes located.
textSTRINGEvery decoded string, one per line - wire into the core 'Preview as Text' (PreviewAny) node. Empty when nothing decoded.
bboxesBOUNDING_BOXOne {x, y, width, height, score, label} dict per code (axis-aligned box around its 4 corners, label = decoded text) - feed the core 'Draw BBoxes' node.
cornersNPARRAY(N*4, 2) float32: the 4 corner points of every code, in order. Feed 'CV Draw Points', or 'CV Draw Connections'/'Draw Labels' together with the matching outputs. Empty (0, 2) when no codes.
connectionsNPARRAY(N*4, 2) int32 edge index-pairs closing each code's quad, indexed into 'corners' - feed 'CV Draw Connections' to outline the codes exactly (unlike the axis-aligned bboxes).
textsNPARRAY(N,) string array of the decoded payloads, one per code - inspect with 'Inspect CV Data' + 'Preview as Text'. An empty entry means the code was located but not decoded.
labelsNPARRAY(N*4,) string array aligned row-for-row with 'corners': each code's text on its FIRST corner, blank on the other three. Feed 'corners' + this to 'CV Draw Labels' to write the text once per code.
straight_codesIMAGEIMAGE batch of the rectified, binarized symbols (one per decoded code, perspective removed) - the picture the decoder actually read. Frames of differing versions are white-padded to a common size. Empty batch when nothing decoded.