Writing an adaptive mean shift library