<< mean2 SIVP - Scilab Image and Video Processing Toolbox ntsc2rgb >>

SIVP - Scilab Image and Video Processing Toolbox >> SIVP - Scilab Image and Video Processing Toolbox > meanshift

meanshift

Track an object by color.

Calling Sequence

obj_win = meanshift(im, init_win)
obj_win = meanshift(im)

Parameters

im
Input image which must be a 3-channel image.
init_win
Initial search window which is a 1x4 matrix [x,y,w,h]. x is the x-coordinate of the left-top window corner. y is the y-coordinate of the left-top window corner. w is the width of the window. h is the height of the window.
obj_win
Object window which is a 1x4 matrix [x,y,w,h]. x is the x-coordinate of the left-top window corner. y is the y-coordinate of the left-top window corner. w is the width of the window.

Description

The function iterates to find the object center given its back projection and initial position of search window. When using it, please first use obj_win=meanshift(im, init_win) to initialize the tracker, then use obj_win=meanshift(im) to track the object.

Examples

n = aviopen(SCI+'/contrib/sivp-svn-trunk/images/red_car_video.avi');
im = avireadframe(n); //get a frame
obj_win = meanshift(im, [12, 6, 39, 13]); //initialize tracker

while ~isempty(im),
      obj_win = meanshift(im); //meanshift tracking

      im = rectangle(im, obj_win, [0,255,0]);
      imshow(im);

      im = avireadframe(n);
end;

aviclose(n);

Authors

Availability

The latest version of SIVP can be found at

http://sivp.sf.net

See Also

<< mean2 SIVP - Scilab Image and Video Processing Toolbox ntsc2rgb >>