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.2.tar.gz (16.0 kB 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.2-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rectinspect-0.0.2.tar.gz
Algorithm Hash digest
SHA256 977fe4d6389077102db1fad108d15d30287c2a221310a885d742e7cfdcb4ac10
MD5 58b13f5ee37c635fcdcae8aa2830e3fc
BLAKE2b-256 02b39c30b222ec49e2700510acfd05831f877784b2b9932bb8929fa253c6c455

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rectinspect-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4088fffd36c7fc5021377f4b83d3a60b3bef9dd8e29673fa89ffd97f96d80f12
MD5 0755417089d4cd6b581453f3f92cc851
BLAKE2b-256 d3ab1f13e94d9309432d90db7839d8cfe1b7aa85b4722fb6c83db9089003125f

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