当前位置:网站首页>opencv学习笔记三——图像平滑/去噪处理
opencv学习笔记三——图像平滑/去噪处理
2022-07-07 05:19:00 【我是一个小稻米】
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from PIL import Image
image1 = mpimg.imread('image.png')
plt.imshow(image1);

1. 均值滤波
一个3×3的卷积核,其中的值都为1
image2 = cv2.blur(image1, (3,3))
plt.imshow(image2)

2. 方框滤波
这里的-1表示,输入与输出的颜色通道数是一致的
一个3×3的卷积核,其中的值都为1
normalize表示在卷积时是否取平均,为false表示,只取和,超过255,直接取255
image3 = cv2.boxFilter(image1, -1, (3,3), normalize=False)
plt.imshow(image3);

3. 高斯滤波
卷积核不全为1了。而是靠近中间的值更大
image4 = cv2.GaussianBlur(image1, (5,5), 1)
plt.imshow(image4)

4. 中值滤波
image5 = cv2.medianBlur(image1, 5)
plt.imshow(image5)

边栏推荐
- Blob object introduction
- 快解析内网穿透助力外贸管理行业应对多种挑战
- JS quick start (I)
- It's too true. There's a reason why I haven't been rich
- 央视太暖心了,手把手教你写HR最喜欢的简历
- Explore dry goods! Apifox construction ideas
- jeeSite 表单页面的Excel 导入功能
- Unityhub cracking & unity cracking
- Codeforce c.strange test and acwing
- Roulette chart 2 - writing of roulette chart code
猜你喜欢

Don't stop chasing the wind and the moon. Spring mountain is at the end of Pingwu

探索STEAM艺术设计中的创造力

使用 Nocalhost 开发 Rainbond 上的微服务应用

JS quick start (I)

Make LIVELINK's initial pose consistent with that of the mobile capture actor

漏洞複現-Fastjson 反序列化

饥荒云服管理脚本

Main window in QT learning 27 application

追风赶月莫停留,平芜尽处是春山

【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
随机推荐
柯基数据通过Rainbond完成云原生改造,实现离线持续交付客户
Yugu p1020 missile interception (binary search)
JS cross browser parsing XML application
JS quick start (I)
饥荒云服管理脚本
【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
UnityHub破解&Unity破解
Lua 编程学习笔记
Don't stop chasing the wind and the moon. Spring mountain is at the end of Pingwu
Complex network modeling (I)
Explore dry goods! Apifox construction ideas
【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
Lattice coloring - matrix fast power optimized shape pressure DP
海信电视开启开发者模式
LeetCode简单题之找到一个数字的 K 美丽值
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
Rainbond 5.7.1 支持对接多家公有云和集群异常报警
复杂网络建模(二)
Recursive method constructs binary tree from middle order and post order traversal sequence
Dedecms collects content without writing rules