#-*-coding:utf-8-*-
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
if __name__== "__main__":
print("---------------Hello python ------------")
filename= ("output_3.png")
src= cv.imread(filename)
# cv.namedWindow("input image", cv.WINDOW_AUTOSIZE)
a= 3
O= a*src
O[O> 255]= 255 # 超过255,截断为255
O= np.round(O)
O= O.astype(np.uint8)
# src1 = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
# rows, cols = src1.shape
# pixelSequence = src1.reshape([rows * cols, ])
# numberBins = 256
# histogram, bins, patch = plt.hist(pixelSequence, numberBins, facecolor='black', histtype='bar')
# plt.xlabel(u"gray level")
# plt.ylabel(u"number of pixels")
# y_maxvalue = np.max(histogram)
# plt.axis([0, 255, 0, y_maxvalue])
plt.show()
cv.imshow("O", O)
cv.imshow("src", src)
cv.waitKey(0)
cv.destroyAllWindows()
网友评论