This script enables users to scan and decode QR codes from image files (PNG and JPG formats). It uses OpenCV and Pyzbar for decoding QR codes and provides a simple file dialog for selecting images on your local machine.
To run this script, you'll need Python 3.x installed on your machine. The required libraries are listed in requirements.txt
, including:
- opencv-python: For image processing.
- pyzbar: For decoding QR codes.
- Pillow: Required for handling image formats.
- tk: Provides a file dialog for image selection.
-
Clone the repository (or download the script and
requirements.txt
directly):git clone <repository_url> cd <repository_directory>
-
Install dependencies:(Run the following command to install the necessary libraries from
requirements.txt
:)pip install -r requirements.txt
- Run the script (Execute the QR code scanner script using:)
python qr_code_scanner.py
- Select an Image
- A file dialog will open, allowing you to select a PNG or JPG image containing a QR code.
- Once an image is selected, the script will attempt to decode any QR code present in the image.
- View the Output
- If a QR code is detected, its contents will be displayed in the terminal.
The requirements.txt
file lists all dependencies for the QR code scanner script. This file ensures that the correct versions of each library are installed to avoid compatibility issues. Libraries in requirements.txt
include:
opencv-python
pyzbar
Pillow
tk
Make sure to install these libraries by running pip install -r requirements.txt
before using the script.