44
44
% 2 - The CUDA matlab plugin is used to compute FFT's
45
45
% 3 - Most of computations are performed on NVidia card
46
46
% 4 - Optimize FFT sizes for better performance (affects precision)
47
% 5 - Load images in C code
47
48
% You can safely set an optimization level to 3. If NVidia card is not available
48
49
% the level will be automatically reduced to 1.
172
base = uint8(mean(double(imread([imagedir, filenamelist(1,:)])),3)); % read in the base image ( which is always image number one. You might want to change that to improve correlation results in case the light conditions are changing during the experiment
175
% crop_dim = [min(base_points_x(:)) - 2*CORRSIZE, min(base_points_y(:)) - 2 * CORRSIZE, max(base_points_x(:)) + 2*CORRSIZE, max(base_points_y(:)) + 2 * CORRSIZE]
176
% crop_size = (crop_dim(3) - crop_dim(1)) * (crop_dim(4) - crop_dim(2))
177
% mesh_size = ncp * 4 * CORRSIZE * CORRSIZE
179
179
% Verification of GPU local sum and denom computations
180
180
% dic_basecorr3(CORRSIZE, PRECISION, OPTIMIZE, hwid, base_points_x, base_points_y, base);
183
base_points_for(:,1)=reshape(base_points_x,[],1);
184
base_points_for(:,2)=reshape(base_points_y,[],1);
186
data_base(icp).base_fractional_offset = base_points_for(icp,:) - round(base_points_for(icp,:)*PRECISION)/PRECISION;
189
182
normxcorr_hw(hwid, 3, base_points_x, base_points_y);
190
normxcorr_hw(hwid, 4, base);
184
normxcorr_hw(hwid, 4, strcat(imagedir, filenamelist(1,:)));
186
base = uint8(mean(double(imread([imagedir, filenamelist(1,:)])),3)); % read in the base image ( which is always image number one. You might want to change that to improve correlation results in case the light conditions are changing during the experiment
187
normxcorr_hw(hwid, 4, base);
190
base = uint8(mean(double(imread([imagedir, filenamelist(1,:)])),3)); % read in the base image ( which is always image number one. You might want to change that to improve correlation results in case the light conditions are changing during the experiment
192
191
base_points_for(:,1)=reshape(base_points_x,[],1);
193
192
base_points_for(:,2)=reshape(base_points_y,[],1);
269
268
input_correl(:,2)=reshape(input_points_y,[],1);
272
input = uint8(mean(double(imread([imagedir, filenamelist((firstimage+1),:)])),3)); % read in the image which has to be correlated
273
271
for i=firstimage:(r-1) % run through all images
274
272
tic % start the timer
276
% input = uint8(mean(double(imread([imagedir, filenamelist((i+1),:)])),3)); % read in the image which has to be correlated
276
normxcorr_hw(hwid, 13, strcat(imagedir, filenamelist((i+1),:)));
277
input_correl = normxcorr_hw(hwid, 14);
279
279
%Validate findpeak
280
280
%dic_cpcorr3(CORRSIZE, PRECISION, OPTIMIZE, hwid, ncp, input);
282
input = uint8(mean(double(imread([imagedir, filenamelist((i+1),:)])),3)); % read in the image which has to be correlated
281
283
normxcorr_hw(hwid, 13, input)
283
input = uint8(mean(double(imread([imagedir, filenamelist((i+2),:)])),3)); % read in the image which has to be correlated
285
284
input_correl = normxcorr_hw(hwid, 14);
286
285
elseif OPTIMIZE > 0
286
input = uint8(mean(double(imread([imagedir, filenamelist((i+1),:)])),3)); % read in the image which has to be correlated
287
287
input_correl(:,:)=dic_cpcorr(CORRSIZE, PRECISION, OPTIMIZE, hwid, data_base, input_correl, input);
289
input = uint8(mean(double(imread([imagedir, filenamelist((i+1),:)])),3)); % read in the image which has to be correlated
289
290
input_correl(:,:)=cpcorr(input_correl, base_points_for, input, base);