Skip to content

Commit a4f812e

Browse files
committed
new features:
Checkbox is added to either use/ignore preprocessing of the images prior to correlations preprocess_template.m shows the API: image in -> image processing -> image out quiverm and quivertxt got slight updates
1 parent 4d1845a commit a4f812e

File tree

7 files changed

+72
-10
lines changed

7 files changed

+72
-10
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
lastpath.mat
1+
lastpath.mat
2+
/*.m~

README

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ it is stable and tested. However testing and contributing is very welcome, espec
55

66
Website
77
--------
8-
http://www.openpiv.net/default.html
8+
http://www.openpiv.net
9+
10+
11+
Download
12+
---------
13+
http://www.openpiv.net/downloads.html
14+
15+
Source
16+
---------
17+
http://www.github.com/alexlib/openpiv-matlab
918

1019

1120
Documentation

openpiv_gui.fig

593 Bytes
Binary file not shown.

openpiv_gui.m

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
% Edit the above text to modify the response to help openpiv_gui
2424

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
2626

2727
% Begin initialization code - DO NOT EDIT
2828
gui_Singleton = 1;
@@ -185,6 +185,13 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
185185
sclt = str2double(get(handles.edit_scale,'string'));
186186
outl = str2double(get(handles.edit_outl,'string'));
187187

188+
preprocess = get(handles.checkbox1,'Value');
189+
if preprocess
190+
prepfun = str2func(handles.preprocess);
191+
else
192+
prepfun = inline('x');
193+
end
194+
188195
if isfield(handles,'rect') && ~isempty(handles.rect)
189196
cropvec = handles.rect;
190197
else
@@ -220,6 +227,10 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
220227

221228
[a,b,a1,b1,origin] = read_pair_of_images_rect(image1,image2,cropvec,ittWidth,ittHeight,ovlapHor,ovlapVer);
222229

230+
a1 = prepfun(a1);
231+
b1 = prepfun(b1);
232+
233+
223234
[verSize,horSize]= size(a1);
224235

225236
% Prepare the results storage;
@@ -243,6 +254,9 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
243254
if (get(hObject,'UserData') == 1)
244255
a2 = a1(m:m+ittHeight-1,k:k+ittWidth-1);
245256
b2 = b1(m:m+ittHeight-1,k:k+ittWidth-1);
257+
258+
% a2 = prepfun(a2);
259+
% b2 = prepfun(b2);
246260

247261
c = cross_correlate_rect(a2,b2,NfftHeight,NfftWidth);
248262
% c = cross_correlate_rect(a2,b2,Nfftx,Nffty);
@@ -366,6 +380,9 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
366380

367381
[a,b,a1,b1,origin] = read_pair_of_images_rect(image1,image2,cropvec,ittWidth,ittHeight,ovlapHor,ovlapVer);
368382

383+
a1 = prepfun(a1);
384+
b1 = prepfun(b1);
385+
369386
[verSize,horSize]= size(a1);
370387

371388
% Prepare the results storage;
@@ -392,6 +409,7 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
392409

393410
a2 = a1(m:m+ittHeight-1,k:k+ittWidth-1);
394411
b2 = b1(m:m+ittHeight-1,k:k+ittWidth-1);
412+
395413

396414
c = cross_correlate_rect(a2,b2,NfftHeight,NfftWidth);
397415
% c = cross_correlate_rect(a2,b2,Nfftx,Nffty);
@@ -439,7 +457,7 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
439457
vector = u + sqrt(-1)*v;
440458

441459
% 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;
443461
u = real(vector);
444462
v = imag(vector);
445463

@@ -454,8 +472,8 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
454472
% 2. For velocity vector length (and angle)
455473
% 3. OR OTHER.
456474

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));
459477
u_out = find(tmpu>lmtu);
460478
v_out = find(tmpv>lmtv);
461479

@@ -498,8 +516,8 @@ function pushbutton_start_Callback(hObject, eventdata, handles)
498516
% Only for final, filtered and interpolated data
499517
% imshow(a,[]);
500518
% hold on
501-
quiverm(res,2,'g','LineWidth',1);
502-
drawnow
519+
% quiverm(res,2,'g','LineWidth',1);
520+
% drawnow
503521
% F(:,fileind) = getframe;
504522
hold off;
505523
end
@@ -1406,3 +1424,31 @@ function plotarrow(x,y,u,v,color,scale)
14061424
hv = [y+v-alpha*(v-beta*(u+eps));y+v; ...
14071425
y+v-alpha*(v+beta*(u+eps));NaN];
14081426
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+

preprocess_template.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
function out = preprocess_template(im)% PREPROCESS_TEMPLATE - One line description of what the function or script performs (H1 line)% Optional file header info (to give more details about the function than in the H1 line)%% Syntax:out = preprocess_template(im)%% Inputs:%% im - Description%% Outputs:%% out - Description%% Example:%% Line 1 of example %% Subfunctions: % See also: % AUTHOR : Alex Liberzon % Copyright (c)2012 Tel Aviv University%%out = adapthisteq(im);

quiverm.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
% without outliers.
1515
% on IHW_Video
1616

17-
if isstr(x)
17+
if ischar(x)
1818
x = eval(x);
1919
end
2020

quivertxt.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
% Date: July '99
99
%
1010

11-
x = load([txtfile,'.txt']);
11+
[~,~,ext] = fileparts(txtfile);
12+
if isempty(ext)
13+
x = load([txtfile,'.txt']);
14+
else
15+
x = load(txtfile);
16+
end
1217
quiverm(x,varargin{:});
1318
axis ij
1419
axis tight

0 commit comments

Comments
 (0)