Algorithm for tracking an object based on the mean shift algorithm