Halcon算子翻译——break

名称

break - 结束循环执行或离开一个switch段。

用法

break( : : : )

描述

  break结束最近的for,while,或repeat..until循环。 另外,break语句用于离开switch段,特别是在一个case分支的结尾处。 程序跳出,继续在随后的程序行中执行(The program execution is continued at the program line following the corresponding block.)。

  不在循环或switch段的break语句无效。

案例(HDevelop)

read_image (Image, 'monkey')
threshold (Image, Region, 160, 180)
connection (Region, Regions)
Number := |Regions|
AllRegionsValid := 1
* check if for all regions area <=30
for i := 1 to Number by 1
  ObjectSelected := Regions[i]
  area_center (ObjectSelected, Area, Row, Column)
  if (Area > 30)
    AllRegionsValid := 0
    break
  endif
endfor

结果

break(作为算子)总是返回2(H_MSG_TRUE)。

备选

continue

See also

for, while, repeat, until, switch, case

模块

Foundation

HDevelop例程

two_camera_calibration.hdev        Perform high precision mosaicking using a special calibration object
switch_case.hdev              Use switch/case statement for a multiway branch
handeye_stationarycam_grasp_nut.hdev     Calculate pose for grasping a nut based on results of hand-eye calibration for a stationary camera
camera_calibration_external.hdev      Measure positions on a caliper rule using camera calibration
3d_matching_clamps.hdev            Recognize 3D objects in images using a 3D DXF model

原文地址:https://www.cnblogs.com/xhiong/p/7824910.html