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

📄 meanshift.m

📁 利用meanshift在MATLAB中实现目标检测和跟踪
💻 M
字号:
function [ 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 + -