random math stuff for computer vision