while例程

dev_update_window (‘off’)
dev_close_window ()
dev_open_window (0, 0, 512, 512, ‘black’, WindowID)
read_image (Image, ‘particle’)
dev_display (Image)
stop ()
threshold (Image, Large, 110, 255)
dilation_circle (Large, LargeDilation, 7.5)//以圆为单位进行区域膨胀
dev_display (Image)
dev_set_draw (‘margin’)
dev_set_line_width (3)
dev_set_color (‘green’)
dev_display (LargeDilation)
*dev_set_draw (‘fill’)
stop ()
complement (LargeDilation, NotLarge)//获得输入区域的补集
reduce_domain (Image, NotLarge, ParticlesRed)
mean_image (ParticlesRed, Mean, 31, 31)
dyn_threshold (ParticlesRed, Mean, SmallRaw, 3, ‘light’)//动态分割图像
opening_circle (SmallRaw, Small, 2.5)
connection (Small, SmallConnection)
dev_display (Image)
dev_set_colored (12)
dev_display (SmallConnection)

stop ()
dev_set_color (‘green’)
dev_display (Image)
dev_display (SmallConnection)
Button := 1
while (Button == 1)
dev_set_color (‘green’)
get_mbutton (WindowID, Row, Column, Button)//获得鼠标的坐标和操作的按键
dev_display (Image)
dev_display (SmallConnection)
dev_set_color (‘red’)
select_region_point (SmallConnection, SmallSingle, Row, Column)//获得包含该点的所有区域
dev_display (SmallSingle)
count_obj (SmallSingle, NumSingle)
if (NumSingle == 1)
intensity (SmallSingle, Image, MeanGray, DeviationGray)//获得区域的平均灰度值和方差
area_center (SmallSingle, Area, Row, Column)
dev_set_color (‘yellow’)

    set_tposition (WindowID, Row, Column)//设置显示字体的光标位置
    write_string (WindowID, 'Area=' + Area + ', Int=' + MeanGray)//在窗口打印字符串
endif

endwhile
dev_set_line_width (1)
dev_update_window (‘on’)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值