def _mask_border_keypoints(image_shape, keypoints, distance):
 rows = image_shape[0]
 cols = image_shape[1]
 mask = (((((distance - 1) < keypoints[:, 0]) & (keypoints[:, 0] < ((rows - distance) + 1))) & ((distance - 1) < keypoints[:, 1])) & (keypoints[:, 1] < ((cols - distance) + 1)))
 return mask

def _mask_border_keypoints ( image_shape , keypoints , distance ) : rows = image_shape [ 0 ] cols = image_shape [ 1 ] mask = ( ( ( ( ( distance - 1 ) < keypoints [ : , 0 ] ) & ( keypoints [ : , 0 ] < ( ( rows - distance ) + 1 ) ) ) & ( ( distance - 1 ) < keypoints [ : , 1 ] ) ) & ( keypoints [ : , 1 ] < ( ( cols - distance ) + 1 ) ) ) return mask
mask coordinates that are within certain distance from the image border .