DICpy.DIC_2D¶
The module DIC_2D of DICpy contain classes for performing 2D digital image correlation with Python. The module follows the objected-oriented paradigm and the DIC is performed following a sequence of object instantiation. Next, a detailed description of each class is presented.
DICpy.DIC_2D.Images¶
- class DICpy.DIC_2D.Images[source]¶
Bases:
objectThis class contains the methods for reading and processing images used in digital image correlation (DIC). Input: Attributes:
- path_speckle (str)
Path to the speckle images.
- path_calibration (str)
Path to the calibration image.
- ref_image (ndarray)
Reference image.
- calibration_image (ndarray)
Calibration image.
- images (ndarray)
Gray images.
- images_normalized (ndarray)
Gray images normalized by 255.
- lx (int)
Number of columns of each image.
- ly (int)
Number of rows of each image.
- num_img (int)
Number of images.
- pixel_dim (float)
Size of each pixel in length dimension.
Methods:
- calibration(ref_length=None, pixel_dim=None, path=None, file_name=None, point_a=None, point_b=None, verbose=True)[source]¶
Method for the analysis calibration.
Input: * ref_length (str)
Length used as reference.
- pixel_dim (float)
Size of each pixel in length dimension.
- path (str)
Path for the calibration image used in the DIC analysis.
- file_name (str)
Name of the calibration image.
- point_a (float)
First corner of the region of interest (ROI).
- point_b (float)
Corner opposed to point_b of the region of interest (ROI).
- verbose (bool)
Boolean variable to print some information on screen.
Output/Returns:
- read_speckle_images(path=None, extension=None, file_names=None, ref_id=0, verbose=False)[source]¶
Read the speckle images.
Input: * path (str)
Path for the images used in the DIC analysis.
- extension (str)
The extension of the files located in path.
- file_names (str)
Define the files to be read in the sequence of your preference.
- ref_id (int)
Define a file to be used as reference, the default is zero, which means that the first image in the stack will be used as reference.
- verbose (bool)
Boolean varible to print some information on screen.
Output/Returns:
DICpy.DIC_2D.RegularGrid¶
- class DICpy.DIC_2D.RegularGrid(images_obj=None)[source]¶
Bases:
objectThis class contains the methods for creating a rectangular mesh used in the DIC analysis. Input: * images_obj (object)
Object containing the speckle images, reference images, and calibration images, as well as calibration parameters.
Attributes:
- images_obj (object)
Object containing the speckle images, reference images, and calibration images, as well as calibration parameters.
- stepx (ndarray)
Steps for the grid in the x direction (columns).
- stepy (ndarray)
Steps for the grid in the y direction (rows).
- centers (list)
Centers for each cell in the grid.
- wind (list)
Dimensions in both x and y dimensions for each cell.
- xp (ndarray)
Position of the upper right corner for each cell (grid in the x direction - columns).
- yp (ndarray)
Position of the upper right corner for each cell (grid in the y direction - rows).
- nx (int)
Number of nodes in the x direction (columns).
- ny (int)
Number of nodes in the y direction (rows).
- point_a (float)
First corner of the region of interest (ROI).
- point_b (float)
Corner opposed to point_b of the region of interest (ROI).
Methods:
- define_mesh(point_a=None, point_b=None, nx=2, ny=2, show_grid=False)[source]¶
Method to construct the rectangular mesh used in the DIC analysis.
Input: * point_a (float)
First corner of the region of interest (ROI).
- point_b (float)
Corner opposed to point_b of the region of interest (ROI).
- nx (int)
Number of nodes in the x direction (columns), default 2.
- ny (int)
Number of nodes in the y direction (rows), default 2.
- show_grid (int)
This functionality is only available when point_a and point_b are provided. When noplot is True, the grid is not plotted for express calculations.
Output/Returns:
DICpy.DIC_2D.ImageRegistration¶
- class DICpy.DIC_2D.ImageRegistration(mesh_obj=None)[source]¶
Bases:
objectThis class has the methods to perform the DIC analysis without considering the subpixel resolution. This is a parent class for children classes implementing methods with subpixel resolution.
Input: * mesh_obj (object)
Object of the RectangularMesh class.
Attributes:
- pixel_dim (float)
Size of each pixel in length dimension.
- mesh_obj (object)
Object of the RectangularMesh class.
- u (ndarray)
Displacements in the x (columns) dimension at the center of each cell.
- v (ndarray)
Displacements in the y (rows) dimension at the center of each cell.
Methods:
- run()[source]¶
Method to perform the DIC analysis.
Input: * sub_pixel (str)
Method for the sub-pixel refining: - None: do not perform the sub-pixel refining. - ‘Crude’: crude method based on the image oversampling. - ‘gradient’: gradient based sub-pixel refining. - ‘coarse_fine’: method based on the sequential refining of the pixel domain. - ‘lukas_kanade’: method based on the Lukas-Kanade optical flow.
- oversampling_x (int)
Oversampling in the x dimension used when ‘Crude’ method is adopted, default is 1 (equal to ‘crude’).
- oversampling_y (int)
Oversampling in the y dimension used when ‘Crude’ method is adopted, default is 1 (equal to ‘crude’)..
- niter (int)
Number of iterations used when ‘coarse_fine’ method is adopted, default is 1.
Output/Returns:
DICpy.DIC_2D.Oversampling¶
- class DICpy.DIC_2D.Oversampling(mesh_obj=None, over_x=1, over_y=1)[source]¶
Bases:
DICpy.DIC_2D._image_registration.ImageRegistrationDIC with subpixel resolution using oversampling.
Input: * mesh_obj (object)
Object of the RegularGrid class.
Attributes:
- pixel_dim (float)
Size of each pixel in length dimension.
- mesh_obj (object)
Object of the RegularGrid class.
- u (ndarray)
Displacements in the x (columns) dimension at the center of each cell.
- v (ndarray)
Displacements in the y (rows) dimension at the center of each cell.
Methods:
DICpy.DIC_2D.GradientZero¶
- class DICpy.DIC_2D.GradientZero(mesh_obj=None, max_iter=20, tol=0.001)[source]¶
Bases:
DICpy.DIC_2D._image_registration.ImageRegistrationDIC with subpixel resolution using gradients. This class implement a method using zeroth order shape functions, and It is a child class of ImageRegistration.
Input: * mesh_obj (object)
Object of the RegularGrid class.
Attributes:
- pixel_dim (float)
Size of each pixel in length dimension.
- mesh_obj (object)
Object of the RegularGrid class.
- u (ndarray)
Displacements in the x (columns) dimension at the center of each cell.
- v (ndarray)
Displacements in the y (rows) dimension at the center of each cell.
Methods:
DICpy.DIC_2D.GradientOne¶
- class DICpy.DIC_2D.GradientOne(mesh_obj=None, max_iter=20, tol=0.001)[source]¶
Bases:
DICpy.DIC_2D._image_registration.ImageRegistrationDIC with subpixel resolution using gradients. This class implement a method using zeroth order shape functions, and It is a child class of ImageRegistration.
Input: * mesh_obj (object)
Object of the RegularGrid class.
Attributes:
- pixel_dim (float)
Size of each pixel in length dimension.
- mesh_obj (object)
Object of the RegularGrid class.
- u (ndarray)
Displacements in the x (columns) dimension at the center of each cell.
- v (ndarray)
Displacements in the y (rows) dimension at the center of each cell.
Methods:
DICpy.DIC_2D.CoarseFine¶
- class DICpy.DIC_2D.CoarseFine(mesh_obj=None, niter=1)[source]¶
Bases:
DICpy.DIC_2D._image_registration.ImageRegistrationDIC with subpixel resolution using an coarse-fine search approach, and It is a child class of ImageRegistration.
This method is presented in the following paper: “An advanced coarse-fine search approach for digital image correlation applications.” (By: Samo Simoncic, Melita Kompolsek, Primoz Podrzaj)
Input: * mesh_obj (object)
Object of the RegularGrid class.
Attributes:
- pixel_dim (float)
Size of each pixel in length dimension.
- mesh_obj (object)
Object of the RegularGrid class.
- u (ndarray)
Displacements in the x (columns) dimension at the center of each cell.
- v (ndarray)
Displacements in the y (rows) dimension at the center of each cell.
niter (int)
Number of iterations in the coarse-fine algorithm.
Methods:
DICpy.DIC_2D.LucasKanade¶
- class DICpy.DIC_2D.LucasKanade(mesh_obj=None)[source]¶
Bases:
DICpy.DIC_2D._image_registration.ImageRegistrationDIC with subpixel resolution using the Lucas-Kanade algorithm implemented in OpenCV-Python, and It is a child class of ImageRegistration.
Input: * mesh_obj (object)
Object of the RegularGrid class.
Attributes:
- pixel_dim (float)
Size of each pixel in length dimension.
- mesh_obj (object)
Object of the RegularGrid class.
- u (ndarray)
Displacements in the x (columns) dimension at the center of each cell.
- v (ndarray)
Displacements in the y (rows) dimension at the center of each cell.
Methods:
DICpy.dic2d.PostProcessing¶
- class DICpy.DIC_2D.PostProcessing(analysis_obj=None)[source]¶
Bases:
objectThis class contains the methods for visualizing the results of the DIC analysis. Input: * analysis_obj (object)
Object of the Analysis class.
Attributes:
- analysis_obj (float)
Object of the Analysis class.
- mesh_obj (object)
Object of the RectangularMesh class.
- strain11 (ndarray)
Strain xx at the center of each cell.
- strain22 (ndarray)
Strain yy at the center of each cell.
- strain12 (ndarray)
Strain xy at the center of each cell.
- strain21 (ndarray)
Strain yx (equal to Strain xy) at the center of each cell.
Methods:
- visualization(results='u', step=0, smooth=False)[source]¶
Method to plot the results in terms of displacements and strains.
Input: * results (str)
Visulaize the results: -‘u’: displacement x. -‘v’: displacement y. -‘e11’: strain xx. -‘e22’: strain yy: -‘e12’: strain xy. -‘e21’: strain yx.
- step (int)
Define the result for a given loading step.
- smooth (bool)
Gaussian filtering.
Output/Returns:
DICpy.DIC_2D.Synthetic¶
- class DICpy.DIC_2D.Synthetic(num_images=None, size=None, extension='png', random_state=None, save_images=True)[source]¶
Bases:
objectThis class contains the methods for generate synthetic data for the DIC analysis. Input:
Attributes:
- path_speckle (str)
Path to the speckle images.
- path_calibration (str)
Path to the calibration image.
- ref_image (ndarray)
Reference image.
- calibration_image (ndarray)
Calibration image.
- images (ndarray)
Gray images.
- images_normalized (ndarray)
Gray images normalized by 255.
- lx (int)
Number of columns of each image.
- ly (int)
Number of rows of each image.
- num_img (int)
Number of images.
- pixel_dim (float)
Size of each pixel in length dimension.
Methods: