opencv-python(二)

马赛克

python 复制代码
    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()
python 复制代码
    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()
python 复制代码
    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()
相关推荐
DES 仿真实践家16 分钟前
【Day 11-N22】Python类(3)——Python的继承性、多继承、方法重写
开发语言·笔记·python
Code Warrior1 小时前
【每日算法】专题五_位运算
开发语言·c++
沐知全栈开发3 小时前
HTML DOM 访问
开发语言
脑袋大大的4 小时前
JavaScript 性能优化实战:减少 DOM 操作引发的重排与重绘
开发语言·javascript·性能优化
云泽野5 小时前
【Java|集合类】list遍历的6种方式
java·python·list
二进制person5 小时前
Java SE--方法的使用
java·开发语言·算法
OneQ6666 小时前
C++讲解---创建日期类
开发语言·c++·算法
IMPYLH6 小时前
Python 的内置函数 reversed
笔记·python
码农不惑6 小时前
2025.06.27-14.44 C语言开发:Onvif(二)
c语言·开发语言
Coding小公仔8 小时前
C++ bitset 模板类
开发语言·c++