Skip to main content

pysdic

pysdic icon

PyPI License Documentation

pysdic measures the 3D shape and displacement field of a surface from images taken by several cameras with Stereo Digital Image Correlation (SDIC). The surface is described by a finite element mesh. The displacements of the vertices and the camera models are estimated together, directly from the gray levels of the images.

The displacement U of the mesh is found by minimizing the gray level differences between the views of a reference frame and the views of a deformed frame, at the integration points x of the mesh:

min_U  Σ_pairs Σ_x  ρ( f( P_a(x) ) - g( P_b(x + U(x)) ) )

where P_a and P_b are the projections of the two cameras of a pair, f and g are the images of the pair and ρ is a (robust) loss function. The gray levels can be corrected (ZNSSD, ...) before they are compared.

Features

  • Geometry: point clouds, connectivities and surface meshes in 2D and 3D, integration points, adjacency, surface properties (normals, areas, ...) and ray casting.
  • Finite elements (pysdic.fem): shape functions, interpolation of properties and finite difference operators on the meshes.
  • Camera models: parametric transformations with their Jacobians, combining an extrinsic (rigid, perspective, planar, ...), a distortion (Zernike, ...) and an intrinsic model, which can be composed and reparametrized.
  • Computer vision: projection of points, triangulation, distortion of images, optical flow and optimization of the camera parameters.
  • Imaging: immutable images with spline interpolation and regions of interest, cameras and views, projection of a mesh onto the images (visibility, UV maps) and generation of synthetic speckle images.
  • SDIC: an analysis object (mesh, views and displacements of each frame), correlation terms, temporal regularization and fixed parametrizations of the unknowns, solved with the Gauss-Newton solver pysolve-gn. Displacements and camera parameters (extrinsic, distortion, intrinsic) can be optimized together.
  • Workflows (pysdic.workflows): ready-made computations (initialisation by optical flow, quality control, reference shape, ...).
  • Displays: 2D images with matplotlib and 3D scenes with pyvista.

All the computations are performed with numpy and scipy (sparse matrices) on a single core.

Installation

pip install pysdic

pysdic requires Python 3.11 or later. Some features need optional dependencies, which are only imported when they are used:

pip install "pysdic[pyvista]"   # 3D displays
pip install "pysdic[open3d]"    # ray casting on 3D meshes
pip install "pysdic[zernike]"   # Zernike distortion of the cameras
pip install "pysdic[all]"       # all the optional features

Or install the development version from GitHub:

pip install git+https://github.com/Artezaru/pysdic.git

The rendering of synthetic images with Blender is provided by the separate package pysdic-blender (Python 3.13):

pip install pysdic-blender

See the installation guide for more details.

Quick start

Measure the displacement of the frame 1 with two cameras, the frame 0 being the reference:

import pysolvegn
from pysdic import Pairing, SDICCorrelationTerm, SDICUnknowns

# analysis: a pysdic.SDICAnalysis (mesh, views of each frame and camera)
# integration_points: the pysdic.IntegrationPoints of the mesh where the gray levels are compared
analysis.set_zero_displacement(0)
analysis.set_zero_displacement(1)  # Initial guess

unknowns = SDICUnknowns([1], [])  # Displacement of the frame 1, no camera parameter
pairings = [Pairing(0, 0, 1, 0), Pairing(0, 1, 1, 1), Pairing.stereo(1, 0, 1)]
correlation = SDICCorrelationTerm(analysis, unknowns, integration_points, pairings,
                                  gl_correction={"mode": "ZNSSD"})

result = pysolvegn.solve(terms=[correlation.term], p0=analysis.pack_unknowns(unknowns), max_iteration=20)
analysis.apply_unknowns(unknowns, result.parameters)  # Displacement of the frame 1 written in the analysis

More examples (meshes, camera projection, synthetic images, calibration of the cameras, displacement measurement, ...) are available in the examples gallery.

Documentation

The online documentation contains:

Author

License

Copyright (C) 2026 Artezaru

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

Dependencies

Package Type License Copyright Repository
numpy required BSD-3-Clause Copyright (c) 2005-2025, NumPy Developers https://github.com/numpy/numpy
scipy required BSD-3-Clause Copyright © 2001, 2002 Enthought, Inc. / Copyright © 2003-2019 SciPy Developers https://github.com/scipy/scipy
matplotlib required Matplotlib License (PSF-based) Copyright (c) 2012- Matplotlib Development Team https://github.com/matplotlib/matplotlib
opencv-python-headless required MIT (opencv-python scripts), Apache-2.0 (OpenCV), LGPL-2.1 (bundled FFmpeg), see LICENSE-3RD-PARTY.txt OpenCV: Copyright (C) 2000-2025 Intel Corporation, OpenCV Foundation and other contributors, see LICENSE https://github.com/opencv/opencv-python
pysolve-gn required GPL-3.0-or-later Copyright (C) 2026 Artezaru https://github.com/Artezaru/pysolve-gn
py3dframe optional (frames) Apache-2.0 Copyright 2025 Artezaru https://github.com/Artezaru/py3dframe
pyzernike-polynomials optional (zernike) Apache-2.0 Copyright 2025 Artezaru https://github.com/Artezaru/pyzernike
meshio optional (meshio) MIT Copyright (c) 2015-2021 Nico Schlömer et al. https://github.com/nschloe/meshio
vtk optional (vtk) BSD-3-Clause See Copyright.txt https://vtk.org/
pyvista optional (pyvista) MIT Copyright (c) 2017-2026 The PyVista Developers https://github.com/pyvista/pyvista
open3d optional (open3d) MIT Copyright (c) 2018-2026 www.open3d.org https://github.com/isl-org/Open3D
h5py optional (hdf5) BSD-3-Clause Copyright (c) 2008 Andrew Collette and contributors https://github.com/h5py/h5py

Citations

The ray casting on 3D meshes uses Open3D.

@article{Zhou2018,
    author    = {Qian-Yi Zhou and Jaesik Park and Vladlen Koltun},
    title     = {{Open3D}: {A} Modern Library for {3D} Data Processing},
    journal   = {arXiv:1801.09847},
    year      = {2018},
}

Metadata

Release files for pysdic 2.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysdic 2.4.0
File Size Uploaded Provenance Actions
pysdic-2.4.0.tar.gz 4.5 MB Without provenance Details for pysdic-2.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysdic 2.4.0
File Interpreter ABI Platform Actions
pysdic-2.4.0-py3-none-any.whl Python 3 none any Details for pysdic-2.4.0-py3-none-any.whl

Total release size: 5.4 MB

Release files / pysdic-2.4.0.tar.gz

Download URL pysdic-2.4.0.tar.gz
Size 4.5 MB
Tags Source
SHA-256 checksum
How to use checksums
8fd4d440f6aeb15dace30ee74275f663f1162b06590c8fc9304cfd0a84dbfb98
BLAKE2b-256 checksum
How to use checksums
c0e33b67d95606c439d7ff1684d2647efc6f13884d06fac4b88679dea1956ea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pysdic-2.4.0-py3-none-any.whl

Download URL pysdic-2.4.0-py3-none-any.whl
Size 929.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d96b16b920767017788a36bccd4afa4c4093fd653af207542abc60d56af56a4c
BLAKE2b-256 checksum
How to use checksums
672fb327539c9b9c4cd71cf8328afff4261f667bd1bb3fb95a09913fd0eb3dfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for pysdic 2.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page