halcon找实心圆点算法

发布时间 2023-10-27 14:33:52作者: QuincyYi

read_image (Dotimage, 'DotImage.jpg')
threshold (Dotimage, Region, 0, 100)
closing_circle (Region, RegionClosing, 13.5)
opening_circle (RegionClosing, RegionOpening, 13.5)
connection (RegionOpening, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 3500, 99999)
sort_region (SelectedRegions, SortedRegions, 'character', 'true', 'row')

area_center (SortedRegions, Area, Row, Column)

RowLengthAry:=[]
for Index := 0 to 4 by 1
Rowlength := (Row[Index*6]-Row[Index*6+5])*(Row[Index*6]-Row[Index*6+5])+(Column[Index*6]-Column[Index*6+5])*(Column[Index*6]-Column[Index*6+5])
tuple_sqrt (Rowlength, Rowlength01)

RowLengthAry:=[RowLengthAry,Rowlength01]
endfor

ColLengthAry:=[]
for Index := 0 to 5 by 1
Collength := (Row[Index]-Row[Index+24])*(Row[Index]-Row[Index+24])+(Column[Index]-Column[Index+24])*(Column[Index]-Column[Index+24])
tuple_sqrt (Collength, Collength01)

ColLengthAry:=[ColLengthAry,Collength01]
endfor