QR Code 스캔 작동 원리: 카메라부터 데이터까지

<\/script>\n
'; }, get iframeSnippet() { const domain = 'qrcodefyi.com'; const type = 'guide'; const slug = 'how-scanning-works'; return ''; }, get activeSnippet() { return this.method === 'script' ? this.scriptSnippet : this.iframeSnippet; }, copySnippet() { navigator.clipboard.writeText(this.activeSnippet).then(() => { this.copied = true; setTimeout(() => { this.copied = false; }, 2000); }); } }" @keydown.escape.window="open = false" @click.outside="open = false">

Embed This Widget

Theme


      
    

Widget powered by . Free, no account required.

The complete decoding pipeline: image capture, binarisation, finder detection, format reading, unmasking, error correction, and data extraction.

How QR Code Scanning Works: From Camera to Data

When you point your smartphone at a QR code, a sophisticated pipeline transforms a camera image into decoded data in milliseconds. Understanding this process helps explain why some QR codes fail to scan and how to design codes that decode reliably.

Step 1: Image Capture and Binarisation

The camera captures a colour or greyscale image. The scanner software converts this to a binary (black/white) image using adaptive thresholding — comparing each pixel to its local neighbourhood rather than a single global threshold. This handles uneven lighting, shadows, and gradients.

Step 2: Finder Pattern Detection

The scanner searches for the distinctive finder patterns — the three large squares with the 1:1:3:1:1 module ratio. By scanning horizontal and vertical lines across the image, the decoder identifies candidate patterns and verifies them. Three valid finder patterns in the correct geometric relationship confirm a QR code is present.

Step 3: Orientation and Perspective Correction

Using the positions of the three finder patterns, the scanner determines the QR code's rotation and perspective distortion. For larger versions, alignment patterns provide additional reference points for correcting geometric warping — especially important when scanning codes on curved surfaces.

Step 4: Grid Sampling

The timing patterns establish the exact module grid. The scanner samples each module position to determine if it represents a black (1) or white (0) bit. This step is sensitive to print quality, contrast, and module size.

Step 5: Format and Version Reading

The scanner reads the format information to determine the error correction level and mask pattern. For versions 7+, the version-information/" class="glossary-term-link" data-term="version information" data-definition="18-bit version identifier for QR codes version 7+." data-category="QR Code Structure">version information is also extracted.

Step 6: Unmasking

The mask pattern identified in Step 5 is XORed with the data area to reverse the masking applied during encoding. Masking prevents problematic patterns that could confuse scanners.

Step 7: Error Correction

The decoder applies Reed-Solomon error correction to detect and fix corrupted codewords. If the number of errors exceeds the correction capacity of the chosen EC level, decoding fails.

Step 8: Data Extraction

Finally, the corrected data stream is parsed according to the encoding mode indicators. The decoder reads mode markers, character counts, and data segments to reconstruct the original payload — a URL, WiFi credentials, contact card, or other content.

Key Takeaways

  • The full decode pipeline: capture, binarise, find, orient, sample, unmask, correct, extract
  • Finder patterns enable detection from any orientation
  • Adaptive thresholding handles uneven lighting conditions
  • Error correction fixes damaged modules during decoding
  • The entire process typically completes in under 100 milliseconds