Halcon之计算距离算子
*读取一张图像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)
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。