Skip to main content

Video-based analysis tools for tensile tests and 3D-printed body displacement

Project description

optimech

optimech is a Python library for optical-mechanical analysis of experimental tests using video data.
It is designed to process videos recorded during mechanical testing and extract displacement and strain information using computer vision techniques.

The library currently supports two analysis modules:

  • Tensile Test Program (optical extensometry)
  • 3D-Printed Body Program (displacement measurement at contact or sensitive points)

The project is developed as part of the Programming II course and is distributed as a reusable Python package.


Features

Tensile Test Program (optimech.tensile)

  • Video input support (smartphone or camera recordings)
  • Automatic frame extraction
  • Detection and cropping of the extensometer region
  • Optical tracking of extensometer gauge lines
  • Frame-by-frame displacement measurement
  • Strain computation from gauge length
  • Time-based analysis (fps-based)
  • CSV export of displacement and strain data
  • Static and interactive visualizations (Matplotlib / Plotly)

3D-Printed Body Program (optimech.body3d)

  • Video input support for relaxed and loaded states
  • Frame extraction from recorded tests
  • Detection of contact or user-defined sensitive points
  • Optical tracking of displacement at the contact point
  • Measurement of deformation under actuator pressure
  • Relative displacement computation between states
  • CSV export of displacement results
  • Visualization of tracked points and displacement evolution

Installation

Install the library directly from PyPI:

pip install optimech

Requirements

  • Python ≥ 3.9
  • NumPy
  • OpenCV
  • Matplotlib
  • Plotly
  • Pandas
  • Imageio

All dependencies are installed automatically with pip.


Basic Usage

Tensile test analysis

import optimech

results = optimech.analyze_tensile(gauge_length_mm=35, image_dir="pics", output_csv="tensile_results")
optimech.plot_tensile_results(results["time_s"], results["elongation_mm"], results["strain"], "tensile_plots")
optimech.animate_tensile_gauge(results["images_rgb"], results["top_lines"], results["bottom_lines"])

Main function (high-level API) processes the video and computes the displacement and strain from the extensometer using optical tracking techniques, for a specimen of 35mm gauge length and photos of the tensile test in the pics folder.

The other two are optional visualization functions.

3D-printed body analysis

import optimech

results3d = optimech.analyze_body3d(video_path="body3d.mov", specimen_height_mm=40)
optimech.plot_body3d_displacement(results3d["csv_relative"], "body3d_plots")
optimech.make_body3d_gif(results3d["frames_dir"], results3d["csv_full"], results3d["reference_point"], "body3d_plots")

Main function (high-level API) processes the video and computes the displacement of the contact point of the body and the actuator that applies that movement using optical tracking techniques, for a specimen of 40mm height and a video of the test in .mov format.

The other two are optional visualization functions.


Project structure

optimech/
│
├── tensile/
│   ├── __init__.py
│   ├── analysis.py
│   ├── io.py
│   ├── tracking.py
│   ├── video.py
│   ├── vision.py
│   └── visualization.py
│
├── body3d/
│   ├── __init__.py
│   ├── analysis.py
│   ├── io.py
│   ├── tracking.py
│   ├── video.py
│   ├── vision.py
│   └── visualization.py
│
└── __init__.py

API Design

The library exposes a simple and clear public API, as required by the project specification.

Internal processing steps such as video handling, vision algorithms, tracking and analysis are modularized internally and hidden from the user.


Authors

  • Amaia Marín
  • Jone Morrás
  • Nahia Uriarte
  • Nora Vega

License

This project is licensed under the MIT License. See the LICENSE file for more details.

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

optimech-0.1.2.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

optimech-0.1.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file optimech-0.1.2.tar.gz.

File metadata

  • Download URL: optimech-0.1.2.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for optimech-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f80ad9536b4ce420a8e8465a58c5384031457af965bb649f47d3285b6f546067
MD5 d2d047d8d3c7fc332b4d63674b0ef4ea
BLAKE2b-256 30854478cff2b6a40528a61753f83d8dffdf801d10fe5ed1043c19c153fa71a5

See more details on using hashes here.

File details

Details for the file optimech-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: optimech-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for optimech-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7982683a74dfb77e9a06afd8ab90d094773a5162b72584ace5ab1f4d93f9e981
MD5 eb15985ce45d3b9ae21f56afe4517580
BLAKE2b-256 73a6b9da01d8e58e5b734dfa2db93ff3ea908f9b4954655cfbb9aa028349e570

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