Digital Image Correlation Two Threads
30 Dec 2006
02 Jan 2007)
Starts two instances of matlab divides the grid and merges validx and validy, Needs Digital Image Co
% Code to process images in two threads
% Programmed by Chris
% Last revision: 12/28/06
% The automation function is the central function and processes all markers and
% images by the use of the matlab function cpcorr.m.
% Therefore the Current directory in matlab has to be the folder where
% automate_image_twothreads.m finds the filenamelist.mat, grid_x.dat and grid_y.dat as well
% as the images specified in filenamelist.mat. Just type automate_image_twothreads; and
% press ENTER at the command line of matlab.
% At first, automate_image_twothreads.m will open the first image in the filenamelist.mat and
% plot the grid as green crosses on top. The next step will need some time since
% all markers in that image have to be processed for the first image. After correlating
% image one and two the new raster positions will be plotted as red crosses. On top
% of the image and the green crosses. The time it will take to process
% all images will be plotted on the figure but can easily be estimated by knowing the
% raster point processing speed of your hardware.
% Depending on the number of images and markers you are tracking, this process
% can take between seconds and days. For 100 images and 200 markers a decent
% computer should need 200 seconds. To get a better resolution you can always
% run jobs overnight (e.g. 6000 markers in 1000 images) with higher resolutions.
% Keep in mind that CORRSIZE which you changed in cpcorr.m will limit your
% resolution. If you chose to use the 15 pixel as suggested a marker distance of
% 30 pixel will lead to a full cover of the strain field. Choosing smaller marker
% distances will lead to an interpolation since two neighboring markers share
% pixels. Nevertheless a higher marker density can reduce the noise of the strain field.
% After all images are processed, automate_image_twothreads will write the files
% validx.dat and validy.dat. The *.dat text files are meant to store the result in a
% format which can be accessed by other programs also in the future.
% Load necessary files
load('grid_x.dat'); % file with x position, created by grid_generator.m
load('grid_y.dat'); % file with y position, created by grid_generator.m
load('filenamelist'); % file with the list of filenames to be processed
% split up the marker matrix
% Save the current work directory and start two threads of matlab to
% process the images
save workdirectory.dat workdirectory -ascii;
% Wait for the two threads to finish their task and load the files to merge
while exist('end1.txt','file') ==0;
while exist('end2.txt','file') ==0;
function [validx, validy]=mergevalidxy(validx1,validx2,validy1,validy2);
% Written by Chris.
% After processig the marker grid, split by splitmatrix.m and processing
% all images with automate_image_session1.m and automate_image_session2.m
% you have to merge the results to one validx and one validy to process the
% results with displacement.m
save validx.dat validx -ascii -tabs;
save validy.dat validy -ascii -tabs;
% This functions splits up the grid_x and the grid_y matrix of markers
% created by grid_generator.m. You can now start automate_image_session1.m
% and automate_image_session2.m in two matlab sessions to use more two
% processors ore dual processors.
% After processiong all images you have to merge the matrices to get validx
% and validy
save grid_x1.dat grid_x1 -ascii -tabs;
save grid_x2.dat grid_x2 -ascii -tabs;
save grid_y1.dat grid_y1 -ascii -tabs;
save grid_y2.dat grid_y2 -ascii -tabs;