个人技术分享

马赛克

    img = cv2.imread('./bao.jpeg')
    print(img.shape)
    img2 = cv2.resize(img,(35,23))
    img3 = cv2.resize(img2,(900,666))
    cv2.imshow('bao',img3)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

    img2 = cv2.resize(img, (90,66))
    img3 = np.repeat(img2, 10, axis= 0) # 重复行
    img4 = np.repeat(img3, 10, axis=1)  # 重复列
    cv2.imshow('bao',img4)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

    img2 = img[::10, ::10]  # 每10个中取出一个像素
    cv2.namedWindow('bao', flags=cv2.WINDOW_NORMAL)
    cv2.resizeWindow('bao', 900, 666)
    cv2.imshow('bao', img2)
    cv2.waitKey(0)
    cv2.destroyAllWindows()