【trick】Python中切换opencv和skimage的方法

在使用python读取图像时,我们往往都会借助第三方库来实现,比如Opencv或者skimage

其中opencv的速度稍快,但是精度差一些

USE_CV2 = True
if USE_CV2:
    from cv2 import imread # opencv is much faster, but less accurate
    MIN_OBJ_VAL = 0
else:
    from skimage.io import imread
    MIN_OBJ_VAL = 1000

 

你可能感兴趣的:(python,trick)