美文网首页
opencv+python学习记录(八)图片线性变换

opencv+python学习记录(八)图片线性变换

作者: 三味菜551 | 来源:发表于2019-04-23 11:19 被阅读0次

#-*-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()

相关文章

网友评论

      本文标题:opencv+python学习记录(八)图片线性变换

      本文链接:https://www.haomeiwen.com/subject/lvamgqtx.html