This set of scripts allows you to generate and interact with QR codes. You can create QR codes from text URLs, images, or data, and also detect and open URLs from QR codes using your computer's webcam or existing images.
-
QR Code Generation: Create QR codes from text URLs or data.
-
QR Code Detection: Detect QR codes in images or using your webcam.
-
URL Opening: Automatically open detected URLs in your default web browser.
-
Create a text file named "urls.txt" with each line containing a URL or data you want to convert into QR codes.
-
Run the script
qr_generator.py
. -
The script will generate QR codes for each URL in "urls.txt" and save them as PNG images, e.g.,
1.png
,2.png
, etc.
-
Place the image containing the QR code in the same directory as the script.
-
Rename the image to "qr.png" or adjust the script accordingly.
-
Run the script
qr_detector.py
. -
The script will detect and decode the QR code and open the URL in your default web browser.
-
Ensure your computer's webcam is connected and working.
-
Run the script
webcam_qr_detector.py
. -
Point your webcam at a QR code.
-
The script will continuously capture frames and open the detected URL in your default web browser.
-
To stop the script, press 'q' while the video feed is active.
- Python 3.x
- OpenCV (
cv2
module): Required for both generating and detecting QR codes. webbrowser
module: Used to open URLs in the default web browser.qrcode
module: Required for generating QR codes.
Here's an example of how to use these scripts:
-
Use
qr_generator.py
to create QR codes from a list of URLs or data in "urls.txt". -
Use
qr_detector.py
to decode a QR code from an image and open the URL in your browser. -
Use
webcam_qr_detector.py
to continuously scan for QR codes using your webcam.
-
Make sure to adjust file names and paths in the scripts to match your system setup.
-
To enhance the functionality, you can customize the script for different use cases, such as encoding different data into QR codes.
-
These scripts are a starting point for working with QR codes and can be integrated into various applications.
With the QR Code Generator and Detector scripts, you can easily generate QR codes and interact with them using your computer's webcam or existing images. These scripts can be customized and extended to suit your specific needs.
This project is licensed under the MIT License. You are free to use and modify the code for your own purposes.