Read here about the guidelines for suitable barcodes and recommendations for their use.
Barcodes are notably different from Image Targets and are much smaller which affects the conditions for successful detection and tracking.
Choose Suitable Barcodes
If you are printing your own barcodes and placing them, please take the following considerations into account:
- Code density and detection distance: The more data a code contains, the higher the density of bits in the code becomes at a given physical size, which in turn reduces the maximum distance the code can be detected from. If distance is a concern, try to fit in less data, e.g., by shortening URLs used as payloads. Also note that for some codes, such as QR Codes, the data density is a design factor that can be chosen to some extent, trading off detection distance against data capacity or error correction capabilities.
- Type-specific guidelines: Different code types come with their own requirements of how they are placed and printed, including mandatory quiet zones around the code. For optimal performance, these guidelines should be respected.
UX Recommendations
Scanning reticles
During barcode scanning, we recommend showing a reticle, such as a frame to indicate to users that barcode scanning is active.
Scanning of 1-dimensional barcodes works most reliably if the barcode is either horizontally or vertically aligned with the camera image. If the primary scanning targets are 1D barcodes, we also recommend showing a horizontal scanline on the screen to help users align it correctly.
See the Barcode Scene in the Unity Core samples for an example implementation of 1D and 2D scanning reticles.
- Scanning reticle for 1D and 2D codes that allow selection by pointing (see the Pointing bullet in the next section).
- Scanning reticle for 1D barcodes that encourages horizontal alignment for improved recognition.
Single vs. Multiple Barcode Detection
The Barcode Scanner can be configured to run in two different modes:
- Single barcode detection where one barcode detection is active at a time.
- Multiple barcode detection where one or more barcode detections are active simultaneously.
For situations where only a single barcode is expected to be visible in the camera image, using the Single Barcode detection mode reduces CPU and power consumption. When multiple codes are visible, the code closest to the center of the camera view is in most cases the one reported.
If you expect multiple codes to be visible simultaneously, please use the Multiple Barcode detection mode. Since this will potentially produce more than one detection result, a selection mechanism is required to choose the right code automatically or manually. Possible solutions are:
- Automatic filtering by format and type: If you are looking for a barcode with a payload that has a unique format, regular expressions or similar mechanisms can be used to filter out unwanted detections. If possible, you should also configure the Barcode Scanner to detect only expected barcode types.
- Pointing: By showing a pointer or crosshair at a fixed location close to the center of the screen, you can guide users to point at the right barcode by moving the device. In many cases, this type of selection is most convenient and allows for one-handed interaction on mobile phones. For the most reliable selection, put the Barcode Scanner into Multiple Barcode detection mode and programmatically choose the code closest to the pointer.
The Barcode Scene in the Unity Core samples demonstrates this type of interaction. - Tapping: In this mode, the outlines of all detected codes are drawn on the screen and the user chooses the desired code by tapping on the screen. While this may be more intuitive to some users, it is less convenient to hold the device stable with one hand while tapping with the other.
Camera Exposure
Since barcodes are in most cases shown on white backgrounds, they tend to be brighter than the environment. If the barcode only covers a small portion of the image in an otherwise dark area, there is a risk that the camera exposure optimizes for the whole the image and the barcode becomes overexposed. This may not even be noticed by the user on optical see-through digital eyewear, where the camera image is never shown. Therefore, the contrast of the barcode should be adjusted to the environment wherever possible. – This is particularly important when showing barcodes on a handheld device’s screen.
To avoid overexposure on the barcode, choose a bright background as the barcode background to encourage the camera to reduce the exposure; this provides a better condition for detecting the barcode.
Barcode vs VuMark
VuMarks are an evolved type of barcodes and QR codes that lets you embed data as type string, bytes, or numeric numbers together with a graphic background such as logos and icons that improve detection and tracking. Generating and retrieving VuMarks can also be done with Vuforia’s web API.
Another difference is that VuMarks are optimized for 6DoF (degrees of freedom) allowing you to add content in world coordinates whereas the Barcode Scanning is limited to 2D coordinates.