Halcon 数据类型
object图标(图像image\区域region\轮廓xld)
Control 控制tuple int double string
图像
Read_image读取图像
Count_channels读取通道数
Decompose2拆分2通道
compose2合并2通道
Get_image_size获取图像大小
Get_image_type获取图像类型
Get_grayval获取图像灰度值
set_grayval设置图像灰度值
区域
gen_rectangle1生成矩形
gen_rectangle2生成可旋转矩形
Get_region_points获取区域中心点
rad角度转弧度
轮廓(矢量)不随图像改变
gen_circle_contour_xld生成圆形轮廓
get_contour_xld获取轮廓
区域操作
read_image (Image, ‘clip’)
//提取所有的回形针,并获取角度
//二值化
threshold (Image, Regions, 10, 73)
//连通分割
connection (Regions, ConnectedRegions)
//计数
count_obj (ConnectedRegions, Number)
//对象中心–一阶矩:平均值、二阶矩:离散度、三阶矩:偏移径
area_center (ConnectedRegions, Area, Row, Column)
//选择特征
select_shape (ConnectedRegions, SelectedRegions, ‘column’, ‘and’, 83.49, 920.18)
count_obj (SelectedRegions, Number1)
select_shape (ConnectedRegions, SelectedRegions1, ‘width’, ‘and’, 16.06, 500)
count_obj (SelectedRegions1, Number2)
//最小外接圆
//smallest_circle (SelectedRegions1, Row1, Column1, Radius)
//gen_circle (Circle, Row1, Column1, Radius)
//select_shape (ConnectedRegions, SelectedRegions2, [‘width’,‘height’], ‘and’, [21.56,46.79], [21.56,780.73])
//gen_rectangle1 (Rectangle, Row, Column, Row, Column)
//gen_rectangle2_contour_xld (Rectangle, Row, Column, 10, 100.5, 20.5)
//最小外接旋转矩形有角度
smallest_rectangle2 (SelectedRegions1, Row2, Column2, Phi, Length1, Length2)
//gen_rectangle2 (Rectangle, Row2, Column2, Phi, Length1, Length2)
//gen_arrow_contour_xld (Arrow, Row2, Column2, Row2-Length1sin(Phi), Column2+