This example shows how to use the From Video Device block provided by Image Acquisition Toolbox™ to acquire live image data from a Point Grey Flea® 2 camera into Simulink®. The example uses the Computer Vision Toolbox™ to create an image processing system which can recognize and interpret a GTIN-13 barcode. The GTIN-13 barcode, formally known as EAN-13, is an international barcode standard. It is a superset of the widely used UPC standard.
Image Acquisition Toolbox™ provides functions for acquiring images and video directly into MATLAB® and Simulink from PC-compatible imaging hardware. You can detect hardware automatically, configure hardware properties, preview an acquisition, and acquire images and video.
This example requires Image Acquisition Toolbox and a Point Grey Flea® 2 camera to run the model.
Watch barcode recognition on live video stream. (11 seconds)
The following figure shows the example model using the From Video Device block.
This example uses the same algorithm as the Barcode Recognition example. Refer to the Barcode Recognition example for detailed information.
The scan lines that have been used to detect barcodes are displayed in red. When a GTIN-13 is correctly recognized and verified, the code is displayed at the top of the image.
Even though a Point Grey Flea® 2 camera was used for this example, you can update this model to use other supported image acquisition devices, for example, webcams. This enables you to use the same Simulink model with different image acquisition hardware. Before using this example, please adjust the focus of your imaging device such that the barcodes are legible.
Example using live video acquisition: viplivebarcoderecognition_win.slx (Windows® only)
Example using stored video data: vipbarcoderecognition.slx (platform independent)