Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

crop black border python

def crop(image, threshold):
    y_nonzero, x_nonzero, _ = np.nonzero(image> threshold)
    return image[np.min(y_nonzero):np.max(y_nonzero), np.min(x_nonzero):np.max(x_nonzero)]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #crop #black #border #python
ADD COMMENT
Topic
Name
7+2 =