zoukankan      html  css  js  c++  java
  • Halcon算子翻译——while

    名称

    while - 只要条件为真就开始一次循环分段运行。

    用法

    while( : : Condition : )

    描述

      只要Condition参数的值为'true'(或者数字不等于0),while就会循环运行相应的endwhile语句内的循环体。

      如果Condition判定为'false'(0),则程序在相应的endwhile语句之后继续运行。

    参数

    Condition (input_control) integer → (integer)
      循环的条件

    示例(HDevelop)

    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)
      NumSingle := |SmallSingle|
      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')

    结果

    如果指定参数的值正确,while(作为算子)返回2(H_MSG_TRUE)。 否则会引发异常并返回错误代码。

    备选算子

    for, until

    See also

    repeat, break, continue, if, elseif, else

    模块

    Foundation

    HDevelop例程

    while.hdev      Use a while loop to provide interaction until right mouse button is clicked

  • 相关阅读:
    python登录csdn并自动评论下载资源脚本
    聊聊C语言的预编译指令include
    ANSI C、ISO C、Standard C联系与区别
    我对在开发板上开发程序的一些理解
    关于CMTS设备的一些备忘
    一个简单的EJB例子
    手动部署EJB于WebLogic
    eclipse+MyEclipse+WebLogic开发简单的EJB
    我对视频“分辨率”的理解以及在电视上显示的理解
    VC win32 static library静态链接库简单示例
  • 原文地址:https://www.cnblogs.com/xhiong/p/7832556.html
Copyright © 2011-2022 走看看