Search
 
SCRIPT & CODE EXAMPLE
 

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)]
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter label auto text wrap 
Python :: python visualize fft of an image 
Python :: python logging to syslog linux 
Python :: confusion matrix for classification 
Python :: torch.stack example 
Python :: UnicodeDecodeError: ‘utf8’ codec can’t decode byte 
Python :: remove unnamed columns pandas 
Python :: absolute value in python 
Python :: lower case of string 
Python :: create dict from two lists 
Python :: xpath start-with python 
Python :: remove initial space python 
Python :: integral python 
Python :: how to add a file to an email in python 
Python :: python to run excel macro 
Python :: python string to lower 
Python :: install virtual environments_brew 
Python :: AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’ 
Python :: Program to Compute LCM 
Python :: python enum advanced 
Python :: how to pause a python script 
Python :: keras conv2d batchnorm 
Python :: python string cut to length 
Python :: python @property 
Python :: ast python 
Python :: how to copy content of one file to another in python 
Python :: hashmap python 
Python :: float to int in python 
Python :: cv2 imwrite 
Python :: python get 2d array output as matrix 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =