?? meanshift.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 + -