halcon算子翻译——region_to_bin

名称

region_to_bin - 将区域转换为二进制字节图像。

用法

region_to_bin(Region : BinImage : ForegroundGray, BackgroundGray, Width, Height : )

描述

  region_to_bin将在Region中给定的输入区域转换为“字节”图像,并将ForegroundGray的灰度值分配给该区域中的所有像素。 如果输入区域大于生成的图像,则会在图像边框处裁剪。 背景灰度值设置为BackgroundGray。

并行

●  多线程类型:可重入(与非独占算子并行运行)。
●  多线程范围:全局(可以从任何线程调用)。
●  不并行化处理。

参数

Region (input_object)   region(-array) → object
  要转换的区域。


BinImage (output_object)    image → object (byte)
  包含转换区域的尺寸Width*Height的结果图像。


ForegroundGray   (input_control) integer → (integer)
  区域内的灰度值。
  Default value: 255
  Suggested values: 0, 1, 50, 100, 128, 150, 200, 254, 255
  Typical range of values: 0 ≤ ForegroundGray ≤ 255 (lin)
  Recommended increment: 1


BackgroundGray (input_control)    integer → (integer)
  背景灰度值
  Default value: 0
  Suggested values: 0, 1, 50, 100, 128, 150, 200, 254, 255
  Typical range of values: 0 ≤ BackgroundGray ≤ 255 (lin)
  Recommended increment: 1


Width (input_control)    extent.x → (integer)
  要生成的图像的宽度。
  Default value: 512
  Suggested values: 256, 512, 1024
  Typical range of values: 1 ≤ Width ≤ 1024 (lin)
  Minimum increment: 1
  Recommended increment: 16
  Restriction: Width >= 1


Height (input_control)   extent.y → (integer)
  要生成的图像的高度。
  Default value: 512
  Suggested values: 256, 512, 1024
  Typical range of values: 1 ≤ Height ≤ 1024 (lin)
  Minimum increment: 1
  Recommended increment: 16
  Restriction: Height >= 1

复杂度

O(2*Height*Width).

结果

  region_to_bin总是返回2(H_MSG_TRUE)。 空输入(没有给定区域)的行为可以通过set_system('no_object_result',<Result>)设置,以及通过set_system('empty_region_result',<Result>)输入空白区域时的行为。 如有必要,会引发异常。

Possible Predecessors

threshold, connection, regiongrowing, pouring

Possible Successors

get_grayval

Alternatives

region_to_label, paint_region, set_grayval

See also

gen_image_proto, paint_gray

模块

Foundation

HDevelop例程

close_contour_gaps.hdev   缩小提取的直线轮廓中的间隙

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