Skip to main content

rectInspect is a Python library for automated image defect detection. It allows users to detect, highlight, and manually inspect defects in images based on customizable width and height rules. You can also interactively draw rectangles on images to measure dimensions and areas. The library supports skipping certain rectangle sizes and is designed for fast, easy, and flexible inspection of defects in various types of images.

Project description

rectInspect

A Python library for detecting and highlighting defects in images using customizable width and height rules.
This is the source code of version 0.0.1, created as a starter project for building a Python package.

Quickstart

The library provides easy-to-use tools for detecting image defects and manually inspecting them using rectangles.

Initialize Detector

You can initialize the defect detector with threshold, minimum area, width/height arrays, and optional rectangles to remove.

import rectInspect

# Initialize detector
detector = rectInspect.highlight_defects(
    threshold_ratio=0.2,
    min_area=100,
    width_arr=[1],
    height_arr=[8],
    remove_rec=[(64,35)]  # Width, height to skip
)

Process Image

Process an image to detect defects and get the filtered result.

# Process the image
filtered = detector.process_image("2.jpeg")

Detect Defects

Detect defects based on initialized parameters. Returns the number of detected items.

# Detect defects
detected_items = detector.detect_defects(filtered, detector.merged_contours)

# Print results
detector.print_results(detected_items)

Save Highlighted Image

Save the image with defects highlighted in red rectangles.

# Save the highlighted defects
detector.save_highlited_defect_image(filtered, detected_items)

Draw Rectangles Manually

You can also interactively draw rectangles on an image and see their width, height, and area.

# Draw rectangles interactively
detector.draw_rectangle_with_mouse("final.jpg")

Features

  • Detect defects using contour analysis.
  • Specify multiple width and height ratios using arrays.
  • Optionally remove rectangles that match certain width/height dimensions.
  • Interactive rectangle drawing with real-time width, height, and area display.
  • Save final images with highlighted defects.

Installation

pip install rectInspect

rectInspect

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rectinspect-0.0.1.tar.gz (6.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rectinspect-0.0.1-py3-none-any.whl (7.8 MB view details)

Uploaded Python 3

File details

Details for the file rectinspect-0.0.1.tar.gz.

File metadata

  • Download URL: rectinspect-0.0.1.tar.gz
  • Upload date:
  • Size: 6.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for rectinspect-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b5a3604a723007d30fb4451eb0e4666ecfb5ced80970bb3eac81a13ab25fbfc9
MD5 238d88d330d7aa31c0336ba3ee29f86b
BLAKE2b-256 6c3d743b6a30ae496d8ef1bd7af5c23c1c147818f55904b02584fece7e9e0ea1

See more details on using hashes here.

File details

Details for the file rectinspect-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: rectinspect-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for rectinspect-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7284212ddff40dfbc52cbeadec6f0d8705405a62b18978a264a7b5e602480b64
MD5 7c1d44dc1df8a6b16faba60afb7539bb
BLAKE2b-256 46616cecc18cafd0d6c7982a320f3607e7adf43ba8b3c5e9eb92ec29694fd0f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page