with alpha-blending
A Python-based utility to detect, remove, and seamlessly replace QR codes within images using image processing algorithms.
This utility can be used to replace a QR at any position from a source image with the desired target QR. It works by operating differently for target QR's with background and without background.
i) Robust Detection: Uses multi-strategy detection (Grayscale, Adaptive Thresholding, Inverted)
ii) Object Removal (Inpainting): Clean removal of the original QR code using the Telea inpainting algorithm
iii) Perspective Warping: Maps the new QR code to the exact 3D perspective of the original marker using Homography
iv) Alpha Blending: Supports transparent PNGs for the new marker, supporting graceful blending
v) Smart Contrast: Automatically detects dark backgrounds and inverts the new QR code colors (Black ↔ White) to ensure visibility.
- Clone the repo
git clone https://github.com/homingos/QR-replacer-utility.git- install the requirements
python3 -m pip install -r requirements.txt- The script currently uses all samples images in the IMAGES folder. You can modify this behaviour in the script's driver code.
if __name__ == "__main__":
....- get to
srcfolder - run the script
python3 main.py- now check the output files generated with prefix
output_in thesrcfolder for corressponding images.

