ClassesClassesClassesClasses | | | | Operators

gen_random_regiongen_random_regionGenRandomRegiongen_random_regionGenRandomRegionGenRandomRegion (Operator)


gen_random_regiongen_random_regionGenRandomRegiongen_random_regionGenRandomRegionGenRandomRegion — Create a 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)

Herror gen_random_region(Hobject* RegionRandom, const HTuple& Width, const HTuple& Height)

HRegion HRegion::GenRandomRegion(const HTuple& Width, const HTuple& Height)

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

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

void HOperatorSetX.GenRandomRegion(
[out] IHUntypedObjectX*RegionRandom, [in] VARIANT Width, [in] VARIANT Height)

void HRegionX.GenRandomRegion(
[in] Hlong Width, [in] Hlong Height)

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

void HRegion.GenRandomRegion(int width, int height)


The operator gen_random_regiongen_random_regionGenRandomRegiongen_random_regionGenRandomRegionGenRandomRegion 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.



RegionRandomRegionRandomRegionRandomRegionRandomRegionRandomregionRandom (output_object)  region objectHRegionHRegionHRegionHRegionXHobject *

Created random region with expansion WidthWidthWidthWidthWidthwidth x HeightHeightHeightHeightHeightheight.

WidthWidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Maximum horizontal expansion of random region.

Default value: 128

Suggested values: 16, 32, 50, 64, 100, 128, 256, 300, 400, 512

Typical range of values: 1 ≤ Width Width Width Width Width width ≤ 512 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: Width > 0

HeightHeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Maximum vertical expansion of random region.

Default value: 128

Suggested values: 16, 32, 50, 64, 100, 128, 256, 300, 400, 512

Typical range of values: 1 ≤ Height Height Height Height Height height ≤ 512 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: Height > 0


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


If the parameter values are correct, the operator gen_random_regiongen_random_regionGenRandomRegiongen_random_regionGenRandomRegionGenRandomRegion returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised. 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">)set_system("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">).

Possible Successors

paint_regionpaint_regionPaintRegionpaint_regionPaintRegionPaintRegion, reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain

See also

gen_checker_regiongen_checker_regionGenCheckerRegiongen_checker_regionGenCheckerRegionGenCheckerRegion, add_noise_distributionadd_noise_distributionAddNoiseDistributionadd_noise_distributionAddNoiseDistributionAddNoiseDistribution, add_noise_whiteadd_noise_whiteAddNoiseWhiteadd_noise_whiteAddNoiseWhiteAddNoiseWhite, reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain



ClassesClassesClassesClasses | | | | Operators