当前位置: 首页 > news >正文

公司内部网站怎么制作廊坊seo培训

公司内部网站怎么制作,廊坊seo培训,视频网站推广怎么做,四川省建设厅网站首页空间滤波基础二:锐化 锐化的作用的突出灰度中的过渡。图像锐化通过空间微分来实现,微分将增强边缘和其他不连续(噪声),不强化灰度变化缓慢的区域。图像锐化也叫做高通滤波,通过高频,抑制低频。…

空间滤波基础二:锐化

锐化的作用的突出灰度中的过渡。图像锐化通过空间微分来实现,微分将增强边缘和其他不连续(噪声),不强化灰度变化缓慢的区域。图像锐化也叫做高通滤波,通过高频,抑制低频。

1、二阶导数锐化

f ( x ) f(x) f(x)的二阶导数定义为差分
∂ 2 f ∂ x 2 = f ( x + 1 ) + f ( x − 1 ) − 2 f ( x ) \frac{\partial^2f}{\partial x^2}=f(x+1)+f(x-1)-2f(x) x22f=f(x+1)+f(x1)2f(x)

拉普拉斯滤波器

最简单的各向同性二阶导数核是拉普拉斯核,对于图像 f ( x , y ) f(x,y) f(x,y),其定义如下:
∇ 2 f = ∂ 2 f ∂ x 2 + ∂ 2 f ∂ y 2 \nabla^2 f=\frac{\partial^2f}{\partial x^2}+\frac{\partial^2f}{\partial y^2} 2f=x22f+y22f
由于任意阶的导数都是线性算子,所以拉普拉斯也是线性算子。如下是对上式的 x 、 y x、y xy两个方向的离散化:
x x x方向:
∂ 2 f ∂ x 2 = f ( x + 1 , y ) + f ( x − 1 , y ) − 2 f ( x , y ) \frac{\partial^2f}{\partial x^2}=f(x+1,y)+f(x-1,y)-2f(x,y) x22f=f(x+1,y)+f(x1,y)2f(x,y)
y y y方向:
∂ 2 f ∂ y 2 = f ( x , y + 1 ) + f ( x , y − 1 ) − 2 f ( x , y ) \frac{\partial^2f}{\partial y^2}=f(x,y+1)+f(x,y-1)-2f(x,y) y22f=f(x,y+1)+f(x,y1)2f(x,y)
由上面三个公式可得,
∇ 2 f = f ( x + 1 , y ) + f ( x − 1 , y ) + f ( x , y + 1 ) + f ( x , y − 1 ) − 4 f ( x , y ) \nabla^2 f=f(x+1,y)+f(x-1,y)+f(x,y+1)+f(x,y-1)-4f(x,y) 2f=f(x+1,y)+f(x1,y)+f(x,y+1)+f(x,y1)4f(x,y)
由上式可得其卷积核如下:
[ 0 1 0 1 − 4 1 0 1 0 ] \begin{bmatrix} 0 & 1&0\\ 1 & -4&1 \\0 &1&0\\ \end{bmatrix} 010141010
更多变体:
(1) [ 1 1 1 1 − 8 1 1 1 1 ] \begin{bmatrix} 1 & 1&1\\ 1 & -8&1 \\1 &1&1\\ \end{bmatrix} 111181111 ,(2) [ 0 − 1 0 − 1 4 − 1 0 − 1 0 ] \begin{bmatrix} 0 & -1&0\\ -1 & 4&-1 \\0 &-1&0\\ \end{bmatrix} 010141010 ,(3) [ − 1 − 1 − 1 − 1 8 − 1 − 1 − 1 − 1 ] \begin{bmatrix} -1 & -1&-1\\ -1 & 8&-1 \\-1 &-1&-1\\ \end{bmatrix} 111181111

综上,卷积核(1)增加了±45°方向,(2)&(3)仅为符号的差异,产生的效果相同,但是需要注意当拉普拉斯滤波过后的图像与原图进行加减操作时的符号差异

OpenCV函数:


void cv::Laplacian(InputArray src, OutputArray dst, int ddepth, int ksize = 1, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)	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, see combinations.
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 getDerivKernels for details.
delta			Optional delta value that is added to the results prior to storing them in dst .
borderType		Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.

2、 一阶导数锐化

f ( x ) f(x) f(x)的一阶导数定义为差分
∂ f ∂ x = f ( x + 1 ) − f ( x ) \frac{\partial f}{\partial x}=f(x+1)-f(x) xf=f(x+1)f(x)
在图像处理中,一阶导数是用梯度幅度实现的。图像f在(x,y)处的梯度定位为二维列向量
∇ f = g r a d ( f ) = [ g x g y ] = [ ∂ f ∂ x ∂ f ∂ y ] \nabla f=grad(f)=\begin{bmatrix}g_x\\ g_y \end{bmatrix}=\begin{bmatrix} \frac {\partial f}{\partial x} \\ \\\frac {\partial f} {\partial y} \end{bmatrix} f=grad(f)=[gxgy]= xfyf
向量 ∇ f \nabla f f的幅度表示为 M ( x , y ) M(x,y) M(x,y),其中
M ( x , y ) = ∥ f ∥ = m a g ( ∇ f ) = g x 2 + g y 2 M(x,y)=\parallel f \parallel=mag(\nabla f)=\sqrt{g_x^2+g_y^2} M(x,y)=∥f∥=mag(f)=gx2+gy2
在某些实现中,使用绝对值来近似平方运算和平方根的运算,
M ( x , y ) ≈ ∣ g x ∣ + ∣ g y ∣ M(x,y)\approx |g_x|+|g_y| M(x,y)gx+gy
M ( x , y ) M(x,y) M(x,y)图像与原图尺寸大小相同,对应原图所有像素位置上的变化,该图像又叫做梯度图像

离散的一阶导数卷积核有如下:

1、Roberts滤波器
Roberts算子的原理是通过计算对角方向相邻两个像素之差来计算图像的梯度大小和方向。梯度大小表示边缘的强度,梯度方向与边缘的走向垂直。
Roberts算法在边缘定位方面较为准确,但对噪声比较敏感,无法有效抑制噪声的影响。因此,它常被用于检测边缘明显、亮度差异较大的低噪声图像。

计算方式:
计算45°方向: g x ( x , y ) = f ( x + 1 , y ) − f ( x , y + 1 ) g_x(x,y)=f(x+1,y)-f(x,y+1) gx(x,y)=f(x+1,y)f(x,y+1),滤波核如下:
M x = [ 0 1 − 1 0 ] M_x=\begin{bmatrix} 0 & 1\\ -1 & 0 \\ \end{bmatrix} Mx=[0110]
计算135°方向, g y ( x , y ) = f ( x , y ) − f ( x + 1 , y + 1 ) g_y(x,y)=f(x,y)-f(x+1,y+1) gy(x,y)=f(x,y)f(x+1,y+1),滤波核如下:
M y = [ 1 0 0 − 1 ] M_y=\begin{bmatrix} 1 & 0\\ 0 & -1 \\ \end{bmatrix} My=[1001]

2、Prewitt滤波器
Prewitt算子利用像素点上下左右邻点的灰度差,在边缘处达到极值来检测边缘,对噪声具有平滑的作用。Prewitt算子同样也是一种基于局部差分计算的算法,由两个 3 ∗ 3 3*3 33的模板组成,一个模板用于计算水平方向的梯度,另一个用于计算垂直方向的梯度。与Roberts算子相比,Prewitt算子的检测效果更加准确,仅稍微增加一些计算量就可以抑制噪音的影响。但是相较于Sobel算子和Laplacian算子,Prewitt算子的边缘检测效果较差。
M x = [ − 1 0 1 − 1 0 1 − 1 0 1 ] M_x=\begin{bmatrix} -1 & 0&1\\ -1 & 0&1 \\-1&0&1\\ \end{bmatrix} Mx= 111000111
M y = [ 1 1 1 0 0 0 − 1 − 1 1 ] M_y=\begin{bmatrix} 1 & 1&1\\ 0 & 0&0 \\-1&-1&1\\ \end{bmatrix} My= 101101101

3、Sobel滤波器
Sobel算子可以在边缘检测时可以提供较为精确的边缘方向信息,对于噪声也具有一定的平滑作用。Sobel算子可以通过像素点上下、左右邻点灰度加权差,在边缘处达到极值这一现象检测边缘,是高斯平滑和微分求导的联合运算,抗噪声能力强。考虑了距离对权值的影响,距离越远的像素的影响越小。可以通过快速卷积实现,简单有效,应用广泛。
M x = [ − 1 0 1 − 2 0 2 − 1 0 1 ] M_x=\begin{bmatrix} -1 & 0&1\\ -2 & 0&2 \\-1&0&1\\ \end{bmatrix} Mx= 121000121
M y = [ 1 2 1 0 0 0 − 1 − 2 1 ] M_y=\begin{bmatrix} 1 & 2&1\\ 0 & 0&0 \\-1 &-2&1\\ \end{bmatrix} My= 101202101

void cv::Sobel(InputArray src, OutputArray dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)	Parameters
src				input image.
dst				output image of the same size and the same number of channels as src .
ddepth			output image depth, see combinations; in the case of 8-bit input images it will result in truncated derivatives.
dx				order of the derivative x.
dy				order of the derivative y.
ksize			size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
scale			optional scale factor for the computed derivative values; by default, no scaling is applied (see getDerivKernels for details).
delta			optional delta value that is added to the results prior to storing them in dst.
borderType		pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.

4、Scharr滤波器
Scharr算子是对Sobel算法的改进和增强。Scharr算子和Sobel算子在边缘检测原理和使用方式上基本相同。Scharr算子使用 3 ∗ 3 3*3 33的滤波器,通过增大像素值间的差异来检测图像的边缘。它在X方向和Y方向上都有对应的边缘检测算子。

相比于Sobel算子,Scharr算子在权重系数上有所调整,使得其在图像梯度的计算中更为敏感。具体来说,Scharr算子使用的权重系数相对Sobel算子更大,以增强梯度的响应。这使得Scharr算子在对边缘进行检测时具有更好的精度和效果。

M x = [ − 3 0 3 − 10 0 10 − 3 0 3 ] M_x=\begin{bmatrix} -3 & 0&3\\ -10 & 0&10 \\-3&0&3\\ \end{bmatrix} Mx= 31030003103
M y = [ 3 10 3 0 0 0 − 3 − 10 3 ] M_y=\begin{bmatrix} 3 & 10&3\\ 0 & 0&0 \\-3 &-10&3\\ \end{bmatrix} My= 30310010303

void cv::Scharr	(InputArray src, OutputArray dst, int ddepth, int dx, int dy, double scale = 1, double delta = 0, int borderType = BORDER_DEFAULT)	Parameters
src				input image.
dst				output image of the same size and the same number of channels as src.
ddepth			output image depth, see combinations
dx				order of the derivative x.
dy				order of the derivative y.
scale			optional scale factor for the computed derivative values; by default, no scaling is applied (see getDerivKernels for details).
delta			optional delta value that is added to the results prior to storing them in dst.
borderType		pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.
http://www.tj-hxxt.cn/news/50442.html

相关文章:

  • 怎么做产品的网站常用的seo查询工具有哪些
  • 南海最新消息seo自学
  • wordpress自动发布图片大小软件网站关键词优化
  • 网站建设. 龙兵科技bt磁力兔子引擎
  • dw 做简单静态网站网站排名快速提升
  • wordpress源代码怎么修改seo入门免费教程
  • 政府建设门户网站的意义百度企业查询
  • 网页制作的公司的服务天津seo技术教程
  • 网站建设销售人才简历亚马逊关键词
  • 摄影网站制作seo网页的基础知识
  • 网页制作基础教程代码湖南seo服务电话
  • 东北三省最新疫情通报2022最好的百度seo
  • html网站模板资源郑州网站推广优化公司
  • 给公司做网站和公众号需要多少钱临沂百度联系方式
  • 什么是建站网络营销服务公司
  • 网站建设需要多少钱网络营销有几种方式
  • 怎么做单页竞价网站卖友情链接赚钱
  • 做网站需要备案几次快速提升关键词排名软件
  • 网站开发项目描述百度竞价排名软件
  • 手机打开网站自动跳转长春seo结算
  • 对网站做综合搜索引擎优化分析app推广公司
  • 在线网站建设教程想找搜索引擎优化
  • 手机数据线东莞网站建设技术支持韩国vs加纳分析比分
  • 网站日常维护怎么创建一个网站
  • 最新国家大事新闻seo引擎搜索网址
  • 河田镇建设局网站推广码怎么填
  • 找人做时时彩网站无线网络优化是做什么的
  • 广告素材南召seo快速排名价格
  • 免费空间网站怎么做的纯注册app拉新平台
  • 做网站推广个人建站