python opencv3 滤波器 卷积核
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 滤波器 卷积核的更多相关文章
- python opencv3添加opencv-contrib
不需要编译或其他操作,只需一句话安装第三方库利用sift等特征提取算法: sudo pip3 install opencv-contrib-python 附网站:https://pypi.python ...
- python opencv3 给图片加中文
转自:https://www.cnblogs.com/arkenstone/p/6961453.html opencv3.2将中文输出到图片上 opencv自带的putText函数无法输出utf8类型 ...
- python opencv3 直线检测
git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 读入图像 ...
- python opencv3 写字画圈画矩形
python opencv练习 自定义一张[512, 512, 3]的图像 在上面写写字,画画圈和矩形 显示 代码为: import cv2 import numpy as np img = np.z ...
- python opencv3 背景分割 mog2 knn
git:https://github.com/linyi0604/Computer-Vision 使用mog2算法进行背景分割 # coding:utf-8 import cv2 # 获取摄像头对象 ...
- python opencv3 运动检测
git:https://github.com/linyi0604/Computer-Vision 思路: 开启摄像头后 设置一个当前帧为背景, 在之后检测到的帧都与背景对比不同,对不同的地方进行检测 ...
- python opencv3 检测人
git:https://github.com/linyi0604/Computer-Vision # coding:utf-8 import cv2 # 检测i方框 包含o方框 def is_insi ...
- python opencv3 FLANN单应性匹配
git:https://github.com/linyi0604/Computer-Vision 匹配准确率非常高. 单应性指的是图像在投影发生了 畸变后仍然能够有较高的检测和匹配准确率 # codi ...
- python opencv3 基于ORB的特征检测和 BF暴力匹配 knn匹配 flann匹配
git:https://github.com/linyi0604/Computer-Vision bf暴力匹配: # coding:utf-8 import cv2 """ ...
随机推荐
- 【leetcode 简单】 第九十五题 数字转换为十六进制数
给定一个整数,编写一个算法将这个数转换为十六进制数.对于负整数,我们通常使用 补码运算 方法. 注意: 十六进制中所有字母(a-f)都必须是小写. 十六进制字符串中不能包含多余的前导零.如果要转化的数 ...
- hdu 1253 胜利大逃亡 (广搜)
题目链接 Problem Description Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一个城堡里,城堡是一个ABC的立方体,可以被表示成A个 ...
- Linux的基础优化-2
1.启动网卡 ifup eth0 2.SSH链接 ifconfig 查看IP后SSH终端连接3.更新源 最小化安装是没有wget工具的,必须先安装再修改源 yum install wget 备份原系统 ...
- HTTP::Request 用 add-content 添加 POST参数
sub MAIN($cmd) { use HTTP::UserAgent; my $r = HTTP::Request.new(); $r.uri: 'http://localhost/a.php'; ...
- imperva 默认策略添加例外
创建违规访问 检查违规的告警类型 假如客户的这个目录下真的有这个文件,而且客户非常明确这是一个正常且安全的东西怎么办?我该如何的将它添加到例外? 添加例外的步骤: 再次构造违规的请求: 默认策略添加例 ...
- 二维码扫描开源库ZXing定制化
最近在用ZXing这个开源库做二维码的扫描模块,开发过程的一些代码修改和裁剪的经验和大家分享一下. 建议: 如果需要集成到自己的app上,而不是做一个demo,不推荐用ZXing的Android外围开 ...
- plupload 上传组件的使用
在这之前在感谢园子好多大牛的文章,在这里就不列出来了. 进入正题. svn检索https://github.com/moxiecode/plupload 获取到代码,这篇文章使用的是v2.1.8 主要 ...
- maven bat脚本打包
脚本内容: @echo off echo 正在设置临时环境变量 set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45 set MAVEN_HOME=D:\ap ...
- vue系列之项目优化
webpack中的Code Splitting Code Splitting是什么以及为什么 在以前,为了减少HTTP请求,通常地,我们会把所有的代码都打包成一个单独的JS文件,但是,如果这个文件体积 ...
- 移动端默认meta标签
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><met ...