ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

5、机器视觉之轮廓的操作

2021-09-04 19:00:47  阅读:212  来源: 互联网

标签:机器 xld gen select 视觉 轮廓 contour 元组


read_image (Image, 'rings_and_nuts')

threshold (Image, Region, 0, 128)

*获取轮廓
*1、通过边缘来提取轮廓"亚像素"
edges_sub_pix (Image, Edges, 'canny', 1, 20, 40)


edges_image (Image, ImaAmp, ImaDir, 'canny', 1, 'nms', 20, 40)

*2.region →轮廓
gen_contour_region_xld (Region, Contours, 'center')

* select_contours_xld (Contours, SelectedContours, 'contour_length', 0.5, 200, -0.5, 0.5)

*筛选弧度>0.9的圆弧

circularity_xld (Edges, Circularity)//轮廓或边缘的圆度
tuple_greater_elem (Circularity, 0.90, Greater)//测试一个元组是否大于另一个元组 
tuple_find (Greater, 1, Indices)//返回一个元组在另一个元组中所有出现的索引


dev_set_color ('red')
dev_set_line_width (5)
select_obj (Edges, ObjectSelected, Indices+1)//从对象元组中选择对象

*轮廓的合并
*轮廓的拟合
*1.圆或圆弧的拟合
fit_circle_contour_xld (Contours, 'algebraic', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)

*通过点转换到轮廓
select_obj (Contours, ObjectSelected1, 2)
get_contour_xld (ObjectSelected1, Row1, Col)

tuple_select_range (Row1, 0,300, SelectedRow)
tuple_select_range (Col, 0,300, SelectedCol)


gen_contour_polygon_xld (Contour, SelectedRow, SelectedCol)
fit_circle_contour_xld (Contour, 'algebraic', -1, 0, 0, 3, 2, Row2, Column1, Radius1, StartPhi1, EndPhi1, PointOrder1)

gen_circle_contour_xld (ContCircle, Row2, Column1, Radius1, StartPhi1, StartPhi1,'negative', 1)


*轮廓的变换
smallest_rectangle1_xld (ContCircle, Row11, Column11, Row21, Column2)

gen_rectangle1 (Rectangle, Row11, Column11, Row21, Column2)


*轮廓的分割
segment_contours_xld (ContCircle, ContoursSplit, 'lines_circles', 5, 4, 2)

*轮廓的裁剪
gen_rectangle1 (Rectangle1, Row11, Column11, Row21, Column2)

clip_contours_xld (ContoursSplit, ClippedContours, Row11, Column11, Row21, Column2)

标签:机器,xld,gen,select,视觉,轮廓,contour,元组
来源: https://blog.csdn.net/weixin_43117514/article/details/120104036

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有