Ignore:
Timestamp:
Mar 18, 2011, 10:41:48 PM (13 years ago)
Author:
sommeria
Message:

civ : case of relative path for binaries treated. Test_civ improved: real time calculation of image correlation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_motion.m

    r213 r224  
    220220                        isx2=floor((str2double(par.isx)-1)/2);
    221221                        isy2=floor((str2double(par.isy)-1)/2);
     222                        shiftx=str2double(par.shiftx);
     223                        shifty=str2double(par.shifty);
    222224                        hhh=findobj(haxes,'Tag','PIV_box_marker');
    223225                        hhhh=findobj(haxes,'Tag','PIV_search_marker');
    224226                        if isempty(hhh)
    225                             %hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab
    226227                            set(0,'CurrentFigure',currentfig)
    227228                            set(currentfig,'CurrentAxes',haxes)
     
    230231                                'LineStyle','-','Tag','PIV_box_marker');
    231232                            rectangle('Curvature',[0 0],...
    232                                 'Position',[xround-isx2 yround-isy2 2*isx2 2*isy2],'EdgeColor','m',...
     233                                'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2],'EdgeColor','m',...
    233234                                'LineStyle','- -','Tag','PIV_search_marker');
    234                             % set(0,'Children',hstack);%put back the initial figure stack after plot creation
    235235                        else
    236236%                             set(hhh,'Visible','on')
    237237                            set(hhh,'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2])
    238                             set(hhhh,'Position',[xround-isx2 yround-isy2 2*isx2 2*isy2])
    239                         end
    240                         Asub=Field.A(xround-ibx2:xround+ibx2,yround-iby2:yround+iby2);
    241                         Asub=reshape(Asub,[],1);
    242                         rangx(1)=-(isx2-ibx2);
    243                         rangx(2)=isx2-ibx2;
    244                         rangy(1)=isy2-iby2;
    245                         rangy(2)=-(isy2-iby2);
     238                            set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2])
     239                        end
     240                        Asub=Field.A(yround-iby2:yround+iby2,xround-ibx2:xround+ibx2);%first sub-image
     241                        Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector
     242                        rangx(1)=-(isx2-ibx2)+shiftx;
     243                        rangx(2)=isx2-ibx2+shiftx
     244                        rangy(1)=-(isy2-iby2)-shifty;
     245                        rangy(2)=(isy2-iby2)-shifty
     246                        correl=zeros(rangy(2)-rangy(1)+1,rangx(2)-rangx(1)+1);
    246247                        for id=rangx(1):rangx(2)
    247                             for jd=rangy(2):rangy(1)
    248                                 Bsub=Field.B(xround-ibx2+id:xround+ibx2+id,yround-iby2+jd:yround+iby2+jd);
     248                            for jd=rangy(1):rangy(2)
     249                                Bsub=Field.B(yround-iby2+jd:yround+iby2+jd,xround-ibx2+id:xround+ibx2+id);
    249250                                Bsub=reshape(Bsub,[],1);
    250                                 correl(jd-rangy(2)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub));
     251                                correl(jd-rangy(1)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub));
    251252                            end
    252253                        end
     
    261262                        if isempty(hcorr)
    262263                            corrfig=findobj(allchild(0),'tag','corrfig');
    263                             if isempty(corrfig)
    264                                 corrfig=figure;
    265                                 set(corrfig,'tag','corrfig')
    266                             end
    267                             set(0,'CurrentFigure',corrfig)
    268                             AxeData.CurrentCorrImage=imagesc(rangx,rangy,correl,[0 1]);
    269                             colorbar
    270 %                             map_r=ones(42,1)*[1 0 0];
    271 %                             map_g=ones(11,1)*[0 1 0];
    272 %                             map_b=ones(11,1)*[0 0 1];
    273 %                             map=[map_r;map_g;map_b];
    274 %                             set(corrfig,'colormap',map)
    275                             set(haxes,'UserData',AxeData)
     264                            if ~isempty(corrfig)
     265                                set(0,'CurrentFigure',corrfig(1))
     266                                AxeData.CurrentCorrImage=imagesc(rangx,-rangy,correl,[0 1]);
     267                                colorbar
     268                                set(haxes,'UserData',AxeData)
     269                                set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal')
     270                            end
    276271                        else
    277272                            set(AxeData.CurrentCorrImage,'CData',correl)
     273                            set(AxeData.CurrentCorrImage,'XData',rangx)
     274                            set(AxeData.CurrentCorrImage,'YData',-rangy)
    278275                        end       
    279276                    end
Note: See TracChangeset for help on using the changeset viewer.