from PIL import Image import numpy as np import os import threading import time def image(sta,end,depths=10): a = np.asarray(Image.open(sta).convert('L')).astype('float') depth = depths # 深度的取值范围(0-100),标准取10 grad = np.gradient(a) # 取图像灰度的梯度值 grad_x, grad_y = grad # 分别取横纵图像梯度值