halcon视觉第二十一讲 halcon找出图像中的指定矩形


read_image(Image, ‘fabrik’)

get_image_size(Image, Width, Height)

dev_close_window()

dev_open_window(0, 0, Width, Height, ‘black’, WindowHandle)

set_display_font(WindowHandle, 16, ‘mono’, ‘true’, ‘false’)//设置字体

dev_set_draw(‘margin’)

dev_set_part(0, 0, Height, Width)

dev_display(Image)

threshold(Image, Region, 165, 255)//二值化全局阈值

*阈值后找个多个符合要求的区域

connection(Region, ConnectedRegions) //将相邻区域连接,不相邻区域分开

select_shape_std(ConnectedRegions, SelectedRegions, ‘max_area’, 70)//找出最大区域

fill_up(SelectedRegions, RegionFillUp)//填充


  目录