数学之路-python计算实战(21)-机器视觉-拉普拉斯线性滤波
拉普拉斯线性滤波,.边缘检測
Laplacian
Calculates the Laplacian of an image.
- C++: void Laplacian(InputArray src, OutputArray dst, int ddepth, int ksize=1, double scale=1, double delta=0, int borderType=BORDER_DEFAULT )
- Python: cv2.Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) → dst
- C: void cvLaplace(const CvArr* src, CvArr* dst, int aperture_size=3 )
highlight=laplace#void cvLaplace(const CvArr* src, CvArr* dst, int aperture_size)" title="Permalink to this definition" style="color: rgb(101, 161, 54); text-decoration: none; visibility: hidden; font-size: 0.8em; padding: 0px 4px;">
- Python: cv.Laplace(src, dst, apertureSize=3) → None
-
Parameters: - src – Source image.
- dst – Destination image of the same size and the same number of channels as src .
- ddepth – Desired depth of the destination image.
- ksize – Aperture size used to compute the second-derivative filters. See getDerivKernels() for details. The size must be positive and odd.
- scale – Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See
highlight=laplace#void getDerivKernels(OutputArray kx, OutputArray ky, int dx, int dy, int ksize, bool normalize, int ktype)" title="void getDerivKernels(OutputArray kx, OutputArray ky, int dx, int dy, int ksize, bool normalize, int ktype)" style="color: rgb(0, 144, 217); text-decoration: none;">getDerivKernels()
for details. - delta – Optional delta value that is added to the results prior to storing them in dst .
- borderType – Pixel extrapolation method. See
highlight=laplace#int borderInterpolate(int p, int len, int borderType)" title="int borderInterpolate(int p, int len, int borderType)" style="color: rgb(0, 144, 217); text-decoration: none;">borderInterpolate()
for details.
The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:
This is done when ksize > 1 . When ksize == 1 , the Laplacian is computed by filtering the image with the following aperture:
Laplace
计算图像的 Laplacian 变换
void cvLaplace( const CvArr* src, CvArr* dst, int aperture_size=3 );
- src
- 输入图像.
- dst
- 输出图像.
- aperture_size
- 核大小 (与 cvSobel 中定义一样).
函数 cvLaplace 计算输入图像的 Laplacian变换,方法是先用 sobel 算子计算二阶 x- 和 y- 差分,再求和:
对 aperture_size=1 则给出最快计算结果,相当于对图像採用例如以下内核做卷积:
本博客全部内容是原创,假设转载请注明来源
http://blog.csdn.net/myhaspl/
# -*- coding: utf-8 -*-
#线性锐化滤波,拉普拉斯图像变换
#code:myhaspl@myhaspl.com
import cv2 fn="test6.jpg"
myimg=cv2.imread(fn)
img=cv2.cvtColor(myimg,cv2.COLOR_BGR2GRAY) jgimg=cv2.Laplacian(img,-1)
cv2.imshow('src',img)
cv2.imshow('dst',jgimg)
cv2.waitKey()
cv2.destroyAllWindows()
本博客全部内容是原创,假设转载请注明来源
http://blog.csdn.net/myhaspl/
数学之路-python计算实战(21)-机器视觉-拉普拉斯线性滤波的更多相关文章
- 数学之路-python计算实战(20)-机器视觉-拉普拉斯算子卷积滤波
拉普拉斯算子进行二维卷积计算,线性锐化滤波 # -*- coding: utf-8 -*- #线性锐化滤波-拉普拉斯算子进行二维卷积计算 #code:myhaspl@myhaspl.com impor ...
- 数学之路-python计算实战(17)-机器视觉-滤波去噪(中值滤波)
Blurs an image using the median filter. C++: void medianBlur(InputArray src, OutputArray dst, int ks ...
- 数学之路-python计算实战(15)-机器视觉-滤波去噪(归一化块滤波)
# -*- coding: utf-8 -*- #code:myhaspl@myhaspl.com #归一化块滤波 import cv2 import numpy as np fn="tes ...
- 数学之路-python计算实战(14)-机器视觉-图像增强(直方图均衡化)
我们来看一个灰度图像,让表示灰度出现的次数,这样图像中灰度为 的像素的出现概率是 是图像中全部的灰度数, 是图像中全部的像素数, 实际上是图像的直方图,归一化到 . 把 作为相应于 的累计概率 ...
- 数学之路-python计算实战(19)-机器视觉-卷积滤波
filter2D Convolves an image with the kernel. C++: void filter2D(InputArray src, OutputArray dst, int ...
- 数学之路-python计算实战(9)-机器视觉-图像插值仿射
插值 Python: cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) → dst interpolation – interpol ...
- 数学之路-python计算实战(13)-机器视觉-图像增强
指数变换的基本表达式为:y=bc(x-a)-1 当中參数b.c控制曲线的变换形状,參数a控制曲线的位置. 指数变换的作用是扩展图像的高灰度级.压缩低灰度级.能够用于亮度过高的图像 本博客全部内容是原创 ...
- 数学之路-python计算实战(16)-机器视觉-滤波去噪(邻域平均法滤波)
# -*- coding: utf-8 -*- #code:myhaspl@myhaspl.com #邻域平均法滤波,半径为2 import cv2 import numpy as np fn=&qu ...
- 数学之路-python计算实战(18)-机器视觉-滤波去噪(双边滤波与高斯滤波 )
高斯滤波就是对整幅图像进行加权平均的过程.每个像素点的值,都由其本身和邻域内的其它像素值经过加权平均后得到.高斯滤波的详细操作是:用一个模板(或称卷积.掩模)扫描图像中的每个像素.用模板确定的邻域内像 ...
随机推荐
- MIPS的寄存器、指令和寻址方式的分类
MIPS的32个寄存器 助记符 编号 作用 zero 0 恒为0 at 1 (assembly temporary)保留给汇编器使用 v0,v1 2-3 (values)子程序返回,即函数调用时的返回 ...
- layui 前端UI框架
1.获取点击行的索引
- IIS HTTP 错误 401.3的解决办法
目标网站添加新用户Everyone,选上需要的Everyone用户权限
- webpack遇见的坑:Please install 'webpack-cli' in addition to webpack itself to use the CLI.
webpack-cli没被找到: 在webpack4.0之后,需要全局安装webpack-cli, 在全局安装webpack之后,cnpm i webpack-cli -g 在局部使用webpack时 ...
- BZOJ4318: OSU! (概率DP)
题意:一个串 给出每个字符为1的可能性 否则为0 一段连续的1能获得长度的立方的收益 问总收益的期望 题解:设x_i为到第i位时连续的1的期望长度 由i-1递推来的贡献 如果这一位是0没有贡献 如果是 ...
- windows远程桌面链接“发生身份验证错误。要求的函数不受支持”
解决办法: 开始菜单->运行gpedit.msc 打开配置项:计算机配置>管理模板>系统>凭据分配>加密Oracle修正 选择启用并选择易受攻击,配置保存后即可解决问题 ...
- C#语言中循环分类总结
C#语言中,循环主要分为4种,分别是:while循环.do while循环.for循环.foeach循环.下面我将分类对循环语句总结. 1.while循环: 如果循环条件为真,则执行循环体:执行完循环 ...
- 网络共享服务器 samba
之前给自己centos 服务器配置了一下samba网络共享,主要是在windwos上编程,然后方便代码同步到linux上进行编译,现在大概记录一下过程,免得下次又忘记了 首先获取root权限 :su ...
- [Python3网络爬虫开发实战] 4.1-使用XPath
XPath,全称XML Path Language,即XML路径语言,它是一门在XML文档中查找信息的语言.它最初是用来搜寻XML文档的,但是它同样适用于HTML文档的搜索. 所以在做爬虫时,我们完全 ...
- Python面向对象之类属性类方法静态方法
类的结构 实例 使用面向对象开发时,第一步是设计类: 当使用 类名() 创建对象时,会自动执行以下操作: 1.为对象在内存中分配空间--创建对象: 2.为对象的属性 设置初始值--初始化方法(init ...