Running Demo Codes

The application of QR code detection and decoding supports both Python and C++ versions. The detailed steps are as follows:

Step:

  • To run Python application:

    Enter the Python application directory, and run the demo code on VisionFive 2 Debian:

    cd /usr/share/doc/opencv-doc/examples/python/
    python3 qrcode.py --device=4
  • To run C++ application:

    Perform the following step under the user directory on VisionFive 2 Debian to run the C++ demo:

    example_cpp_qrcode --device=1
Tip: VisionFive 2 parameter device is added to the OpenCV QR code detection application to set the video device number for capturing a video stream. Normally, /dev/video1 represents the camera connected to MIPI CSI, and /dev/video4 represents the USB camera.

Result:

  • HDMI monitor displays the real-time video stream from a webcam;
  • A real-time bounding box marks the position of the QR code, and QR code decoding is initiated.
  • The decoding result like URL will be printed on the terminal where the demo code is run;
  • The real-time frame rate is displayed in the top left corner. The frame rate is approximately 5.5 fps when performing standalone recognition, and approximately 1.8 fps for recognition and decoding combined.
  • Python sample can utilize Firefox to open the website that is successfully decoded.
  • The detection speed is 4-6 fps (for locating), and the decoding speed is approximately 1.5 fps (for extracting the content of the QR code).
Figure 1. QR Code Detection and Decoding