Changeset 397 for trunk/src/civ.m


Ignore:
Timestamp:
Apr 26, 2012, 8:59:09 AM (12 years ago)
Author:
sommeria
Message:

civ_matlab and patch improved, changes in the management of interpolation (still in progress).
adapatation to movies (use of VideoReader?)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r389 r397  
    520520            dt=0.04;%default
    521521            if exist([RootName ext_imadoc],'file')==2
    522                 info=aviinfo([RootName ext_imadoc]);%read infos on the avi movie
    523                 dt=1/info.FramesPerSecond;%time interval between successive frames
    524                 MaxIndex_i=info.NumFrames;%number of frames
    525             end
    526             time=(dt*(0:MaxIndex_i-1))';%list of image times
    527             TimeUnit='s';
    528     end
    529     set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
    530 end
    531 
     522                hhh=which('videoreader');
     523                if isempty(hhh)%use old video function of matlab
     524                    imainfo=aviinfo([RootName ext_imadoc]);%read infos on the avi movie
     525                    dt=1/imainfo.FramesPerSecond;%time interval between successive frames
     526                    MaxIndex_i=imainfo.NumFrames;%number of frames
     527                    %         XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
     528                    %         nbfield=imainfo.NumFrames;
     529                    %         set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
     530                    %         ColorType=imainfo.ImageType;%='truecolor' for color images
     531                else %use video function videoreader of matlab
     532                    imainfo=get(videoreader([RootName ext_imadoc]));%read infos on the avi movie
     533                    dt=1/imainfo.FrameRate;%time interval between successive frames
     534                    MaxIndex_i=imainfo.NumberOfFrames;%number of frames
     535                    %         XmlData.Time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)';
     536                    %         nbfield=imainfo.NumberOfFrames;
     537                    %         set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
     538                    %         ColorType='truecolor';
     539                end
     540               
     541                time=(dt*(0:MaxIndex_i-1))';%list of image times
     542                TimeUnit='s';
     543            end
     544            set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
     545    end
     546end
    532547%% timing display
    533548%show the reference image edit box if relevant (not needed for movies or in the absence of time information
     
    12231238            Param.Civ1.Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
    12241239            Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE?
    1225             Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%   
    1226             ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size
     1240            Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%
     1241            form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
     1242            if isempty(form)
     1243                ImageInfo=get(VideoReader(filecell.ima1.civ1{1,1}));
     1244                Param.Civ1.ImageBitDepth=ImageInfo.BitsPerPixel/3;
     1245            else
     1246                ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size
     1247                Param.Civ1.ImageBitDepth=ImageInfo.BitDepth;
     1248            end
    12271249            Param.Civ1.ImageWidth=ImageInfo.Width;
    12281250            Param.Civ1.ImageHeight=ImageInfo.Height;
    1229             Param.Civ1.ImageBitDepth=ImageInfo.BitDepth;
    12301251            Param.Civ1.i1=i1_civ1;
    12311252            Param.Civ1.i2=i2_civ1;
     
    13941415                end
    13951416            end
    1396             ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size
     1417            form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
     1418            if isempty(form)
     1419                ImageInfo=get(VideoReader(filecell.ima1.civ2{1,1}));
     1420                Param.Civ2.ImageBitDepth=ImageInfo.BitsPerPixel/3;
     1421            else
     1422                ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size
     1423                Param.Civ2.ImageBitDepth=ImageInfo.BitDepth;
     1424            end
    13971425            Param.Civ2.ImageWidth=ImageInfo.Width;
    13981426            Param.Civ2.ImageHeight=ImageInfo.Height;
    1399             Param.Civ2.ImageBitDepth=ImageInfo.BitDepth;
    14001427            Param.Civ2.i1=i1_civ2;
    14011428            Param.Civ2.i2=i2_civ2;
    1402             % TODO: case of movie   
    14031429            switch CivMode
    14041430                case 'CivX'
     
    39283954    par_civ1.ImageHeight=size(Data.A,1);
    39293955    par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation
    3930     par_civ1.i1=i1_civ1;
    3931     par_civ1.i2=i2_civ1;
     3956    par_civ1.i1=1;%i1_civ1;
     3957    par_civ1.i2=2;%i2_civ1;
    39323958    Param.Civ1=par_civ1;
    39333959    Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
Note: See TracChangeset for help on using the changeset viewer.