Halcon Connection|聯通算子講解

上結果:
在這裏插入圖片描述
上原圖:
在這裏插入圖片描述
上代碼:


dev_close_window()

dev_update_off()

read_image (Image, 'D:/HalconWorkplace/img/connection.png')

get_image_size (Image, Width, Height)

dev_open_window (0, 0, Width, Height, 'black', WindowHandle)

dev_display(Image)

dev_set_colored(12)

threshold(Image,Light,150.0,255.0)

count_obj(Light,Number1)

set_tposition (WindowHandle, 15, 100)

dev_set_color ('red')

write_string(WindowHandle, 'Number of regions after threshold = '+ Number1)

dev_set_colored(12)

dev_display(Light)

connection(Light,Many)

count_obj(Many,Number2)

set_tposition (WindowHandle, 35, 100)

write_string(WindowHandle, 'Number of regions after connection = '+ Number2)

dev_display (Many)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章