hamidrezafarzin / QRcode-Pattern-Finder

qr code Pattern Finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Finder Pattern Detector

This Python code implements a finder pattern detector used for detecting patterns in images, particularly suitable for applications like QR code detection.

Table of Contents

  1. Overview
  2. Usage
    1. Clone Repository
    2. Installation
    3. Run the Code
    4. Input Images
    5. Output
  3. Example
  4. License

Overview

The Finder Pattern Detector detects patterns within images, specifically designed for identifying finder patterns such as those used in QR codes. It performs image preprocessing, pattern detection, and draws rectangles around the detected finder patterns.

Usage

Clone Repository

To clone the repository, use the following command:

git clone https://github.com/hamidrezafarzin/QRcode-Pattern-Finder.git

Installation

Before running the code, ensure you have Python installed on your system along with the necessary dependencies, including OpenCV (cv2) and NumPy (numpy). You can install the required dependencies using the provided requirements.txt file. Navigate to the project directory and execute the following command:

pip install -r requirements.txt

Run the Code:

- Import the `FinderPatternDetector` class from the provided Python script.
- Create an instance of the `FinderPatternDetector` class.
- Specify the path of the input image.
- Read the input image using the `read_image()` method.
- Detect finder patterns in the image using the `detector()` method.
- Optionally, create a result image with detected patterns drawn using the `create_result_image()` method.

Input Images

Provide images containing finder patterns as input. The code supports various image formats, including JPEG, PNG, etc.

Output

The code generates a result image with detected patterns outlined in rectangles. The output image is saved with "_result" appended to the original image filename.

Example

from finder_pattern_detector import FinderPatternDetector

# Create an instance of FinderPatternDetector class
detector = FinderPatternDetector()

# Specify the path of the input image
path = "path/to/input/image.jpg"

# Read the input image
detector.read_image(path)

# Detect finder patterns in the image
detector.detector()

# Create a result image with detected patterns drawn
detector.create_result_image()

License

This code is provided under the MIT License.

About

qr code Pattern Finder

License:MIT License


Languages

Language:Python 100.0%