Skip to main content

A computer vision library for automated analysis of tensile and flexion mechanical tests.

Project description

PLA Analysis Library

Version Python License

pla_analysis is a computer vision library designed for the automation and analysis of mechanical tests. This tool allows for the extraction of precise quantitative data (displacement, elongation) from video recordings or image sequences, eliminating the need for physical contact sensors.

Installation

You can install the library directly from PyPI:

pip install pla_analysis

Usage Guide

The library is divided into two specialized modules according to the type of mechanical test. The operation of each is detailed below.


1. Tensile Module (Optical Extensometry)

This module automates elongation measurement in tensile tests by tracking two physical marks on the specimen.

Input Requirements

  • Input: A folder (directory) containing the image sequence (frames) of the test ordered chronologically.
  • Specimen: Must have two horizontal black lines marked on a clear background.

Example Code

import pla_analysis

# Path to the folder containing the images .jpg/.tif/.png
frames_folder = "C:/path/to/my_tensile_frames"

# Run analysis
# l0_mm: Real initial distance between the two lines (Default: 35.0 mm)
# a0_mm2: Cross-sectional area of the specimen (Default: 15.0 mm^2)
pla_analysis.tensile.analyze(frames_folder, l0_mm=35.0, a0_mm2=15.0)

Interactive Workflow

  1. ROI (Region of Interest) Selection: Upon running the code, the first frame will open. You must draw a box with the mouse that meets two vital conditions:

    • Must contain BOTH black lines.
    • Must have some vertical clearance (towards the direction the specimen stretches) to avoid losing the lines during the test.
    • Efficiency: Try to adjust the width horizontally to the specimen. Selecting an unnecessarily large region will increase computational cost and could slow down the analysis.
  2. Live Analysis: The program will process the sequence showing a dashboard with line detection and the elongation graph generating frame by frame.

  3. Results: Upon completion, the maximum displacement will be shown in the terminal, and a window will open with the detailed final graph of Elongation (mm) vs Frames.


2. Body3D Module (Flexion Tracking)

Designed to track the displacement of a specific point (centroid) in flexion tests or rigid body motion.

Experiment Preparation (Important)

To ensure proper computer vision performance, the input video must meet the following criteria:

  • Contrast: The specimen must be light (white) and the background also white or very light.
  • Marker: Draw a single black or dark blue dot on the area you wish to analyze.
  • Editing: It is recommended to crop the video beforehand to eliminate dead time at the start or end. The less "filler" the video has, the faster and more accurate the analysis will be.

Example Code

import pla_analysis

# Path to the video file (.mp4, .avi, etc.)
video_path = "C:/path/to/flexion_test.mp4"

# save_video=True will generate an .mp4 file with the visual result overlaid
pla_analysis.body3d.analyze(video_path, save_video=True)

Interactive Workflow

  1. Scale Calibration: The system needs to transform pixels to millimeters.

    • Click on two points on the image whose real distance you know (e.g., the width of the specimen).
    • Enter the real distance in millimeters in the terminal (e.g., 10.5).
  2. ROI Selection: Select a box enclosing the area where the black dot will move. Ensure sufficient clearance so the dot does not exit the frame during maximum flexion.

  3. Threshold Adjustment: A window with a slider will appear.

    • Move the bar until only the black dot is visible in black and the rest of the image appears totally white.
    • Press ENTER to confirm.
  4. Results and Export: The system will automatically generate in your execution folder:

    • resultado_analisis.mp4: Live dashboard video.
    • reporte_comparativo.png: Static image comparing the initial state (rest) vs. maximum displacement.

Authors

Project developed by students from Mondragon Unibertsitatea:

  • Haritz Aseguinolaza
  • Aimar Seco
  • Aratz Zabala
  • Aitor Otzerin

License

This project is distributed under the MIT license. See the LICENSE file for more information.

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

pla_analysis-0.1.4.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

pla_analysis-0.1.4-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pla_analysis-0.1.4.tar.gz.

File metadata

  • Download URL: pla_analysis-0.1.4.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pla_analysis-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ada1c8c7d31a84831f4a58b3799632921dfa3b75d17a22cd929bfd6349bd08f0
MD5 019c6c8f801f05287c530d6f189d9bfa
BLAKE2b-256 afba51545c3a828471d602cba0fd2e3f5cfc8d6c7252217cd864c219f364ae56

See more details on using hashes here.

File details

Details for the file pla_analysis-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pla_analysis-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pla_analysis-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8fd49f522caa1adc8b9a2a8e1002513a3b54405b2a7f0832ce5bf2e2dde1b350
MD5 f684e7d6db2cfcd88f9249c4ed564a75
BLAKE2b-256 9aaeef0ea11e51b7504f53235e49be4e0894184105f0d52a4d5fa2d852dd2846

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