Code covered by the BSD License  

Highlights from
Improved Digital Image Correlation (DIC)

5.0

5.0 | 7 ratings Rate this file 169 Downloads (last 30 days) File Size: 6.95 MB File ID: #43073
image thumbnail

Improved Digital Image Correlation (DIC)

by

 

14 Aug 2013 (Updated )

Calculate full-field displacements and strains from a set of images with a random speckle pattern.

| Watch this File

File Information
Description

Digital Image Correlation (DIC) is an optical, non-contact method to measure full-field displacements and strains. The only requirement is that the test specimen has a random speckle pattern on its surface, either generated by the experimentalist (i.e. random paint pattern) or occurring naturally (i.e. surface texture at large magnifications). There is no inherent length scale to DIC - by choosing the appropriate magnification of images and the corresponding speckle size, DIC can be used to measure displacements from the meter scale to the micron scale.

This set of Matlab .m files forms a complete DIC code. Given a set of images taken periodically during deformation of a specimen, this code will analyze the images and output full-field displacements and full field strains over the field of view captured in the images. In contrast to commercially available DIC software, this code can be fully customized by the user by editing the .m files directly.

Comments and questions about the code are welcomed. Please contact the author, Elizabeth Jones, at ElizabethMCJones@gmail.com.

Acknowledgements

Freeze Colors / Unfreeze Colors, Matlab Parfor Progress2, and Digital Image Correlation And Tracking inspired this file.

Required Products Image Processing Toolbox
Parallel Computing Toolbox
Statistics Toolbox
MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Other requirements This code has been tested on a PC running Matlab 2012b, and on both a PC and a Mac running Matlab 2011a.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (20)
11 Sep 2014 Elizabeth Jones

Hi Jorge,

Yes, you can get the average values from the plot generated using the "Spatial Average" function. Simply save the plot, close out of the GUI, open the plot, and then use the following code:

ax = gca; %Gets the current axis
objs = get(ax,'children'); %Gets the objects of the current axis
y_data = get(objs,'ydata'); %Gets the y-data from the objects, i.e. the average strain values

The above method is a general method that you can use to get the data from any plot in Matlab. I have considered making an option directly in the GUI to save the data as a .mat file in addition to plotting the data, but as of now, I have not implemented this functionality. However, the method described above will work with little extra effort.

Thank,
Elizabeth

10 Sep 2014 jorge

Hello Elizabeth,

I would like to know if it´s possible to get a list of average values of strain over entire images. i mean, can i get the values of the average strain plotted in spatial Average plots?

14 May 2014 Alberto

Yes, thank you very much Elizabeth! More or less I've managed to get what I wanted.

Best,

Alberto.

13 May 2014 Elizabeth Jones

Hi Alberto,

I am not familiar with the PIVMat Toolbox, so I am not sure what the best way is to reformat the data from my DIC code for use with the PIVMat Toolbox. However, from your description, it looks like you need the x- and y-coordinates of the control points and the u- and v- components of the displacements. (I assume you want the displacement components when you say velocity components?) The grid coordinates are found in the .mat file “grid_data”, and the displacement components are found in the .mat file “disp_raw_data” (for the raw correlation data) and “disp_smooth_data” (for the smoothed displacement field, if you have run “compute_data_GUI”). Does this provide the information you need?

Cheers,
Elizabeth

07 May 2014 Alberto

Hi Elizabeth!

I am using your code so as to then post process the vector field with PIVMat Toolbox to reconstruct the height of the surface, but the latter (in particular, the function 'plotvec.m') requires an specific format for the .mat files to work. It includes the x and y coordinates, the x and y velocity components, etc. :

For vector fields, the PIVMat structure F contains the following fields:
x,y vectors containing the X and Y coordinates
vx,vy (vz) matrices of the x, y (and z) components of the velocity
ysign string, upward or downward Y axis
namevx, unitvx, namex, unitx... strings
name name of the VEC/VC7 file from which originates V
setname name of the parent directory (called 'SET' in DaVis)
Attributes Additional informations from DaVis (see getattribute)
choice An array of 6 integers, giving the 1st, 2nd, 3rd, 4th choice vectors, the number of filled/processed vectors and the number of missing vectors.
history Remind from which command V has been obtained

Do you know if there is a simple way to get this format from the files your code provide? If not, could you tell me in which files I can find the information I need?

Thank you in advance.

Best regards,

Alberto.

22 Apr 2014 Deborah

Thank you very much Elizabeth!

18 Apr 2014 Elizabeth Jones

Hi Deborah,

Poisson's ratio is the negative of the ratio of the axial strain to the transverse strain when a specimen is undergoing uniaxial tension or uniaxial compression. If the direction of force is, for example, in the y-direction, then Poisson's ratio = -e_yy / e_xx. Assuming you don't have plastic deformation, using the large strains (E_yy and E_xx) will give the same result.

To access the small and large strains, load "DU_data" into your workspace. All of the strain matrices are in the structures "large_strain" and "small_strain".

Cheers,
Elizabeth

17 Apr 2014 Deborah

Hi Elizabeth!

I wanted to know if it is possible to calculate the poisson's ratio from the large strain and small strain values, Exx, Eyy and exx, eyy.

hope to hear from you soon!

thank you,
Deborah

11 Apr 2014 Marcraven

Hi again Elisabeth,

Thank you for your previous answer, that was exactly what I needed.

I expose my new doubts:

In the dispx_raw and dispy_raw matrixes, the element number 1 is the top left and the last is the bottom right of the correlation? If so: The sequence is row by row or column by column?

I am trying to remove the rigid body displacement from my correlation by taking the first element displacement and substract it from every other element displacement in every image.
This would theoretically give me just the relative displacement between the first element and the rest. Am I right?

Best regards,

11 Apr 2014 Marcraven  
11 Mar 2014 Di  
02 Jan 2014 Elizabeth Jones

Hi Stephen,

You have the choice to run the code in serial mode or in parallel mode. The benefit to running the code in parallel mode is the reduced computation time, but it does require the Parallel Computing Toolbox. If you do not have the Parallel Computing Toolbox, you may run the code in serial mode. You'll get the same results, but it will take longer to process large batches of images.

Thanks,
Elizabeth

02 Jan 2014 Stephen

Elizabeth,

I am using a student license of MATLAB, and I do not have the parallel computing toolbox. Is the parallel computing merely an option, or will I require the toolbox to run the code at all?

Thanks!

04 Dec 2013 Elizabeth Jones

Hi Marcraven,

Thanks for your interest in my DIC code. There are two principle displacement data files. The first, disp_raw_data.mat, is generated when you run “correlate_images_GUI”, and is a calculation of the displacements before any smoothing has been done. These displacements are in terms of pixels. The second, disp_smooth_data.mat, is generated when you run “compute_data_GUI.” These displacements are scaled and smoothed according to the parameters you set in “compute_data_GUI.”

To work with the raw displacements, type “load disp_raw_data” in the command window. Two variables, dispx_raw and dispy_raw, should now be in your workspace. These matrices are the horizontal (x) and vertical (y) displacements respectively. The rows of the matrices represent the control points from your correlation, and the columns represent the images that you correlated. For example, the x-displacements for image 5 would be the entire column 5 of dispx_raw.

Similarly, to work with the scaled and smoothed displacements, type “load disp_smooth_data” into the command window, and the two variables dispx_smooth and dispy_smooth will be in your workspace.

Please let me know if you have further questions.

Sincerely,
Elizabeth

27 Nov 2013 Marcraven

Hello Elizabeth!

I have been using your code for the last two weeks and it is great! Thanks a lot.

By the way, I would like to use the displacement matrix to calculate the error of the correlation (max error and average). How is the displacement matrix called in your code?

Thanks a lot

26 Nov 2013 Elizabeth Jones

Hi Mikhail,

Thank you for your comments and suggestions. Most of the areas you suggest for improvement are parts of the code that I personally don’t use frequently (such as the delete_data_GUI, any stress calculations, correcting for rigid body motion in the displacements), and therefore they have not received as much attention as other portions of the code. You are always welcome to modify the code yourself, and if you’d like, I’d be happy to post any improvements to this site, so that other users can benefit as well.

Concerning your first comment, you need to be careful when performing multiple correlations on one set of images. You always need to set your working directory to the folder containing the images you wish to correlate, but after a correlation is complete, you can move all the data files generated during the correlation to a new folder. I recommend always starting a correlation with no files from previous correlations in the working folder. This will prevent you from seeing results from a previous correlation when you are trying to view results from a current correlation. Please let me know if you have further questions regarding this part of the code.

Thank you,
Elizabeth

17 Nov 2013 Mikhail Seleznev

Hello, Elizabeth!

Thank you very much for this work, you've done a great job!

I just wanted to add some notes/questions as a "non-professional" user, so may be someone will have a time for code improvement. Or find what I've didn't.

1. When you want to see the full-image correlation results (after initial guess finding), Visualize_data_GUI shows the results of previous calculations. So you have to start compute_data_GUI "blind", then visualize_data_GUI switch to the new result.

2 . There is no possibility of displacement correction (this function is present, for example, in VEDDAC software). It allows to remove the object moving component from the displacement data and consider only deformation-related displacement. Of course this function does not affect the calculation of deformation, but you can't estimate the deformation-related displacement, which is negligibly small against sample shift.

3 . Code delete_data_GUI is not very convenient to use:
- can't undo the action: one mistake and you have to start over;
- There is only one tool removing items - a task corners of the rectangle ;
- can't zoom in ;
- The images are not visible behind a dense grid;

4 It would be great to count stress tensor in the end. The code should be easy: we just need a strain tensor, Young's modulus and Poisson coefficient

Best regards,
Mikhail.

17 Sep 2013 Elizabeth Jones

For users of Matlab 2013a and 2013b:

A change between Matlab 2012b, which was used to write this code, and 2013a/b causes the progress bar during the correlation of the images to not work properly when operating in parallel mode. To fix this issue, please download the latest version of the progress bar code from File Exchange number 35609 (http://www.mathworks.com/matlabcentral/fileexchange/35609) and replace the progress bar files included with the DIC codes with the new ones.

Thanks,
Elizabeth

11 Sep 2013 Elizabeth Jones

Hi Miguel,

We talked via email, but I wanted to share my comments with other users of this code.

1. Concerning choosing an appropriate subset size when using DIC, it is typically a subjective process, like I described in Sec. 5.3 and Sec. 6.4 of the documentation included with this code. There are, however, research efforts that look into more objective methods for determining the appropriate subset size, such as the references shown below. Note that this is not an exhaustive reference list on this topic.

Yaofeng, S. and Pang, J.H.L. Optics and Lasers in Engineering 45 (2007) 967-974

Pan, B., et. al. Optics Express 16 (2008) 7037-7048

2. If your sample does not cover the entire image, then you can select your grid of control points only over your region of interest. There is no reason to have control points on the image background.

3. The coefficient of thermal expansion of a material is a material property. I do not understand your comment about adjusting the CTE of copper.

Cheers,
Elizabeth

05 Sep 2013 Miguelcm90

Dear Friends,

I am a student user of this code. I would like to have more information about how it is the best way to decide the subset size. I am measuring the coeficient of thermal expansion of diferent materials, and this code is useful to calculate the displacements. It shows me clearly how are the displacements, but I have not too much idea how to decide and adapt the subset.

I am using pictures of 4272x2482 px Resolution.

In this picture is located the sample, so the grid is not in full picture. Should I do another thing instead correlate the full picture?.

Also, I know the CTE of Copper, which is 16 ppm/K but to be honest, I do not know how to adjust this parameter, or I have to correlate in another way.

Any help is welcome, and heartfelt thanks,

Miguel

Updates
15 Aug 2013

130814 - Edited the acknowledgements.

15 Aug 2013

130814 - Edited the acknowledgements.

Contact us