⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 match.m

📁 图像对齐(inage registration)工具箱
💻 M
字号:
function [odp,odp2,odp3]=match(img, points, k,l,tpi,ord)
%computes invariants up to the order from the neighbourhood with radius k
%from the img image around SP points (O/1 matrix), windows are shifted around
%each SP in surrounding with sized (2*l+1)*(2*l+1)
%of the type tpi


vel = size(img);
maska1=kruh(2*k+1,k);
maska=maska1;


%do not count SP around the border

[idxrp,idxcp]=find(points>0);  
numbp=sum(sum(points));
orz=(idxrp>k+l).*(idxrp<vel(1)-k-l+1).*(idxcp>k+l).*(idxcp<vel(2)-k-l+1);
numb=sum(orz);
orzidx=find(orz==1);
idxr=idxrp(orzidx);
idxc=idxcp(orzidx);

if numb >2 
   

for i=1:numb,
	c=idxc(i);
	r=idxr(i);
   odp3(i,:)=[r c];

for j=0:((2*l+1)^2-1),
   %refinement neighborhood
		Dc=(j-(2*l+1)*fix(j/(2*l+1)))-l;
     	Dr=fix(j/(2*l+1))-l;
     	window=maska.*img((Dr+r-k):(Dr+r+k),(Dc+c-k):(Dc+c+k));
            
       
      switch (tpi)
          case ('Hu           ')
            odp((i-1)*((2*l+1)^2)+j+1,:)=huc(window);
   		    odp2((i-1)*((2*l+1)^2)+j+1,:)=odp((i-1)*((2*l+1)^2)+j+1,:);
          case ('Rotational   ')    
            odp((i-1)*((2*l+1)^2)+j+1,:)=rot(window,ord);
   		    odp2((i-1)*((2*l+1)^2)+j+1,:)=odp((i-1)*((2*l+1)^2)+j+1,:);
           
            case ('Affine       ')
            odp((i-1)*((2*l+1)^2)+j+1,:)=ami(window);
   		    odp2((i-1)*((2*l+1)^2)+j+1,:)=odp((i-1)*((2*l+1)^2)+j+1,:);
	          
   	        case ('Blur combined') %Blur combined
            odp((i-1)*((2*l+1)^2)+j+1,:)=kblmi(window,7);
		    odp2((i-1)*((2*l+1)^2)+j+1,:)=nkminv(odp((i-1)*((2*l+1)^2)+j+1,:));
              
	        case ('Sym. blur    ') %Blur
            odp((i-1)*((2*l+1)^2)+j+1,:)=symb(window);
   		    odp2((i-1)*((2*l+1)^2)+j+1,:)=odp((i-1)*((2*l+1)^2)+j+1,:);

                
                
       otherwise
          set(findobj(gcbf,'Tag','MessText'),'String','Invariant type not defined','ForegroundColor','r'); 
     end;
		
	end;	
end;

else
   set(findobj(gcbf,'Tag','MessText'),'String','Not enough CPs or too close to boundary. Press SPACE','ForegroundColor','r'); 
   odp=[];
   odp2=[];
	odp3=[];

    pause;
end;

   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -