# 导入库 import numpy as np import cv2 def lt(image_path,pa,pb,pc,pd): X = cv2.imread(image_path, 0) # 对 X 进行线性变换 a = int(pa) b = int(pb) c = int(pc) d = int(pd) result = (d - c) / (b - a) * X + (b * c - a * d) / (b - a) cv2.imshow('result',result) cv2.waitKey(0) cv2.destroyAllWindows()