当前位置:网站首页>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)

边栏推荐
- 【无标题】
- Fast parsing intranet penetration escorts the document encryption industry
- What is the function of paralleling a capacitor on the feedback resistance of the operational amplifier circuit
- Explore dry goods! Apifox construction ideas
- [quickstart to Digital IC Validation] 15. Basic syntax for SystemVerilog Learning 2 (operator, type conversion, loop, Task / Function... Including practical exercises)
- uniapp 移动端强制更新功能
- JS cross browser parsing XML application
- Battery and motor technology have received great attention, but electric control technology is rarely mentioned?
- It's too true. There's a reason why I haven't been rich
- 提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
猜你喜欢
随机推荐
game攻防世界逆向
Pytorch(六) —— 模型调优tricks
Niu Mei's mathematical problem --- combinatorial number
利用 Helm 在各类 Kubernetes 中安装 Rainbond
Uniapp mobile terminal forced update function
Myabtis_Plus
JS quick start (I)
Use of JMeter
JS copy picture to clipboard read clipboard
uniapp 移动端强制更新功能
Rainbond结合NeuVector实践容器安全管理
DNS server configuration
藏书馆App基于Rainbond实现云原生DevOps的实践
Network learning (I) -- basic model learning
Vulnerability recurrence easy_ tornado
ZCMU--1492: Problem D(C语言)
Zcmu--1396: queue problem (2)
在Rainbond中实现数据库结构自动化升级
Codeforce c.strange test and acwing
解析机器人科技发展观对社会研究论









