Friday, October 26, 2007

mean shift

Get "Mass Center"
for(int i=0;i< height;i++)
for(int j=0;j width;j++)
M00+=I(i,j);

for(int i=0;i height;i++)
for(int j=0;j width;j++)
{
M10+=i*I(i,j);
M01+=j*I(i,j);
}


Mass Center is:
Xc=M10/M00;
Yc=M01/M00

Four steps for Mean Shift algorithm:
1.initialize the size and position of window.
2.calculate Mass Center of the window.
3.adjust Mass Center of the window.
4.repeat 2 and 3 till the center qualified.

OpenCV function: cvMeanShift
int cvMeanShift(IplImage* imgprob,CvRect windowIn,
CvTermCriteria criteria,CvConnectedComp* out);

No comments:

Post a Comment