Changeset 493 for trunk/src/civ_matlab.m


Ignore:
Timestamp:
Jul 16, 2012, 10:44:12 AM (12 years ago)
Author:
sommeria
Message:

various bugs repaired, tests in Windows OS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r492 r493  
    6060if ischar(Param)
    6161    Param=xml2struct(Param); %if Param is the name of an xml file, read this file as a Matlab structure
    62     if isfield(Param,'Civ1')
    63         if strcmp(Param.Civ1.FileTypeA,'video')
    64             Param.Civ1.ImageA=VideoReader(Param.Civ1.ImageA);
    65         elseif strcmp(Param.Civ1.FileTypeA,'mmreader')
    66             Param.Civ1.ImageA=mmreader(Param.Civ1.ImageA);
    67         end
    68         if strcmp(Param.Civ1.FileTypeB,'video')
    69             Param.Civ1.ImageB=VideoReader(Param.Civ1.ImageB);
    70         elseif strcmp(Param.Civ1.FileTypeB,'mmreader')
    71             Param.Civ1.ImageB=mmreader(Param.Civ1.ImageB);
    72         end
    73     end
    74     if isfield(Param,'Civ2')
    75         if strcmp(Param.Civ2.FileTypeA,'video')
    76             Param.Civ2.ImageA=VideoReader(Param.Civ2.ImageA);
    77         elseif strcmp(Param.Civ2.FileTypeA,'mmreader')
    78             Param.Civ2.ImageA=mmreader(Param.Civ2.ImageA);
    79         end
    80          if strcmp(Param.Civ2.FileTypeB,'video')
    81             Param.Civ2.ImageB=VideoReader(Param.Civ2.ImageB);
    82         elseif strcmp(Param.Civ2.FileTypeB,'mmreader')
    83             Param.Civ2.ImageB=mmreader(Param.Civ2.ImageB);
    84         end
    85     end
     62%     if isfield(Param,'Civ1')
     63%         if strcmp(Param.Civ1.FileTypeA,'video')
     64%             Param.Civ1.ImageA=VideoReader(regexprep(Param.Civ1.ImageA,'''','\'));% remove spurious ' appearing in Windows;
     65%         elseif strcmp(Param.Civ1.FileTypeA,'mmreader')
     66%             Param.Civ1.ImageA=mmreader(regexprep(Param.Civ1.ImageA,'''','\'));% remove spurious ' appearing in Windows
     67%         end
     68%         if strcmp(Param.Civ1.FileTypeB,'video')
     69%             Param.Civ1.ImageB=VideoReader(regexprep(Param.Civ1.ImageB,'''','\'));% remove spurious ' appearing in Windows
     70%         elseif strcmp(Param.Civ1.FileTypeB,'mmreader')
     71%             Param.Civ1.ImageB=mmreader(regexprep(Param.Civ1.ImageB,'''','\'));% remove spurious ' appearing in Windows
     72%         end
     73%     end
     74%     if isfield(Param,'Civ2')
     75%         if strcmp(Param.Civ2.FileTypeA,'video')
     76%             Param.Civ2.ImageA=VideoReader(regexprep(Param.Civ2.ImageA,'''','\'));% remove spurious ' appearing in Windows;
     77%         elseif strcmp(Param.Civ2.FileTypeA,'mmreader')
     78%             Param.Civ2.ImageA=mmreader(regexprep(Param.Civ2.ImageA,'''','\'));% remove spurious ' appearing in Windows
     79%             if strcmp(Param.Civ2.FileTypeB,'video')
     80%                 Param.Civ2.ImageB=VideoReader(regexprep(Param.Civ2.ImageB,'''','\'));% remove spurious ' appearing in Windows
     81%             elseif strcmp(Param.Civ2.FileTypeB,'mmreader')
     82%                 Param.Civ2.ImageB=mmreader(regexprep(Param.Civ2.ImageB,'''','\'));% remove spurious ' appearing in Windows
     83%             end;
     84%         end
     85%     end
    8686end
    8787
     
    9090    %     check_civ1=1;% test for further use of civ1 results
    9191    % %% prepare images
     92
    9293    par_civ1=Param.Civ1;
    9394    if isfield(par_civ1,'reverse_pair')
     
    102103        end
    103104    else
    104         if isfield(par_civ1,'ImageA')&&(ischar(par_civ1.ImageA)||strcmp(class(par_civ1.ImageA),'VideoReader')) % case with no image: only the PIV grid is calculated           
    105             [Field,ParamOut,errormsg] = read_field(Param.Civ1.ImageA,par_civ1.FileTypeA,par_civ1.ImageA,par_civ1.FrameIndexA);
    106             if ~isempty(errormsg)
    107                 errormsg=['error in civ_matlab/read_field:' errormsg];
    108                 return
    109             end
    110             par_civ1.ImageA=Field.A;%= image matrix A in the first input field
    111         end
    112         if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageB),'VideoReader'))
    113             [Field,ParamOut,errormsg] = read_field(Param.Civ1.ImageB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);
    114             if ~isempty(errormsg)
    115                 errormsg=['error in civ_matlab/read_field:' errormsg];
    116                 return
    117             end
    118             par_civ1.ImageB=Field.A;%= image matrix A in the second input field
     105        if isfield(par_civ1,'ImageA')%&&...
     106            %    (ischar(par_civ1.ImageA)||strcmp(class(par_civ1.ImageA),'VideoReader')||strcmp(class(par_civ1.ImageA),'mmreader')) % case with no image: only the PIV grid is calculated           
     107             Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'''','\');
     108            [par_civ1.ImageA,ParamOut] = read_image(Param.Civ1.ImageA,par_civ1.FileTypeA,par_civ1.ImageA,par_civ1.FrameIndexA);
     109%             if ~isempty(errormsg)
     110%                 errormsg=['error in civ_matlab/read_field:' errormsg];
     111%                 return
     112%             end
     113            %par_civ1.ImageA=Field.A;%= image matrix A in the first input field
     114        end
     115        if isfield(par_civ1,'ImageB')%&& ...
     116              %  (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageB),'VideoReader')||strcmp(class(par_civ1.ImageB),'mmreader'))
     117             Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'''','\');
     118            [par_civ1.ImageB,ParamOut] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);
     119%             if ~isempty(errormsg)
     120%                 errormsg=['error in civ_matlab/read_field:' errormsg];
     121%                 return
     122%             end
     123           % par_civ1.ImageB=Field.A;%= image matrix A in the second input field
    119124        end
    120125    end
     
    444449%
    445450%INPUT:
    446 % image1:first image (matrix)
     451% par_civ: structure of input parameters, with fields:
     452%  .CorrBoxSize
     453%  .SearchBoxSize
     454%  .SearchBoxShift
     455%  .ImageHeight
     456%  .ImageWidth
     457%  .Dx, Dy
     458%  .Grid
     459%  .Mask
     460%  .MinIma
     461%  .MaxIma
     462%  .image1:first image (matrix)
    447463% image2: second image (matrix)
    448464% ibx2,iby2: half size of the correlation box along x and y, in px (size=(2*iby2+1,2*ibx2+1)
Note: See TracChangeset for help on using the changeset viewer.