area_holes算子
学习一些入门的halcon例子,非专业图像处理,个人爱好自学,希望坚持学习下去
获取空洞区域的面积
* This example demonstrates the use of the operator area_holes.
*
* Setup display window
dev_close_window ()
*读取图片
read_image (Image, 'rings_and_nuts')
*根据图片大小打开窗口,设置颜色,设置字体,展示图片
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_set_color ('goldenrod')
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_display (Image)
*
* Create a region
*二值化区域,
threshold (Image, Region, 128, 255)
*
* Compute the area of the holes of the region
*计算区域孔洞面积
area_holes (Region, Area)
*显示孔洞区域信息
disp_message (WindowHandle, 'Size of enclosed area (holes): ' + Area + ' pixel', 'window', 12, 12, 'black', 'true')
*
上善若水,水善利万物而不争,处众人之所恶,故几于道。
浙公网安备 33010602011771号