?? meanshift.m
字號:
% Adam Kukucka% Zach Clay% Marcelo Molina % CSE 486 Project 3function [ rowcenter colcenter M00 ] = meanshift(I, rmin, rmax, cmin,... cmax, probmap)%inputs% rmin, rmax, cmin, cmax are the coordiantes of the window% I is the image%outputs% colcenter rowcenter are the new center coordinates% Moo is the zeroth mean% **********************************************************************% initialize% **********************************************************************M00 = 0; %zeroth meanM10 = 0; %first moment for xM01 = 0; %first moment for yhistdim = (0:1:255); % dimensions of histogram... 0 to 255, increment by 1[rows cols] = size(I);cols = cols/3; % **********************8% **********************************************************************% Main code% **********************************************************************% determine zeroth momentfor c = cmin:cmax for r = rmin:rmax M00 = M00 + probmap(r, c); endend% determine first moment for x(col) and y(row)for c = cmin:cmax for r = rmin:rmax M10 = M10 + c*probmap(r,c); M01 = M01 + r*probmap(r,c); endend% determine new centroid% x is cols colcenter = M10/M00;% y is rows rowcenter = M01/M00;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -