<jupyter_start><jupyter_text>DICpy: digital image correlation with Python Earthquake Engineering and Structural Dynamics (EESD) Lab at EPFL Example 1: estimating the strain field using two images.<jupyter_code>from DICpy.DIC_2D import RegularGrid, PostProcessing
from DICpy.DIC_2D import LucasKanade
from DICpy.DIC_2D import ImageRegistration
from DICpy.DIC_2D import CoarseFine
from DICpy.DIC_2D import GradientZero
from DICpy.DIC_2D import GradientOne
from DICpy.DIC_2D import Oversampling
from DICpy.DIC_2D import Images

from DICpy.utils import *
import matplotlib.pyplot as plt
import numpy as np<jupyter_output><empty_output><jupyter_text>Read images.<jupyter_code># Path to images.
path = r"images_ex1"

# Instantiate an object of the class Images
imobj = Images()

# calibrate pixel_dim for conversion pixel/length.
imobj.calibration(pixel_dim=0.43)

# read the speckle images.
imobj.read_speckle_images(path=path, extension="png", verbose=True)<jupyter_output>mm/pixel:  0.43
DICpy: reading speckle images.
Foto1.png
Foto2.png<jupyter_text>Determine the region of interest (ROI) and set a rectangular mesh, where the center of each element is used for estimating the displacement field.<jupyter_code># Instantiate an object of RectangularMesh with an object of Images.
meshobj = RegularGrid(images_obj=imobj)

# Construct the mesh by giving the extreme points of a rectangular area and the number of divisions.
# Alternatively: point_a and point_b can be set using the mouse if no argument is sent via define_mesh.
# Click next to accept the grid.
meshobj.define_mesh(point_a=(1500,3000), point_b=(6000, 400), nx=30, ny=20, show_grid=False)<jupyter_output><empty_output><jupyter_text>Run DIC.<jupyter_code># Run the DIC analysis without subpixel approximation:
anaobj = ImageRegistration(mesh_obj=meshobj)
anaobj.run()

# Plot the horizontal displacement.
ppobj = PostProcessing(analysis_obj=anaobj)
ppobj.visualization(results='u', step=1, smooth=True)
# Run the DIC analysis with subpixel approximation (Oversampling):
anaobj = Oversampling(mesh_obj=meshobj, over_x=2, over_y=2)
anaobj.run()

# Plot the horizontal displacement.
ppobj = PostProcessing(analysis_obj=anaobj)
ppobj.visualization(results='u', step=1, smooth=True)
# Run the DIC analysis with subpixel approximation (coarse-fine method with 2 iterations):
anaobj = CoarseFine(mesh_obj=meshobj, niter=2)
anaobj.run()

# Plot the horizontal displacement.
ppobj = PostProcessing(analysis_obj=anaobj)
ppobj.visualization(results='u', step=1, smooth=True)
# Run the DIC analysis with subpixel approximation (gradient with zero order shape function):
anaobj = GradientZero(mesh_obj=meshobj)
anaobj.run()

# Plot the horizontal displacement.
ppobj = PostProcessing(analysis_obj=anaobj)
ppobj.visualization(results='u', step=1, smooth=True)
# Run the DIC analysis with subpixel approximation (gradient with first order shape function):
anaobj = GradientOne(mesh_obj=meshobj)
anaobj.run()

# Plot the horizontal displacement.
ppobj = PostProcessing(analysis_obj=anaobj)
ppobj.visualization(results='u', step=1, smooth=True)
# Run the DIC analysis with subpixel approximation (Lucas-Kanade):
anaobj = LucasKanade(mesh_obj=meshobj)
anaobj.run()

# Plot the horizontal displacement.
ppobj = PostProcessing(analysis_obj=anaobj)
ppobj.visualization(results='u', step=1, smooth=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08602788490062296, 'fraction_numerical': 0.013942450311480272, 'mean_word_length': 7.105769230769231, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '450656', 'license': 'MIT', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1066, 'n_words': 320, 'path': 'examples/Example_1.ipynb', 'repo_name': 'eesd-epfl/DICpy', 'size': '3371'}