# QR Code Reader

> **Deprecation Notice**
> This page describes features that have been removed or replaced in Luxonis Hub. Functionality may be limited and only available
to Hub Original customers. Please refer to the up-to-date guides to provision devices, manage fleets, and deploy applications.

## Demo

## Pipeline

## Description

The QR Code Reader app is tailored to fully utilize the IMX582 sensor (32MP = 5312x6000 pixels) integrated into the OAK-1 MAX. For
other OAK models, it should be configured to run at 4K resolution.

To maximize high resolution capabilities, the QR code detection process functions as follows for the 5312x6000 resolution variant
(the 4K variant follows a similar process with different crop sizes):

 1. Image Cropping: The high resolution image is split into nine equally sized crops (1000x1000x3), closely matching the neural
    input frame size of 512x512.
 2. QR Code Detection: Inference is run on each of the cropped sections.
 3. QR Code Cropping: For each detected QR code, a crop is made on the high resolution image.
 4. QR Code Decoding: The app decodes the QR codes from these crops.
 5. Visualization: Locally, results are visualized using OpenCV (cv2), while for Luxonis Hub deployment, results are sent as image
    events.

### Advantages

The QR Code Reader app excels at reading small QR codes that are far away or simply small, or a combination of both.

In internal tests, the app successfully detected and decoded a 1.3cm x 1.3cm QR code from 1 meter away using the OAK-1 MAX.

### Limitations

 * Frame Rate: With the 5312x6000 resolution on the OAK-1 MAX, the app runs at a maximum of 2 FPS. At 4K resolution, the app
   achieves around 3.3 FPS, corresponding to neural inference speeds of 18 FPS and 30 FPS, respectively. The QR code detection
   neural network (YOLOv8) used in this app maxes out at 30 FPS.

 * Crop Splitting: The app's speed can be increased by reducing the number of crops. Splitting the frame into 4 crops allows 7-8
   FPS, while splitting it into 2 crops permits up to 15 FPS.

 * Live View: Live View is available at 512x512 when running at the 5312x6000 resolution.

 * Autofocus: Manual focus is preferable, as autofocus is relatively slow at lower FPS rates.

## Runtime

A lot of data gets transferred from OAK to you controller (pc, laptop, etc...), it is essential to use USB3 or at least 1Gbps
ethernet.

### Local execution

Run the app locally with:

Ensure all dependencies are installed.

### Luxonis Hub Execution

The app is available in Luxonis Hub under the Luxonis Apps section as QR Code Reader.

### View source code

[View source code](https://github.com/luxonis/robothub-examples/tree/main/Luxonis%20Apps/QR%20Code%20Reader)
