fix detector's coordinate mapping for images smaller than IMAGE_DIM