Skip to main content

Package to help analyze fracture patterns on broken glass plys.

Project description

Version Total Downloads DOI

For citation please use:

@software{fracture-suite,
  author       = {Leon Bohmann},
  title        = {fracsuite v1},
  data         = 2024-03,
  version      = {1.0.0},
  doi          = {10.5281/zenodo.10758208},
  url          = {https://github.com/leonbohmann/fracture-suite/tree/masterrelease}
}

Backend plot of analyzer, displaying original and preprocessed image and detected cracks

How it works

:warning: This is deprecated. The documentation will be updated in the future!

Several steps are necessary to analyze a fracture scan:

  1. Cropping of input image (optional)
    1. Analyze the image and find the biggest rectangular shape
    2. Perspective transform the image, so that the rectangle is filling the extents
  2. Preprocessing
    1. Gaussian Blur + (optional) Resize of the input image
    2. Adaptive Threshold
  3. Contour detection
    1. Find all contours on the preprocessed image
    2. Filter Contours, remove all:
      1. Whose perimeter is too small
      2. Whose area is way too large (25000px²)
  4. Create stencil with the found contours
    1. This helps to quickly remove all contours that lie within a bigger contour
    2. Draw all contours onto a new image (resulting image will display the cracks)
  5. Skeletonization #1
    1. Skeletonize the stencil to minimize the crack width to 1px wide lines
    2. Use Erode/Dilate (closing kernel) to connect gaps in contours (this will widen the 1px wide lines)
  6. Skeletonization #2
    1. Skeletonize the image again to retrieve the crack middle lines
  7. (enabled by default) Remove splinters, whose are is all black in the original image and fill those spaces
  8. Contour detection #2
    1. Now with minimal fuzziness, run the splinter detection again
  9. Create splinters from resulting contour list

A couple of outputs are saved to a directory next to the input image. These are:

  • Contour plot of recognized splinters (you have to zoom in, contour thickness is 1px)
  • Filled plot of splinters
  • Figures
    • Splinter size distribution
    • Splinter relative share distribution
    • Voronoi overview
    • Fracture Intensity overlay

Installation

pip install fracsuite

Usage (:warning: 0.1.7 only!)

Use the module directly

py -m fracsuite.splinters "path/to/image"

For details see: API Docs

Create a script

from fracsuite.splinters.analyzer import Analyzer, AnalyzerConfig

image = r"Path/to/some/image.bmp"

config = AnalyzerConfig()
# size of cropped image (if cropping is needed)
config.cropsize = (4000,4000)

analyzer = Analyzer(image, config)

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

fracsuite-1.1.0.tar.gz (216.3 kB view details)

Uploaded Source

Built Distribution

fracsuite-1.1.0-py3-none-any.whl (240.8 kB view details)

Uploaded Python 3

File details

Details for the file fracsuite-1.1.0.tar.gz.

File metadata

  • Download URL: fracsuite-1.1.0.tar.gz
  • Upload date:
  • Size: 216.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fracsuite-1.1.0.tar.gz
Algorithm Hash digest
SHA256 73d8a70a81791d6d5a3099c87a137a9c9ab5c994ffa8fc6aeaab2530b880705a
MD5 c8e4038307d9bfe7eb8cc1183e935fc3
BLAKE2b-256 da49c7892eeca096e31653c4725f89b21813aa6c0f807d6bf388b588d5b066ff

See more details on using hashes here.

File details

Details for the file fracsuite-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: fracsuite-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 240.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for fracsuite-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06597735ba97026cc24c5e19b66f7d074ed19e7b3ad0ec1e25a866472454449e
MD5 7d6f86e001df214bbe2c29ec739baadf
BLAKE2b-256 4d17534fea553a3b2d7a48eae1c2f09f8290ee207ed5430d40ff3b89bf3db6c7

See more details on using hashes here.

Supported by

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