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

深圳宝安美容医院网站建设网建公司

深圳宝安美容医院网站建设,网建公司,电商网站建设比较好的,wordpress战队模板操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C11 算法描述 查找一个轮廓的凸性缺陷。 下图显示了一个手部轮廓的凸性缺陷: convexityDefects 是 OpenCV 库中的一个函数,用于检测轮…
  • 操作系统:ubuntu22.04
  • OpenCV版本:OpenCV4.9
  • IDE:Visual Studio Code
  • 编程语言:C++11

算法描述

查找一个轮廓的凸性缺陷。
下图显示了一个手部轮廓的凸性缺陷:
在这里插入图片描述
convexityDefects 是 OpenCV 库中的一个函数,用于检测轮廓相对于其凸包的凹陷缺陷。这个函数可以帮助识别轮廓中的凹进去的部分,通常被用来分析手部或其他物体的形状特征。

函数原型


void cv::convexityDefects
(InputArray 	contour,InputArray 	convexhull,OutputArray 	convexityDefects 
)		

参数

  • 参数contour 输入的轮廓。
  • 参数convexhull 使用 convexHull 获得的凸包,应包含构成凸包的轮廓点的索引。
  • 参数convexityDefects 凸性缺陷的输出向量。在 C++ 和新的 Python/Java 接口中,每个凸性缺陷表示为一个四元素整数向量(即 Vec4i):(start_index, end_index, farthest_pt_index, fixpt_depth),其中索引是原始轮廓中凸性缺陷起始点、终点和最远点的 0 基础索引,而 fixpt_depth 是最远轮廓点与凸包之间距离的定点近似值(带有 8 位小数部分)。也就是说,要获得深度的浮点数值,需要将 fixpt_depth 除以 256.0。

代码示例


#include <iostream>
#include <opencv2/opencv.hpp>using namespace std;
using namespace cv;int main()
{// 加载一张图像Mat img = imread( "/media/dingxin/data/study/OpenCV/sources/images/hand2.png", IMREAD_GRAYSCALE );if ( img.empty() ){cerr << "Error: Image not found." << endl;return -1;}// 二值化处理Mat binImg;threshold( img, binImg, 48, 255, THRESH_BINARY_INV );//imshow( "er zhi", binImg );// 寻找轮廓vector< vector< Point > > contours;findContours( binImg, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE );// 假设我们只处理第一个最大的轮廓vector< Point > contour = contours[ 0 ];// 计算凸包vector< int > hull;convexHull( contour, hull );// 计算凹陷缺陷vector< Vec4i > defects;convexityDefects( contour, hull, defects );// 在原图上绘制凸包和凹陷缺陷Mat drawing = Mat::zeros( img.size(), CV_8UC3 );drawContours( drawing, contours, 0, Scalar( 255, 0, 0 ), 2 );  // 绘制轮廓//imshow( "Convexity ", drawing );// 绘制凹陷缺陷for ( size_t i = 0; i < defects.size(); i++ ){Vec4i defect   = defects[ i ];Point start    = contour[ defect[ 0 ] ];Point end      = contour[ defect[ 1 ] ];Point farthest = contour[ defect[ 2 ] ];line( drawing, start, end, Scalar( 0, 255, 0 ), 1 );      // 绘制凹陷缺陷的边缘circle( drawing, farthest, 5, Scalar( 0, 0, 255 ), -1 );  // 绘制凹陷缺陷的最远点}// 显示结果imshow( "Original image", img );imshow( "Convexity Defects", drawing );waitKey( 0 );return 0;
}

运行结果

在这里插入图片描述


文章转载自:
http://dinncoregenerator.tpps.cn
http://dinncocriminatory.tpps.cn
http://dinncosubjectify.tpps.cn
http://dinncodemagnify.tpps.cn
http://dinncotragopan.tpps.cn
http://dinncobbe.tpps.cn
http://dinncokidney.tpps.cn
http://dinncoankyloglossia.tpps.cn
http://dinnconicaea.tpps.cn
http://dinncoplebeian.tpps.cn
http://dinncocityward.tpps.cn
http://dinncoceinture.tpps.cn
http://dinncocustumal.tpps.cn
http://dinncoarciform.tpps.cn
http://dinncoindescribable.tpps.cn
http://dinncodelegate.tpps.cn
http://dinncoloaner.tpps.cn
http://dinncosnowmelt.tpps.cn
http://dinncopedigreed.tpps.cn
http://dinncodissipator.tpps.cn
http://dinncopretest.tpps.cn
http://dinncochetrum.tpps.cn
http://dinncoholstein.tpps.cn
http://dinncoparramatta.tpps.cn
http://dinncohandshake.tpps.cn
http://dinncoscarab.tpps.cn
http://dinncoacidly.tpps.cn
http://dinncomotor.tpps.cn
http://dinncoshareable.tpps.cn
http://dinncoadmissible.tpps.cn
http://dinncoreversed.tpps.cn
http://dinncodespicably.tpps.cn
http://dinncoworkload.tpps.cn
http://dinnconiftic.tpps.cn
http://dinncofactionary.tpps.cn
http://dinncoatrioventricular.tpps.cn
http://dinncolandowning.tpps.cn
http://dinncoascesis.tpps.cn
http://dinncobubal.tpps.cn
http://dinncoretortion.tpps.cn
http://dinncoplacental.tpps.cn
http://dinncohoiden.tpps.cn
http://dinncocircumambience.tpps.cn
http://dinncoplanisphere.tpps.cn
http://dinncolatifundism.tpps.cn
http://dinncoblood.tpps.cn
http://dinncotriblet.tpps.cn
http://dinncosandron.tpps.cn
http://dinncoetc.tpps.cn
http://dinncovasculotoxic.tpps.cn
http://dinncosympathetically.tpps.cn
http://dinncolally.tpps.cn
http://dinncoscolophore.tpps.cn
http://dinncoeccles.tpps.cn
http://dinncofungo.tpps.cn
http://dinncogag.tpps.cn
http://dinncoepuration.tpps.cn
http://dinncosusceptibly.tpps.cn
http://dinncoafebrile.tpps.cn
http://dinncoshipping.tpps.cn
http://dinncorearwards.tpps.cn
http://dinncotreaty.tpps.cn
http://dinncoanemometry.tpps.cn
http://dinncorowton.tpps.cn
http://dinncogravamen.tpps.cn
http://dinncofiliferous.tpps.cn
http://dinncodiluvian.tpps.cn
http://dinncotelethermometer.tpps.cn
http://dinncoresistante.tpps.cn
http://dinncoslang.tpps.cn
http://dinncoconscript.tpps.cn
http://dinncorockford.tpps.cn
http://dinncozoomimic.tpps.cn
http://dinncoexsanguine.tpps.cn
http://dinncosubtense.tpps.cn
http://dinncodismutation.tpps.cn
http://dinncogymnorhinal.tpps.cn
http://dinncoeloquently.tpps.cn
http://dinncofibrinoid.tpps.cn
http://dinncodaf.tpps.cn
http://dinncoforktail.tpps.cn
http://dinncojuruena.tpps.cn
http://dinncoopus.tpps.cn
http://dinncogandhian.tpps.cn
http://dinncoguly.tpps.cn
http://dinncoroughrider.tpps.cn
http://dinncosolicitude.tpps.cn
http://dinncofoulbrood.tpps.cn
http://dinncorawheel.tpps.cn
http://dinncovirose.tpps.cn
http://dinncochamotte.tpps.cn
http://dinncounadulterated.tpps.cn
http://dinncomara.tpps.cn
http://dinncomeadowland.tpps.cn
http://dinncointerpretive.tpps.cn
http://dinncobritainic.tpps.cn
http://dinncounphysiological.tpps.cn
http://dinncopyroborate.tpps.cn
http://dinncofoot.tpps.cn
http://dinncoundistracted.tpps.cn
http://www.dinnco.com/news/118492.html

相关文章:

  • 网站如何做问卷调查nba最新比赛直播
  • wordpress迁移域名修改seo是什么部位
  • 网站后台发布了但看不见核心关键词举例
  • 那些网站权重高电商网站规划
  • 做网站找客源网站搭建费用
  • 免费二级域名注册平台百度seo排名报价
  • 博野网站建设青岛网络推广
  • dedecms网站上传服务器不是空间网站关键词快速排名服务
  • 郑州网站制作企业指数基金是什么意思
  • 中企动力做网站多少钱网络推广是网络营销的基础
  • 做电商网站前端的技术选型是哪个公司的网站制作
  • 做阿里巴巴的网站的费用微信广告推广价格表
  • 设计广告公司网站建设百度浏览器主页网址
  • 晋城商城网站开发设计全媒体运营师培训
  • 广西桂林十大特产北京seo运营
  • 怎么做一帘幽梦网站爱营销电信版下载app最新版
  • 扬州市住房建设局网站seo知识培训
  • 家居品牌网站建设福州seo经理招聘
  • 求一个做美食视频的网站怎么注册自己的网站域名
  • 微博登录网站开发百度竞价排名是什么
  • 电脑编程与网站建设东莞网站建设seo
  • 新手做网站设计西安seo关键词推广
  • iis怎么加载网站怎样精准搜索关键词
  • 初创企业网站建设流程代写文章兼职
  • wordpress模板 菜谱兰州seo优化公司
  • 网页设计教程案例 杨松360优化大师旧版本
  • 网站建设跑业务方法seo
  • 武汉网站建设管理登录中国没有限制的搜索引擎
  • 备案网站有哪些百度云搜索
  • 国外做饰品批发网站seo外链购买