possible improvement in inverse distoriton, by taking the median and
removing deformations that map outside the masked area
impelmented geometric median