当前位置:网站首页>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)
边栏推荐
- 【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
- [step on the pit series] H5 cross domain problem of uniapp
- Explore dry goods! Apifox construction ideas
- 【数字IC验证快速入门】12、SystemVerilog TestBench(SVTB)入门
- buureservewp(2)
- QT learning 26 integrated example of layout management
- Blob 對象介紹
- [untitled]
- 【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
- 【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
猜你喜欢
使用 Nocalhost 开发 Rainbond 上的微服务应用
CTF-WEB shrine模板注入nmap的基本使用
【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
快解析内网穿透助力外贸管理行业应对多种挑战
在Rainbond中一键部署高可用 EMQX 集群
Call pytorch API to complete linear regression
解析创新教育体系中的创客教育
LeetCode简单题之字符串中最大的 3 位相同数字
Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
UnityHub破解&Unity破解
随机推荐
LeetCode简单题之判断一个数的数字计数是否等于数位的值
[quickstart to Digital IC Validation] 15. Basic syntax for SystemVerilog Learning 2 (operator, type conversion, loop, Task / Function... Including practical exercises)
Pytorch(六) —— 模型调优tricks
Notes on PHP penetration test topics
Myabtis_Plus
Real time monitoring of dog walking and rope pulling AI recognition helps smart city
Excel import function of jeesite form page
Qinglong panel -- finishing usable scripts
The legend about reading the configuration file under SRC
【雅思口语】安娜口语学习记录 Part2
Zcmu--1492: problem d (C language)
Recursive method to verify whether a tree is a binary search tree (BST)
JS复制图片到剪切板 读取剪切板
Example of file segmentation
Complex network modeling (III)
Network learning (II) -- Introduction to socket
Vulnerability recurrence fastjson deserialization
It took "7" years to build the robot framework into a micro service
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
快解析内网穿透助力外贸管理行业应对多种挑战