码迷,mamicode.com
首页 > 其他好文 > 详细

Halcon之计算距离算子

时间:2018-04-03 18:17:11      阅读:1950      评论:0      收藏:0      [点我收藏+]

标签:distance_ss   distance_lr   distance_sr   distance_pp   distance_pc   

*读取一张图像 read_image(Image,'Circle.jpg') *画生成区域 draw_region(Region, 3600) *区域->图像 reduce_domain(Image, Region, ImageReduced) *阈值分割 threshold(ImageReduced, Region1, 0, 35) *区域连通->将区域分开 connection(Region1, ConnectedRegions) *区域排序 sort_region(ConnectedRegions, SortedRegions, 'first_point', 'true', 'column') *输出第几个区域(区域1区域2) select_obj(SortedRegions, ObjectSelected, 1) select_obj(SortedRegions, ObjectSelected1, 2) *区域面积,得到区域面积及中心点坐标 area_center(ObjectSelected,Area, Row, Column) area_center(ObjectSelected1, Area1, Row1, Column1) *区域转轮廓(gen_region_contour_xld轮廓转区域) gen_contour_region_xld(ObjectSelected1,Contours, 'border') ***************点到点距离 distance_pp(Row,Column,Row1, Column1, Distance) ***************点到区域距离 distance_pr(ObjectSelected1,Row,Column,DistanceMin, DistanceMax) ***************点到轮廓距离 distance_pc(Contours,Row,Column,DistanceMin1, DistanceMax1) draw_region(Region2, 3600) reduce_domain(Image, Region2, ImageReduced1) *提取亚像素边缘 edges_sub_pix(ImageReduced1, Edges, 'sobel_fast', 82, 30, 50) count_obj(Edges, Number) *轮廓排序 sort_contours_xld(Edges, SortedContours, 'upper_left', 'true', 'row') *选择轮廓(直线1直线2) select_obj(SortedContours, ObjectSelected2, 1) select_obj(SortedContours, ObjectSelected3, 2) *轮廓拟合(直线1直线2) fit_line_contour_xld(ObjectSelected2,'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist) fit_line_contour_xld(ObjectSelected3, 'tukey', -1, 0, 5, 2, RowBegin1, ColBegin1, RowEnd1, ColEnd1, Nr1, Nc1, Dist1) *将输入行存储为区域 *gen_region_line(RegionLines, RowBegin, ColBegin, RowEnd, ColEnd) *从区域中提取XLD轮廓 *gen_contour_region_xld(RegionLines, Contours1, 'border') *******************点到直线距离 distance_pl(Row,Column,RowBegin,ColBegin,RowEnd,ColEnd,Distance1) *******************线段到线段距离 distance_ss(RowBegin1,ColBegin1,RowEnd1,ColEnd1,RowBegin,ColBegin,RowEnd,ColEnd,DistanceMin2, DistanceMax2) *******************直线到区域距离 distance_lr(ObjectSelected,RowBegin1,ColBegin1,RowEnd1,ColEnd1,DistanceMin3, DistanceMax3) *******************线段到区域距离 distance_sr(ObjectSelected,RowBegin1,ColBegin1,RowEnd1,ColEnd1,DistanceMin4, DistanceMax4)


Halcon之计算距离算子

标签:distance_ss   distance_lr   distance_sr   distance_pp   distance_pc   

原文地址:http://blog.51cto.com/green906/2094339

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!