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).
- image
- found
- qr_count
- text
- bboxes
- corners
- connections
- texts
- labels
- straight_codes
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | NPARRAY,IMAGE | Image 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. | |
| detector | COMBO | classic: 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. | |
| mode | COMBO | multi: 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_xopt | FLOAT | 0.200–1 | Classic 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_yopt | FLOAT | 0.100–1 | Classic detector only: the same tolerance for the VERTICAL scan of the finder pattern. |
| use_alignment_markersopt | BOOLEAN | true | Classic 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)
| Name | Type | Description |
|---|---|---|
| found | BOOLEAN | True 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_count | INT | Number of QR codes located. |
| text | STRING | Every decoded string, one per line - wire into the core 'Preview as Text' (PreviewAny) node. Empty when nothing decoded. |
| bboxes | BOUNDING_BOX | One {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. |
| corners | NPARRAY | (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. |
| connections | NPARRAY | (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). |
| texts | NPARRAY | (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. |
| labels | NPARRAY | (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_codes | IMAGE | IMAGE 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. |