93
97
% Initialize variables
94
input_points_x=grid_x;
95
98
base_points_x=grid_x;
97
input_points_y=grid_y;
98
99
base_points_y=grid_y;
101
input_points_x=validx(:,Imagenum);
102
input_points_y=validy(:,Imagenum);
103
input_points_x=single(validx(:,Imagenum));
104
input_points_y=single(validy(:,Imagenum));
106
input_points_x=validx(:,Imagenum);
107
input_points_y=validy(:,Imagenum);
112
input_points_x=single(grid_x);
113
input_points_y=single(grid_y);
115
input_points_x=grid_x;
116
input_points_y=grid_y;
106
120
[row,col]=size(base_points_x); % this will determine the number of rasterpoints we have to run through
279
normxcorr_hw(hwid, 3, input_points_x, input_points_y);
281
input_correl(:,1)=reshape(input_points_x,[],1); % we reshape the input points to one row of values since this is the shape cpcorr will accept
282
input_correl(:,2)=reshape(input_points_y,[],1);
264
285
for i=firstimage:(r-1) % run through all images
265
286
tic % start the timer
267
288
input = uint8(mean(double(imread([imagedir, filenamelist((i+1),:)])),3)); % read in the image which has to be correlated
269
input_points_for(:,1)=reshape(input_points_x,[],1); % we reshape the input points to one row of values since this is the shape cpcorr will accept
270
input_points_for(:,2)=reshape(input_points_y,[],1);
273
input_correl(:,:)=dic_cpcorr(CORRSIZE, PRECISION, OPTIMIZE, hwid, data_base, input_points_for, input); % here we go and give all the markers and images to process to cpcorr.m which ic a function provided by the matlab image processing toolbox
291
input_correl(:,:)=dic_cpcorr3(CORRSIZE, PRECISION, OPTIMIZE, hwid, data_base, input_correl, input);
293
input_correl(:,:)=dic_cpcorr(CORRSIZE, PRECISION, OPTIMIZE, hwid, data_base, input_correl, input);
275
input_correl(:,:)=cpcorr(input_points_for, base_points_for, input, base);
277
input_correl_x=input_correl(:,1); % the results we get from cpcorr for the x-direction
278
input_correl_y=input_correl(:,2); % the results we get from cpcorr for the y-direction
281
validx(:,i)=input_correl_x; % lets save the data
282
savelinex=input_correl_x';
283
dlmwrite([datadir, 'resultsimcorrx.txt'], savelinex , 'delimiter', '\t', '-append'); % Here we save the result from each image; if you are desperately want to run this function with e.g. matlab 6.5 then you should comment this line out. If you do that the data will be saved at the end of the correlation step - good luck ;-)
285
validy(:,i)=input_correl_y;
286
saveliney=input_correl_y';
287
dlmwrite([datadir, 'resultsimcorry.txt'], saveliney , 'delimiter', '\t', '-append');
289
% Update base and input points for cpcorr.m
290
input_points_x=input_correl_x;
291
input_points_y=input_correl_y;
295
input_correl(:,:)=cpcorr(input_correl, base_points_for, input, base);
297
validx(:,i)=double(input_correl(:,1)); % the results we get from cpcorr for the x-direction
298
validy(:,i)=double(input_correl(:,2)); % the results we get from cpcorr for the y-direction
301
savelinex=validx(:,i)';
302
dlmwrite([datadir, 'resultsimcorrx.txt'], savelinex , 'delimiter', '\t', '-append'); % Here we save the result from each image; if you are desperately want to run this function with e.g. matlab 6.5 then you should comment this line out. If you do that the data will be saved at the end of the correlation step - good luck ;-)
304
saveliney=validy(:,i)';
305
dlmwrite([datadir, 'resultsimcorry.txt'], saveliney , 'delimiter', '\t', '-append');
294
309
waitbar(i/(r-1)) % update the waitbar