implementing meanshift, replacing my original rectangle intersection and
expansion method with it