22
22
23
23
% Edit the above text to modify the response to help openpiv_gui
24
24
25
- % Last Modified by GUIDE v2.5 04 -Feb-2012 22:27:17
25
+ % Last Modified by GUIDE v2.5 05 -Feb-2012 00:59:10
26
26
27
27
% Begin initialization code - DO NOT EDIT
28
28
gui_Singleton = 1;
@@ -185,6 +185,13 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
185
185
sclt = str2double(get(handles.edit_scale,'string'));
186
186
outl = str2double(get(handles.edit_outl,'string'));
187
187
188
+ preprocess = get(handles.checkbox1,'Value');
189
+ if preprocess
190
+ prepfun = str2func(handles.preprocess);
191
+ else
192
+ prepfun = inline('x');
193
+ end
194
+
188
195
if isfield(handles,'rect') && ~isempty(handles.rect)
189
196
cropvec = handles.rect;
190
197
else
@@ -220,6 +227,10 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
220
227
221
228
[a,b,a1,b1,origin] = read_pair_of_images_rect(image1,image2,cropvec,ittWidth,ittHeight,ovlapHor,ovlapVer);
222
229
230
+ a1 = prepfun(a1);
231
+ b1 = prepfun(b1);
232
+
233
+
223
234
[verSize,horSize]= size(a1);
224
235
225
236
% Prepare the results storage;
@@ -243,6 +254,9 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
243
254
if (get(hObject,'UserData') == 1)
244
255
a2 = a1(m:m+ittHeight-1,k:k+ittWidth-1);
245
256
b2 = b1(m:m+ittHeight-1,k:k+ittWidth-1);
257
+
258
+ % a2 = prepfun(a2);
259
+ % b2 = prepfun(b2);
246
260
247
261
c = cross_correlate_rect(a2,b2,NfftHeight,NfftWidth);
248
262
% c = cross_correlate_rect(a2,b2,Nfftx,Nffty);
@@ -366,6 +380,9 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
366
380
367
381
[a,b,a1,b1,origin] = read_pair_of_images_rect(image1,image2,cropvec,ittWidth,ittHeight,ovlapHor,ovlapVer);
368
382
383
+ a1 = prepfun(a1);
384
+ b1 = prepfun(b1);
385
+
369
386
[verSize,horSize]= size(a1);
370
387
371
388
% Prepare the results storage;
@@ -392,6 +409,7 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
392
409
393
410
a2 = a1(m:m+ittHeight-1,k:k+ittWidth-1);
394
411
b2 = b1(m:m+ittHeight-1,k:k+ittWidth-1);
412
+
395
413
396
414
c = cross_correlate_rect(a2,b2,NfftHeight,NfftWidth);
397
415
% c = cross_correlate_rect(a2,b2,Nfftx,Nffty);
@@ -439,7 +457,7 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
439
457
vector = u + sqrt(-1)*v;
440
458
441
459
% Remove outlayers - GLOBAL FILTERING
442
- vector(abs(vector)>mean(abs(vector(find (vector))))*outl) = 0;
460
+ vector(abs(vector)>mean(abs(vector((vector))))*outl) = 0;
443
461
u = real(vector);
444
462
v = imag(vector);
445
463
@@ -454,8 +472,8 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
454
472
% 2. For velocity vector length (and angle)
455
473
% 3. OR OTHER.
456
474
457
- lmtv = mean(tmpv(find( tmpv))) + 3*std(tmpv(find( tmpv) ));
458
- lmtu = mean(tmpu(find( tmpu))) + 3*std(tmpu(find( tmpu) ));
475
+ lmtv = mean(tmpv(tmpv)) + 3*std(tmpv(tmpv));
476
+ lmtu = mean(tmpu(tmpu)) + 3*std(tmpu(tmpu));
459
477
u_out = find(tmpu>lmtu);
460
478
v_out = find(tmpv>lmtv);
461
479
@@ -498,8 +516,8 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
498
516
% Only for final, filtered and interpolated data
499
517
% imshow(a,[]);
500
518
% hold on
501
- quiverm(res,2,'g','LineWidth',1);
502
- drawnow
519
+ % quiverm(res,2,'g','LineWidth',1);
520
+ % drawnow
503
521
% F(:,fileind) = getframe;
504
522
hold off;
505
523
end
@@ -1406,3 +1424,31 @@ function plotarrow(x,y,u,v,color,scale)
1406
1424
hv = [y+v-alpha*(v-beta*(u+eps));y+v; ...
1407
1425
y+v-alpha*(v+beta*(u+eps));NaN];
1408
1426
h2 = plot(hu(:),hv(:),'Color',color,'EraseMode','none');
1427
+
1428
+
1429
+ % --- Executes on button press in checkbox1.
1430
+ function checkbox1_Callback(hObject, eventdata, handles)
1431
+ % hObject handle to checkbox1 (see GCBO)
1432
+ % eventdata reserved - to be defined in a future version of MATLAB
1433
+ % handles structure with handles and user data (see GUIDATA)
1434
+
1435
+ % Hint: get(hObject,'Value') returns toggle state of checkbox1
1436
+ if get(hObject,'Value')
1437
+ % if checked
1438
+ set(handles.pushbutton8,'Enable','on');
1439
+ else
1440
+ set(handles.pushbutton8,'Enable','off');
1441
+ end
1442
+
1443
+
1444
+
1445
+ % --- Executes on button press in pushbutton8.
1446
+ function pushbutton8_Callback(hObject, eventdata, handles)
1447
+ % hObject handle to pushbutton8 (see GCBO)
1448
+ % eventdata reserved - to be defined in a future version of MATLAB
1449
+ % handles structure with handles and user data (see GUIDATA)
1450
+ preprocess_mfile = uigetfile('*.m','Pick an M-file');
1451
+ handles.preprocess = preprocess_mfile(1:end-2);
1452
+ guidata(handles.figure1,handles);
1453
+
1454
+
0 commit comments