opencv实现图片模糊和锐化操作
作者:elegentbeauty 时间:2023-11-28 18:11:14
本文为大家分享了opencv图片模糊和锐化的具体实现代码,供大家参考,具体内容如下
一、模糊操作
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import cv2 as cv
import numpy as np
def blur_demo(image):
dst = cv.blur(image, (15, 1))
cv.imshow("blur_demo", dst)
src = cv.imread("F:\miao3.png")
cv.namedWindow("input image", cv.WINDOW_AUTOSIZE)
cv.imshow("input image", src)
blur_demo(src)
cv.waitKey(0)
cv.destroyAllWindows()
运行结果,如图:
二、锐化操作
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import cv2 as cv
import numpy as np
def custom_blur_demo(image):
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]], np.float32) #锐化
dst = cv.filter2D(image, -1, kernel=kernel)
cv.imshow("custom_blur_demo", dst)
src = cv.imread("F:\miao3.png")
cv.namedWindow("input image", cv.WINDOW_AUTOSIZE)
cv.imshow("input image", src)
custom_blur_demo(src)
cv.waitKey(0)
cv.destroyAllWindows()
运行结果,如下图:
来源:https://blog.csdn.net/elegentbeauty/article/details/79849887
标签:opencv,图片模糊,图片锐化
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
判断Threading.start新线程是否执行完毕的实例
2023-06-18 16:43:25
![](https://img.aspxhome.com/file/2023/3/68383_0s.jpg)
在vue中动态添加class类进行显示隐藏实例
2024-05-09 15:13:28
![](https://img.aspxhome.com/file/2023/7/126547_0s.jpg)
ajax 同步请求和异步请求的差异分析
2011-07-05 12:36:04
详细解读Python中的__init__()方法
2023-03-25 17:10:27
利用Python网络爬虫爬取各大音乐评论的代码
2023-01-05 19:26:55
![](https://img.aspxhome.com/file/2023/6/95466_0s.png)
Access数据库出现0x80004005问题的解决方法
2008-11-28 14:25:00
python绘制多个曲线的折线图
2021-08-01 13:58:52
![](https://img.aspxhome.com/file/2023/6/99456_0s.jpg)
TensorFlow的reshape操作 tf.reshape的实现
2022-03-31 01:14:13
SQL注入宽字节注入由浅到深学习
2023-06-14 04:16:40
![](https://img.aspxhome.com/file/2023/2/55512_0s.jpg)
快速图片链接批处理
2007-02-03 11:39:00
php 404错误页面实现代码
2023-11-15 07:58:31
利用Python统计Jira数据并可视化
2023-06-26 00:11:46
加快Firefox 3.5启动速度的方法
2009-07-16 15:22:00
如何利用Vue3管理系统实现动态路由和动态侧边菜单栏
2024-05-05 09:25:34
![](https://img.aspxhome.com/file/2023/9/128889_0s.png)
CentOS 6.4下编译安装MySQL5.6.14教程
2024-01-20 01:06:43
Python+PyQT5实现手绘图片生成器
2022-03-11 11:57:21
![](https://img.aspxhome.com/file/2023/5/133425_0s.png)
SpringBoot集成内存数据库Sqlite的实践
2024-01-15 10:24:11
![](https://img.aspxhome.com/file/2023/4/77474_0s.png)
网站渗透常用Python小脚本查询同ip网站
2021-06-12 21:51:28
![](https://img.aspxhome.com/file/2023/1/95501_0s.png)
全国哀悼日 建议站点换素装(附代码)
2008-05-19 12:05:00
python之随机数函数的实现示例
2023-07-17 04:44:41
![](https://img.aspxhome.com/file/2023/0/98980_0s.png)