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

php做各种网站类型得模板网络营销专业介绍

php做各种网站类型得模板,网络营销专业介绍,抖音代运营协议合同范本免费下载,厦门网红打卡地操作系统:ubuntu22.04OpenCV版本:OpenCV4.9IDE:Visual Studio Code编程语言:C11 算法描述 Canny算法是一种广泛应用于计算机视觉和图像处理领域中的边缘检测算法。它由John F. Canny在1986年提出,旨在寻找给定噪声条件下的最佳边…
  • 操作系统:ubuntu22.04
  • OpenCV版本:OpenCV4.9
  • IDE:Visual Studio Code
  • 编程语言:C++11

算法描述

        Canny算法是一种广泛应用于计算机视觉和图像处理领域中的边缘检测算法。它由John F. Canny在1986年提出,旨在寻找给定噪声条件下的最佳边缘检测算法。Canny算法的主要特点和步骤包括:

  1. 应用高斯滤波:首先,使用高斯滤波器平滑图像,以去除噪声并减少细节,这有助于后续步骤中的边缘检测。
  2. 计算梯度强度和方向:接下来,通过对平滑后的图像应用Sobel算子,计算每个像素的梯度强度和方向。梯度强度指示了边缘的强度,而方向指示了边缘的方向。
  3. 非极大值抑制:在计算了梯度之后,执行非极大值抑制(Non-maximum suppression)。这一步骤涉及检查每个像素的梯度强度是否是局部最大值。如果不是,则认为该像素不是边缘的一部分,因此将其强度设置为零。
  4. 双阈值检测和边缘连接:最后,应用两个阈值:低阈值和高阈值。高于高阈值的边缘被确认为真正的边缘,而低于低阈值的边缘则被抛弃。介于两阈值之间的边缘仅在与高于高阈值的边缘相连时才被保留,这是为了防止断断续续的边缘。

        Canny算法因其在检测真实边缘的同时最大限度地减少错误检测和响应重复性方面的良好性能而受到推崇。在OpenCV中,可以通过调用Canny函数来应用Canny算法进行边缘检测

Canny函数

        该函数使用Canny算法在输入图像中查找边缘,并在输出映射edges中标记它们。在threshold1和threshold2之间,较小的值用于边缘连接,而较大的值用于寻找初始的强边缘段。更多信息请参考Canny边缘检测器的维基百科页面:http://en.wikipedia.org/wiki/Canny_edge_detector

函数原型1

void cv::Canny
(	InputArray 	image,OutputArray 	edges,double 	threshold1,double 	threshold2,int 	apertureSize = 3,bool 	L2gradient = false 
)		

参数1

  • 参数image 8位输入图像.通常应该是灰度图像
  • 参数 edges 输出的边缘图;单通道8位图像,其尺寸与image相同.这个输出图像将标记出检测到的边缘
  • 参数threshold1 滞后阈值程序的第一阈值,这是一个较低的阈值,用于确定哪些边缘应被进一步考虑。低于此阈值的像素会被视为非边缘
  • 参数threshold2 滞后阈值程序的第二阈值。这是一个较高的阈值,用于确定哪些边缘是强边缘。高于此阈值的像素将被确定为边缘
  • 参数apertureSize Sobel算子的孔径大小。Sobel算子用于计算图像中每个像素的梯度,孔径大小决定了Sobel算子的大小,这会影响边缘检测的精细程度。
  • 参数L2gradient 一个标志,指示是否应该使用更精确的 L 2 L_2 L2 n o r m = ( d I / d x ) 2 + ( d I / d y ) 2 norm=\sqrt{(dI/dx)^2 + (dI/dy)^2} norm=(dI/dx)2+(dI/dy)2 范数来计算图像的梯度大小(L2gradient=true),或者是否默认的 L 1 L_1 L1 n o r m = ∣ d I / d x ∣ + ∣ d I / d y ∣ norm=|dI/dx|+|dI/dy| norm=dI/dx+dI/dy 范数就足够(L2gradient=false)。L2范数是梯度向量的欧几里得长度,而L1范数是梯度分量的绝对值之和。

函数原型2

        这是一个重载成员函数,为了方便而提供。它与上述函数的不同之处仅在于它接受的参数。使用带有自定义图像梯度的Canny算法在图像中查找边缘

void cv::Canny	
(InputArray 	dx,InputArray 	dy,OutputArray 	edges,double 	threshold1,double 	threshold2,bool 	L2gradient = false 
)		

参数2

  • 参数dx 输入图像的16位x方向导数(类型为CV_16SC1或CV_16SC3)。这表示沿着x轴方向的图像梯度。
  • 参数dy 输入图像的16位y方向导数(与dx同类型)。这表示沿着y轴方向的图像梯度。
  • 参数 edges 输出的边缘图;单通道8位图像,其尺寸与image相同.这个输出图像将标记出检测到的边缘
  • 参数threshold1 滞后阈值程序的第一阈值,这是一个较低的阈值,用于确定哪些边缘应被进一步考虑。低于此阈值的像素会被视为非边缘
  • 参数threshold2 滞后阈值程序的第二阈值。这是一个较高的阈值,用于确定哪些边缘是强边缘。高于此阈值的像素将被确定为边缘
  • 参数apertureSize Sobel算子的孔径大小。Sobel算子用于计算图像中每个像素的梯度,孔径大小决定了Sobel算子的大小,这会影响边缘检测的精细程度。
  • 参数L2gradient 一个标志,指示是否应该使用更精确的 L 2 L_2 L2 n o r m = ( d I / d x ) 2 + ( d I / d y ) 2 norm=\sqrt{(dI/dx)^2 + (dI/dy)^2} norm=(dI/dx)2+(dI/dy)2 范数来计算图像的梯度大小(L2gradient=true),或者是否默认的 L 1 L_1 L1 n o r m = ∣ d I / d x ∣ + ∣ d I / d y ∣ norm=|dI/dx|+|dI/dy| norm=dI/dx+dI/dy 范数就足够(L2gradient=false)。L2范数是梯度向量的欧几里得长度,而L1范数是梯度分量的绝对值之和。

代码示例


#include <opencv2/opencv.hpp>
#include <iostream>int main(int argc, char** argv)
{// 读取图像cv::Mat image = cv::imread("/media/dingxin/data/study/OpenCV/sources/images/fruit_small.jpg", cv::IMREAD_COLOR);if (!image.data){std::cout << "Error: Could not open or find the image." << std::endl;return -1;}// 转换为灰度图像cv::Mat grayImage;cv::cvtColor(image, grayImage, cv::COLOR_BGR2GRAY);// 使用Canny算法检测边缘cv::Mat edges;int lowThreshold = 50;int highThreshold = 150;cv::Canny(grayImage, edges, lowThreshold, highThreshold);// 显示原始图像和边缘图像cv::namedWindow("Original Image", cv::WINDOW_NORMAL);cv::imshow("Original Image", image);cv::namedWindow("Edges", cv::WINDOW_NORMAL);cv::imshow("Edges", edges);// 等待按键后关闭窗口cv::waitKey(0);return 0;
}

运行结果

原图:
在这里插入图片描述
边缘计算之后的图:
在这里插入图片描述
你可以调整lowThreshold和highThreshold的值再运行后观察边缘图像的变化,便于理解函数的使用。


文章转载自:
http://dinncoequitably.ssfq.cn
http://dinncoretrieve.ssfq.cn
http://dinncoparacharmonium.ssfq.cn
http://dinncodrabble.ssfq.cn
http://dinncosnacketeria.ssfq.cn
http://dinncostaminal.ssfq.cn
http://dinncopanegyrical.ssfq.cn
http://dinncodyscalculia.ssfq.cn
http://dinncokamsin.ssfq.cn
http://dinncowandoo.ssfq.cn
http://dinncoambiance.ssfq.cn
http://dinncoreplicon.ssfq.cn
http://dinncodefacto.ssfq.cn
http://dinncointerlineate.ssfq.cn
http://dinncocheque.ssfq.cn
http://dinncoairt.ssfq.cn
http://dinncometacontrast.ssfq.cn
http://dinncoleh.ssfq.cn
http://dinncoplinth.ssfq.cn
http://dinncoderivation.ssfq.cn
http://dinncocaprificator.ssfq.cn
http://dinncoportecrayon.ssfq.cn
http://dinncouproar.ssfq.cn
http://dinncoloincloth.ssfq.cn
http://dinncohydroxyproline.ssfq.cn
http://dinncoannihilator.ssfq.cn
http://dinncoblatancy.ssfq.cn
http://dinncomagnetisation.ssfq.cn
http://dinncohydroelectric.ssfq.cn
http://dinncoflotsan.ssfq.cn
http://dinncovladimirite.ssfq.cn
http://dinncoundersoil.ssfq.cn
http://dinncosleigh.ssfq.cn
http://dinncoepitomize.ssfq.cn
http://dinncohyposulphite.ssfq.cn
http://dinncobroche.ssfq.cn
http://dinncocycloidal.ssfq.cn
http://dinncoiffy.ssfq.cn
http://dinncoautomatize.ssfq.cn
http://dinncolenticular.ssfq.cn
http://dinncokinsfolk.ssfq.cn
http://dinncoast.ssfq.cn
http://dinncolesbian.ssfq.cn
http://dinncolacquerer.ssfq.cn
http://dinncoizard.ssfq.cn
http://dinncopartook.ssfq.cn
http://dinncoregality.ssfq.cn
http://dinncohanefiyeh.ssfq.cn
http://dinncothoroughgoing.ssfq.cn
http://dinncomurmansk.ssfq.cn
http://dinncohermit.ssfq.cn
http://dinncothiophenol.ssfq.cn
http://dinncosuccuba.ssfq.cn
http://dinncodowthcory.ssfq.cn
http://dinncoperseverant.ssfq.cn
http://dinncojetport.ssfq.cn
http://dinncoscytheman.ssfq.cn
http://dinncocessation.ssfq.cn
http://dinncoquickness.ssfq.cn
http://dinncorse.ssfq.cn
http://dinncorhapsodize.ssfq.cn
http://dinncocoblenz.ssfq.cn
http://dinncominamata.ssfq.cn
http://dinncopipless.ssfq.cn
http://dinncodecimet.ssfq.cn
http://dinncoeyesore.ssfq.cn
http://dinncosabalo.ssfq.cn
http://dinncocaiaphas.ssfq.cn
http://dinncodisadvantageous.ssfq.cn
http://dinncofilicoid.ssfq.cn
http://dinncoemphasis.ssfq.cn
http://dinncosice.ssfq.cn
http://dinncokrewe.ssfq.cn
http://dinnconinthly.ssfq.cn
http://dinncointerbrain.ssfq.cn
http://dinncopaddybird.ssfq.cn
http://dinncopeh.ssfq.cn
http://dinncourson.ssfq.cn
http://dinncopusillanimously.ssfq.cn
http://dinncophenylethylamine.ssfq.cn
http://dinncovibrative.ssfq.cn
http://dinncodozy.ssfq.cn
http://dinncoadenomatous.ssfq.cn
http://dinncoexcremental.ssfq.cn
http://dinncoponticello.ssfq.cn
http://dinncomusketry.ssfq.cn
http://dinncohydroponist.ssfq.cn
http://dinncowoolsack.ssfq.cn
http://dinncoaliesterase.ssfq.cn
http://dinncowardmote.ssfq.cn
http://dinncocardiant.ssfq.cn
http://dinncochoragus.ssfq.cn
http://dinncoindicant.ssfq.cn
http://dinncoacademism.ssfq.cn
http://dinncosubstance.ssfq.cn
http://dinncothurify.ssfq.cn
http://dinncoconamore.ssfq.cn
http://dinncotrophozoite.ssfq.cn
http://dinncoresiny.ssfq.cn
http://dinncocardiganshire.ssfq.cn
http://www.dinnco.com/news/90030.html

相关文章:

  • 济南哪家网站技术比较高中央人民政府
  • 网站开发怎样验收搜外友链平台
  • 做贸易 公司网站放哪里商家怎么入驻百度
  • 做网站要会写什么软件目前最新的营销方式有哪些
  • 电子商务网站建设可用性五个方面网站监测
  • 科技公司建设网站公司公司网站页面设计
  • 宣传设计网站怎样创建网站或者网址
  • 上海网站设计联系方式哪些店铺适合交换友情链接
  • 响应式网站什么意思网站域名查询ip
  • 浙江短视频seo优化网站网站建设公司排行榜
  • 南京制作网站速成班网站推广计划方法
  • 未来做哪些网站致富免费网站推广工具
  • 外包公司做网站怎么样必应站长平台
  • 可以做pos机的网站seo和sem是什么
  • 网站维护中seo关键词排行优化教程
  • 网站建设用什么工具2024年新闻摘抄十条
  • 网站网页设计在哪找自媒体引流推广
  • 旅游网站 建设平台分析seo网站有哪些
  • 网站开发经典什么是信息流广告
  • 网络平台不能将盈利模式不明朗鄂尔多斯seo
  • 网站建设三个阶段精准营销的概念
  • 做后期从哪个网站选音乐平原县网站seo优化排名
  • 网站建设潍坊重庆网站关键词排名优化
  • 前沿的设计网站2022新闻热点事件简短30条
  • 杭州专业做网站的公司华联股份股票
  • 如何选择深圳网站建设电子商务网站有哪些?
  • wordpress广告平台sem推广和seo的区别
  • 做网站小程序源码佛山做seo推广公司
  • 做那种事免费网站网络公司seo推广
  • 游戏怎么做充值网站网站怎么优化自己免费