git:https://github.com/linyi0604/Computer-Vision

 # coding:utf8

 import cv2
import numpy as np
from scipy import ndimage # 3*3 的高通卷积核
kernel_3x3 = np.array([
[-1, -1, -1],
[-1, 8, -1],
[-1, -1, -1]
])
# 5*5 高通卷积核
kernel_5x5 = np.array([
[-1, -1, -1, -1, -1],
[-1, 1, 2, 1, -1],
[-1, 3, 4, 2, -1],
[-1, 1, 2, 1, -1],
[-1, -1, -1, -1, -1]
]) # 按灰度值读入图像
img = cv2.imread("../data/mm1.jpg", 0) # 进行卷积运算
k3 = ndimage.convolve(img, kernel_3x3)
k5 = ndimage.convolve(img, kernel_5x5)
"""
高通滤波器: 根据像素与临近像素的亮度差值来提升像素的亮度
""" # 原图像运用高斯低通滤波器
blurred = cv2.GaussianBlur(img, (11, 11), 0)
"""
低通滤波器: 像素周围亮度小于一个特定值时候,平滑该像素的亮度,主要用于去噪和模糊化
高斯滤波器是最常用的模糊滤波器之一,他是一个削弱强度的低通滤波器
"""
# 原图像减去低通
g_hpf = img - blurred cv2.imshow("3x3", k3)
cv2.imshow("5x5", k5)
cv2.imshow("g_hpf", g_hpf)
cv2.imshow("origin", img)
cv2.waitKey()
cv2.destroyAllWindows()

python opencv3 滤波器 卷积核的更多相关文章

  1. python opencv3添加opencv-contrib

    不需要编译或其他操作,只需一句话安装第三方库利用sift等特征提取算法: sudo pip3 install opencv-contrib-python 附网站:https://pypi.python ...

  2. python opencv3 给图片加中文

    转自:https://www.cnblogs.com/arkenstone/p/6961453.html opencv3.2将中文输出到图片上 opencv自带的putText函数无法输出utf8类型 ...

  3. python opencv3 直线检测

    git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 读入图像 ...

  4. python opencv3 写字画圈画矩形

    python opencv练习 自定义一张[512, 512, 3]的图像 在上面写写字,画画圈和矩形 显示 代码为: import cv2 import numpy as np img = np.z ...

  5. python opencv3 背景分割 mog2 knn

    git:https://github.com/linyi0604/Computer-Vision 使用mog2算法进行背景分割 # coding:utf-8 import cv2 # 获取摄像头对象 ...

  6. python opencv3 运动检测

    git:https://github.com/linyi0604/Computer-Vision 思路:  开启摄像头后 设置一个当前帧为背景, 在之后检测到的帧都与背景对比不同,对不同的地方进行检测 ...

  7. python opencv3 检测人

    git:https://github.com/linyi0604/Computer-Vision # coding:utf-8 import cv2 # 检测i方框 包含o方框 def is_insi ...

  8. python opencv3 FLANN单应性匹配

    git:https://github.com/linyi0604/Computer-Vision 匹配准确率非常高. 单应性指的是图像在投影发生了 畸变后仍然能够有较高的检测和匹配准确率 # codi ...

  9. python opencv3 基于ORB的特征检测和 BF暴力匹配 knn匹配 flann匹配

    git:https://github.com/linyi0604/Computer-Vision bf暴力匹配: # coding:utf-8 import cv2 """ ...

随机推荐

  1. C# IsAssignableFrom与IsSubClassOf 判断匿名类是否继承父类

    public class Dog : Animal { public string name { get; set; } } public class Animal { public string i ...

  2. 如何在Maven和Gradle中配置使用Groovy 2.4与Spock 1.0

    如何在Maven和Gradle中配置使用Groovy 2.4与Spock 1.0 原文 https://dzone.com/articles/spock-10-groovy-24 翻译 hxfiref ...

  3. TCP报文的最大负载和报文的最小长度

    TCP报文的最大负载和报文的最小长度 MTU:最大传输单元,以太网的MTU为1500Bytes MSS:最大分解大小,为每次TCP数据包每次传输的最大数据的分段大小,由发送端通知接收端,发送大于MTU ...

  4. c++字节数组转换为整型

    http://bbs.csdn.net/topics/360132089 BYTE data[4]={0x00,0x00,0xe6,0x00};//第一句UINT a11=*(UINT*)data;/ ...

  5. 漂亮的SVG时钟

    漂亮的SVG时钟 效果图: 代码如下,复制即可使用: <!DOCTYPE html> <html lang="en"> <head> <m ...

  6. 关于主键的设计、primary key

    主键:用于唯一标识一个表中一行数据. 外键:用于建立两个表之间的关系,A表中有一列是B表中的主键,那么A表中这列的数据就受到B表主键的约束. 那么关于主键应该如何设计呢,这里我说下优缺点: 1.用自动 ...

  7. Oracle学习笔记:11g服务介绍及哪些服务必须开启?

    由于工作环境中oracle版本为10g,不支持行转列函数pivot,特在自己电脑上安装了oracle 11g,但因为不经常使用,便把服务自动启动给关闭了,只在需要使用时手动启动,因此记录一下需要启动的 ...

  8. CVE-2012-4792Microsoft Internet Explorer 释放后使用漏洞

    Microsoft Internet Explorer是微软Windows操作系统中默认捆绑的WEB浏览器. Microsoft Internet Explorer 6至8版本中存在释放后使用漏洞.通 ...

  9. 将DataTable转换为List,将List转换为DataTable的实现类

    将DataTable转换为List,将List转换为DataTable的实现类 public static class DataTableHelper { public static DataTabl ...

  10. oracle创建job和删除job

    https://blog.csdn.net/u010001043/article/details/56479774