Be more precise about filtering out points that are beyond the image boundaries