Changeset 337 for trunk/src


Ignore:
Timestamp:
Dec 16, 2011, 3:45:03 PM (13 years ago)
Author:
gostiaux
Message:

Added the reverse_pair (need to uncomment line 57)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r331 r337  
    5454    check_civ1=1;% test for further use of civ1 results
    5555    % caluclate velocity data (y and v in indices, reverse to y component)
    56     [xtable ytable utable vtable ctable F result_conv errormsg] = civ (Param.Civ1);
     56    [xtable1 ytable1 utable1 vtable1 ctable1 F1 result_conv1 errormsg1] = civ (Param.Civ1);
     57
     58    % to try the reverse_pair method, uncomment below
     59%     Param.Civ1.reverse_pair=1;
     60%     [xtable2 ytable2 utable2 vtable2 ctable2 F2 result_conv2 errormsg2] = civ (Param.Civ1);
     61
     62    xtable=[xtable1; xtable2];
     63    ytable=[ytable1; ytable2];
     64    utable=[utable1; -utable2];
     65    vtable=[vtable1; -vtable2];
     66    ctable=[ctable1; ctable2];
     67    F=[F1; F2];
     68    result_conv=[result_conv1; result_conv2];
     69    errormsg=[errormsg1; errormsg2];
     70   
     71%     xtable=mean(xtable1,xtable2);
     72%     ytable=mean(ytable1,ytable2);
     73%     utable=mean(utable1,utable2);
     74%     vtable=mean(vtable1,vtable2);   
     75   
    5776    if ~isempty(errormsg)
    5877        return
     
    389408
    390409%% prepare images
    391 if ischar(par_civ.ImageA)
    392     par_civ.ImageA=imread(par_civ.ImageA);
    393 end
    394 if ischar(par_civ.ImageB)
    395     par_civ.ImageB=imread(par_civ.ImageB);
    396 end
     410if isfield(par_civ,'reverse_pair')
     411    if par_civ.reverse_pair
     412        if ischar(par_civ.ImageB)
     413            temp=par_civ.ImageA;
     414            par_civ.ImageA=imread(par_civ.ImageB);
     415        end
     416        if ischar(temp)
     417            par_civ.ImageB=imread(temp);
     418        end
     419    end
     420else
     421    if ischar(par_civ.ImageA)
     422        par_civ.ImageA=imread(par_civ.ImageA);
     423    end
     424    if ischar(par_civ.ImageB)
     425        par_civ.ImageB=imread(par_civ.ImageB);
     426    end
     427end
     428
    397429[npy_ima npx_ima]=size(par_civ.ImageA);
    398430if ~isequal(size(par_civ.ImageB),[npy_ima npx_ima])
     
    503535
    504536% if (x <= (size(result_conv,1)-1)) && (y <= (size(result_conv,1)-1)) && (x >= 1) && (y >= 1)
    505     %the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion – Israel Institute of Technology
     537    %the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ï¿œ Israel Institute of Technology
    506538    %http://urapiv.wordpress.com
    507539    peaky = y;
     
    539571        for j=-1:1
    540572            %following 15 lines based on
    541             %H. Nobach Æ M. Honkanen (2005)
     573            %H. Nobach ï¿œ M. Honkanen (2005)
    542574            %Two-dimensional Gaussian regression for sub-pixel displacement
    543575            %estimation in particle image velocimetry or particle position
    544576            %estimation in particle tracking velocimetry
    545             %Experiments in Fluids (2005) 38: 511–515
     577            %Experiments in Fluids (2005) 38: 511ï¿œ515
    546578            c10(j+2,i+2)=i*log(result_conv(y+j, x+i));
    547579            c01(j+2,i+2)=j*log(result_conv(y+j, x+i));
Note: See TracChangeset for help on using the changeset viewer.