{"id":21802463,"url":"https://github.com/qengineering/qr_scanner_raspberry_pi","last_synced_at":"2025-10-17T05:43:29.515Z","repository":{"id":112947756,"uuid":"485799308","full_name":"Qengineering/QR_scanner_Raspberry_Pi","owner":"Qengineering","description":"QR and barcode scanner for the Raspberry Pi","archived":false,"fork":false,"pushed_at":"2022-05-02T13:22:04.000Z","size":41,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T18:55:22.213Z","etag":null,"topics":["aarch64","barcode","barcode-scanner","bullseye","buster","gstreamer","libcamera","opencv","qrcode","qrcode-scanner","raspberry-pi","raspberry-pi-3","raspberry-pi-4","raspberry-pi-64-os"],"latest_commit_sha":null,"homepage":"https://qengineering.eu/computer-vision-with-raspberry-pi-and-alternatives.html","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Qengineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-04-26T13:31:14.000Z","updated_at":"2025-03-07T04:20:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e4e2ac3-1694-4905-83a9-636615c3c14d","html_url":"https://github.com/Qengineering/QR_scanner_Raspberry_Pi","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"c03e913bf86aa52968e5b218baa11b1ea597874b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Qengineering/QR_scanner_Raspberry_Pi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qengineering%2FQR_scanner_Raspberry_Pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qengineering%2FQR_scanner_Raspberry_Pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qengineering%2FQR_scanner_Raspberry_Pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qengineering%2FQR_scanner_Raspberry_Pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qengineering","download_url":"https://codeload.github.com/Qengineering/QR_scanner_Raspberry_Pi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qengineering%2FQR_scanner_Raspberry_Pi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270254720,"owners_count":24553079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aarch64","barcode","barcode-scanner","bullseye","buster","gstreamer","libcamera","opencv","qrcode","qrcode-scanner","raspberry-pi","raspberry-pi-3","raspberry-pi-4","raspberry-pi-64-os"],"created_at":"2024-11-27T11:28:52.486Z","updated_at":"2025-10-17T05:43:29.418Z","avatar_url":"https://github.com/Qengineering.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QR scanner Raspberry Pi\n![output image]( https://qengineering.eu/images/QR.webp )\n## QR and barcode scanner for the Raspberry Pi 3 and 4 (32 and 64 bit OS). \u003cbr/\u003e\n[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\u003cbr/\u003e\u003cbr/\u003e\nSpecial made for a bare Raspberry Pi see : [Q-engineering computer vision](https://qengineering.eu/computer-vision-with-raspberry-pi-and-alternatives.html).\n\n\n------------\n\n## Benchmark.\n| Operating system | FPS | CPU load |\n| ------------- | :-----: | :-----: | \n| Bullseye 64-bit LCCV | 13.5 | 34% |\n| Bullseye 64-bit | 12.0 | 46% |\n| Bullseye 32-bit | 10.0 | 40% |\n| Buster 64-bit | 8.7 | 34% |\n| Buster 32-bit | 8.0 | 32% |\n\nAll versions work with GStreamer due to its very low latency.\u003cbr/\u003e\nThere is also a Bullseye 64-bit version that works with our [LCCV](https://github.com/Qengineering/LCCV).\u003cbr/\u003e\nIt outperforms GStreamer in terms of FPS and CPU load.\n\n------------\n\n## Dependencies.\nTo run the application, you have to:\n- A raspberry Pi 4 with a 32 or 64-bit operating system. It may have a Buster (Debian 10) or Bullseye (Debian 11) operating system. \u003cbr/\u003e\n- ZBar installed.\n- OpenCV installed. [Install OpenCV 4.5](https://qengineering.eu/install-opencv-4.5-on-raspberry-64-os.html) \u003cbr/\u003e\n- A working Raspicam.\n\n------------\n\n## Installing ZBar.\nYou have to install ZBar first. It is a perfect library for scanning QR and barcodes. Much better and faster than the comparable OpenCV module. \n```\n$ sudo apt install autopoint build-essential libv4l-dev libtool\n$ git clone -b 0.23.92 https://github.com/mchehab/zbar.git\n$ cd zbar\n$ autoreconf -vfi\n$ ./configure\n```\n![output image]( https://qengineering.eu/images/QR_build.webp )\n```\n$ make -j4\n$ sudo make install\n$ sudo ldconfig\n```\nNote that ZBar tries to work with /dev/video0, which the Bullseye operating system doesn't support (yet).\u003cbr/\u003e\nSince we're only using the decoding part of ZBar and not the ability to capture images, it won't affect our project.\u003cbr/\u003e\n\n### Scanning QR and/or barcodes\nIn the code you can configure the codes ZBar is trying to decode.\nYou can enable all possible codes by the single line\n```\nscanner.set_config(zbar::ZBAR_NONE, zbar::ZBAR_CFG_ENABLE, 1);\n```\nOr, if you want to scan a specific code, uncheck everything and then enable the one you want \n```\nscanner.set_config(zbar::ZBAR_NONE, zbar::ZBAR_CFG_ENABLE, 0);\nscanner.set_config(zbar::ZBAR_QRCODE, zbar::ZBAR_CFG_ENABLE, 1);\n```\nMore info at [ZBar](http://zbar.sourceforge.net/api/zbar_8h.html#f7818ad6458f9f40362eecda97acdcb0).\n\n------------\n\n## Installing the app.\n\n- Make sure you have OpenCV up and running on your system.\u003cbr/\u003e\n- Choose the folder with your operating system (Buster or BUllseye, 32 or 64 bit).\u003cbr/\u003e\n- Download the files.\u003cbr/\u003e\n- You can either build the app with Code::Blocks (`$ sudo apt-get install codeblocks`) or use CMake.\u003cbr/\u003e\n### Code::Blocks\nLoad the project file `QR.cbp` and run the app with F9.\u003cbr/\u003e\nFor more info on how to work with the Code::Blocks IDE see our [tutorial](https://qengineering.eu/opencv-c-examples-on-raspberry-pi.html).\u003cbr/\u003e\n### CMake\n```\nmkdir build\ncd build\ncmake ..\nmake\n```\n![output image]( https://qengineering.eu/images/QRpi_CMake.png )\u003cbr/\u003e\nAfter the build you find the QRpi app in the buiild folder.\u003cbr/\u003e\n.\u003cbr/\u003e\n├── build\u003cbr/\u003e\n│   ├── CMakeCache.txt\u003cbr/\u003e\n│   ├── CMakeFiles\u003cbr/\u003e\n│   ├── cmake_install.cmake\u003cbr/\u003e\n│   ├── Makefile\u003cbr/\u003e\n│   └── **_QRpi_**\u003cbr/\u003e\n├── CMakeLists.txt\u003cbr/\u003e\n├── main.cpp\u003cbr/\u003e\n└── QRpi.cbp\u003cbr/\u003e\u003cbr/\u003e\n\n------------\n\n## Final remarks.\n\n- Keep the camera resolution at 1024x768 as we will crop the images to the required ZBar size of 720x720.\n- The standard Raspicam is not the best choice when it comes to scanning small QR codes. With its fixed focus, the camera cannot zoom in very close. If you need to scan tiny QR codes, consider a variable focus camera like [ArduCam's 8Mp](https://www.uctronics.com/arducam-8-mp-sony-imx219-camera-module-with-m12-lens-ls40136-for-raspberry-pi.html). ![output image]( https://qengineering.eu/images/Arducam_M12.png )\u003cbr/\u003e\u003cbr/\u003e\n\n![output image]( https://qengineering.eu/images/QRsucces.png )\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqengineering%2Fqr_scanner_raspberry_pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqengineering%2Fqr_scanner_raspberry_pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqengineering%2Fqr_scanner_raspberry_pi/lists"}