I am currently studying image processing. In Scipy, I know there is one median filter in Scipy.signal. Can anyone tell me if there is one filter similar to high pass filter?

Thank you

解决方案

"High pass filter" is a very generic term. There are an infinite number of different "highpass filters" that do very different things (e.g. an edge dectection filter, as mentioned earlier, is technically a highpass (most are actually a bandpass) filter, but has a very different effect from what you probably had in mind.)

At any rate, based on most of the questions you've been asking, you should probably look into scipy.ndimage instead of scipy.filter, especially if you're going to be working with large images (ndimage can preform operations in-place, conserving memory).

As a basic example, showing a few different ways of doing things:

import matplotlib.pyplot as plt

import numpy as np

from scipy import ndimage

import Image

def plot(data, title):

plot.i += 1

plt.subplot(2,2,plot.i)

plt.imshow(data)

plt.gray()

plt.title(title)

plot.i = 0

# Load the data...

im = Image.open('lena.png')

data = np.array(im, dtype=float)

plot(data, 'Original')

# A very simple and very narrow highpass filter

kernel = np.array([[-1, -1, -1],

[-1, 8, -1],

[-1, -1, -1]])

highpass_3x3 = ndimage.convolve(data, kernel)

plot(highpass_3x3, 'Simple 3x3 Highpass')

# A slightly "wider", but sill very simple highpass filter

kernel = np.array([[-1, -1, -1, -1, -1],

[-1, 1, 2, 1, -1],

[-1, 2, 4, 2, -1],

[-1, 1, 2, 1, -1],

[-1, -1, -1, -1, -1]])

highpass_5x5 = ndimage.convolve(data, kernel)

plot(highpass_5x5, 'Simple 5x5 Highpass')

# Another way of making a highpass filter is to simply subtract a lowpass

# filtered image from the original. Here, we'll use a simple gaussian filter

# to "blur" (i.e. a lowpass filter) the original.

lowpass = ndimage.gaussian_filter(data, 3)

gauss_highpass = data - lowpass

plot(gauss_highpass, r'Gaussian Highpass, $\sigma = 3 pixels$')

plt.show()

python高通滤波,高通滤波器使用scipy / numpy在python中进行图像处理相关推荐

  1. python去除图片复杂背景_[OpenCV-Python] OpenCV 中的图像处理 部分 IV (五)

    部分 IV OpenCV 中的图像处理 22 直方图 22.1 直方图的计算,绘制与分析 目标 • 使用 OpenCV 或 Numpy 函数计算直方图 • 使用 Opencv 或者 Matplotli ...

  2. python怎么矩阵的秩_python – 从numpy或matlab中的满秩非矩形矩阵中获取可逆方阵...

    在MATLAB中轻松,轻松.使用QR,特别是枢轴QR. M = [3 0 0 0 0; 0 0 1 0 0; 0 0 0 0 1; 0 2 0 0 0] [Q,R,E] = qr(M) Q = 1 0 ...

  3. python科学计算环境配置_ATLAS + NumPy + SciPy + Theano 的Python科学计算环境搭建

    Theano是一个Python库,提供了定义.优化以及评估数学表达式的库,尤其适合处理高维数组.使用Theano能获得和C差不多的处理速度,并且当利用GPU进行计算时,效率要优于CPU上运行的C语言程 ...

  4. python应用-scipy,numpy,sympy计算微积分

    python应用-scipy,numpy,sympy计算微积分 今天来讲一下使用python进行微积分运算,python有很多科学计算库都可以进行微积分运算,当然如果知晓微积分计算的原理也可以自己编程 ...

  5. python创建列向量_关于Numpy中的行向量和列向量详解

    关于Numpy中的行向量和列向量详解 行向量 方式1 import numpy as np b=np.array([1,2,3]).reshape((1,-1)) print(b,b.shape) 结 ...

  6. 从numpy开启Python数据科学之旅

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 目前小编的Python学习是按照两个路径在一路往下推,希望借此改变 ...

  7. python怎么安装numpy库-python怎么安装numpy库

    NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库. Python官网上的发行版是不包含Num ...

  8. python怎么安装numpy库-Python NumPy库安装使用笔记

    1. NumPy安装 使用pip包管理工具进行安装 复制代码 代码如下: $ sudo pip install numpy 使用pip包管理工具安装ipython(交互式shell工具) 复制代码 代 ...

  9. python numpy教程_Python中的Numpy入门教程

    这篇文章主要介绍了 Python 中的 Numpy 入门教程,着重讲解了矩阵中的数组操作 , 需要的 朋友可以参考下 1 . Numpy 是什么 很简单, Numpy 是 Python 的一个科学计算 ...

最新文章

  1. 普京谈“元宇宙”:这无疑是一种挑战
  2. Oracle 学习系列之一(表空间与表结构)
  3. linux操作系统下C语言编程入门小结
  4. redis List的用途及常用命令
  5. 将Object structure IBASE从UI上隐藏
  6. vi and vim 用法
  7. SAP License:SAP权限管理讲财务(二)-看懂财务报表
  8. 2020 年帮你加薪的 7 个小习惯
  9. Android 透明颜色值ARGB
  10. atitit.提升研发效率的利器---重型框架与类库的区别与设计原则
  11. c语言仿宋gb2312字体,仿宋gb2312字体
  12. 计算机四级题库百度云资源,计算机四级题库
  13. gopher攻击mysql_机窝安全--安全技术 | 巧用Gopher协议扩展SSRF攻击手法
  14. jquery动态修改背景图片
  15. 布袋除尘器过滤风速多少_布袋除尘器的过滤风速选多少,如何正确地选定过滤风速...
  16. 计算机中级改进的具体措施,改进职高计算机教学的几点措施
  17. SSM框架使用Layui文件上传插件实现多文件上传(多文件列表)
  18. 一万一千字!结合代码超详细讲解SQL执行流程(二)!干货到底!建议收藏!
  19. 计算机入门模拟考试C,计算机入门模拟卷C.doc
  20. Ansible中的条件判断、handlers

热门文章

  1. leetcode 2. Add Two Numbers | 2. 两数相加(Java)
  2. leetcode 434. 字符串中的单词数(Java版)
  3. 突发!HashiCorp禁止在中国使用企业版VAULT软件
  4. erp系统方案书_一次ERP选型实施失败的血泪教训!
  5. Lombok常用注解和功能
  6. 01. elastcsearch-monitor (es 监控)
  7. Codeup-问题 A: 最长公共子序列
  8. mysql 记录所有操作_mysql 的一些记录的操作
  9. linux操作系统使用论文_Linux高性能服务器设计
  10. Linux ENSP 搭建DHCP服务器并实现中继和Linux 下搭建DNS服务器(2个实验可跟做)