gen_random_regiongen_random_regionGenRandomRegionGenRandomRegiongen_random_region (算子)

名称

gen_random_regiongen_random_regionGenRandomRegionGenRandomRegiongen_random_region — 创建一个随机区域。

签名

gen_random_region( : RegionRandom : Width, Height : )

Herror gen_random_region(Hobject* RegionRandom, const Hlong Width, const Hlong Height)

Herror T_gen_random_region(Hobject* RegionRandom, const Htuple Width, const Htuple Height)

void GenRandomRegion(HObject* RegionRandom, const HTuple& Width, const HTuple& Height)

void HRegion::GenRandomRegion(Hlong Width, Hlong Height)

static void HOperatorSet.GenRandomRegion(out HObject regionRandom, HTuple width, HTuple height)

void HRegion.GenRandomRegion(int width, int height)

def gen_random_region(width: int, height: int) -> HObject

描述

算子 gen_random_regiongen_random_regionGenRandomRegionGenRandomRegionGenRandomRegiongen_random_region returns a random region. During this process every pixel in the image area [0...Width-1][0...Height-1] is adapted into the region with the probability 0.5. The created region can be imagined as the threshold formation in an image with noise.

This procedure is particularly important for the creation of uncorrelated binary patterns. The random pattern is created by the C function “nrand48()”.

注意

If WidthWidthWidthWidthwidthwidth and HeightHeightHeightHeightheightheight are chosen large (> 100) the created region may require much storage space due to the internally used runlength coding. The gray values of the output region are undefined.

执行信息

参数

RegionRandomRegionRandomRegionRandomRegionRandomregionRandomregion_random (输出对象)  region objectHRegionHObjectHRegionHobject *

Created random region with expansion WidthWidthWidthWidthwidthwidth x HeightHeightHeightHeightheightheight

WidthWidthWidthWidthwidthwidth (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum horizontal expansion of random region.

默认值: 128

建议值: 16, 32, 50, 64, 100, 128, 256, 300, 400, 512

值范围: Width Width Width Width width width (lin)

最小增量: 1

建议增量: 10

限制: Width > 0

HeightHeightHeightHeightheightheight (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum vertical expansion of random region.

默认值: 128

建议值: 16, 32, 50, 64, 100, 128, 256, 300, 400, 512

值范围: Height Height Height Height height height (lin)

最小增量: 1

建议增量: 10

限制: Height > 0

复杂度

The worst case for the storage complexity for the created region (in byte) is: O(Width * Height * 2).

结果

如果参数值正确,算子 gen_random_regiongen_random_regionGenRandomRegionGenRandomRegionGenRandomRegiongen_random_region 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。 The clipping according to the current image format is set via the operator set_system('clip_region',<'true'/'false'>)set_system("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)set_system("clip_region",<"true"/"false">)

可能的后继

paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain

另见

gen_checker_regiongen_checker_regionGenCheckerRegionGenCheckerRegionGenCheckerRegiongen_checker_region, add_noise_distributionadd_noise_distributionAddNoiseDistributionAddNoiseDistributionAddNoiseDistributionadd_noise_distribution, add_noise_whiteadd_noise_whiteAddNoiseWhiteAddNoiseWhiteAddNoiseWhiteadd_noise_white, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain

模块

基础