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

📄 meanshift.m

📁 Mean shift sementation. matlab
💻 M
字号:
function y=meanshift(g,y0) ;% Given a grid structure (generated by meanshiftinit) and a starting point% y0, return the mean shift limit. Normal kernel is used,% K(x)=c exp(-1/2 * norm(x ./ h)^2)  % vector h is the kernel size.   y=double(y0) ;%i=1 ;while true,  % Find participating points  pts=double(rangesearch(g, [ y - g.hmax ; y + g.hmax ])) ;  %pts=g.x ;  n=size(pts,1) ;  if n==0,    y=y0 ; break ;  end ;  % Their contributions  gker=exp(-0.5*sum(((pts-repmat(y,n,1))./repmat(g.h,n,1)).^2,2)) ;  y0=y ;   y=(gker' * pts)/sum(gker) ;  %if g.plot;  %  plot([y(2) y0(2)],[y(1) y0(1)],'r-') ;  %end ;  if norm(y-y0)<1e-3,    break ;  end ;%  i=i+1 ;end ;%i

⌨️ 快捷键说明

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