def linearTrans(imgDir):
imgGray=cv2.imread(imgDir,cv2.IMREAD_GRAYSCALE)
cv2.imshow("raw",imgGray)
a=0.2
dst=float(2)*imgGray
dst[dst>25]=255 # 将数组dst中大于25的值均设置为255
dst=np.round(dst)
dst=dst.astype(np.uint8) #成员函数astype的作用改变narray的数据类型
cv2.imshow("test",dst)
cv2.waitKey(0)
效果图: