Skip to content

gen_random_regionsGenRandomRegionsGenRandomRegionsgen_random_regionsgen_random_regionsπŸ”—

Short descriptionπŸ”—

gen_random_regionsGenRandomRegionsGenRandomRegionsgen_random_regionsgen_random_regions β€” Create random regions like circles, rectangles and ellipses.

SignatureπŸ”—

gen_random_regions( out region Regions, string Type, number WidthMin, number WidthMax, number HeightMin, number HeightMax, number PhiMin, number PhiMax, integer NumRegions, integer Width, integer Height )void GenRandomRegions( HObject* Regions, const HTuple& Type, const HTuple& WidthMin, const HTuple& WidthMax, const HTuple& HeightMin, const HTuple& HeightMax, const HTuple& PhiMin, const HTuple& PhiMax, const HTuple& NumRegions, const HTuple& Width, const HTuple& Height )static void HOperatorSet.GenRandomRegions( out HObject regions, HTuple type, HTuple widthMin, HTuple widthMax, HTuple heightMin, HTuple heightMax, HTuple phiMin, HTuple phiMax, HTuple numRegions, HTuple width, HTuple height )def gen_random_regions( type: str, width_min: Union[float, int], width_max: Union[float, int], height_min: Union[float, int], height_max: Union[float, int], phi_min: Union[float, int], phi_max: Union[float, int], num_regions: int, width: int, height: int ) -> HObject

Herror gen_random_regions( Hobject* Regions, const char* Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, const Hlong NumRegions, const Hlong Width, const Hlong Height )

Herror T_gen_random_regions( Hobject* Regions, const Htuple Type, const Htuple WidthMin, const Htuple WidthMax, const Htuple HeightMin, const Htuple HeightMax, const Htuple PhiMin, const Htuple PhiMax, const Htuple NumRegions, const Htuple Width, const Htuple Height )

void HRegion::GenRandomRegions( const HString& Type, const HTuple& WidthMin, const HTuple& WidthMax, const HTuple& HeightMin, const HTuple& HeightMax, const HTuple& PhiMin, const HTuple& PhiMax, Hlong NumRegions, Hlong Width, Hlong Height )

void HRegion::GenRandomRegions( const HString& Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, Hlong NumRegions, Hlong Width, Hlong Height )

void HRegion::GenRandomRegions( const char* Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, Hlong NumRegions, Hlong Width, Hlong Height )

void HRegion::GenRandomRegions( const wchar_t* Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, Hlong NumRegions, Hlong Width, Hlong Height ) (Windows only)

void HRegion.GenRandomRegions( string type, HTuple widthMin, HTuple widthMax, HTuple heightMin, HTuple heightMax, HTuple phiMin, HTuple phiMax, int numRegions, int width, int height )

void HRegion.GenRandomRegions( string type, double widthMin, double widthMax, double heightMin, double heightMax, double phiMin, double phiMax, int numRegions, int width, int height )

DescriptionπŸ”—

The operator gen_random_regionsGenRandomRegions generates regions, whose parameters are determined at random within the given limits, and returns them in Regionsregionsregions.

The parameter NumRegionsnumRegionsnum_regions determines how many regions are created.

The position is always random and cannot be determined by parameters, but the center of every region lies in the pixel area [0…Widthwidthwidth-1] [0…Heightheightheight-1].

The parameter Typetypetype defines the type of the regions. The meaning of the lower and upper limits depends on Typetypetype:

The random parameters are generated using the C function β€œnrand48()”. See the parameter 'seed_rand'"seed_rand" of set_systemSetSystem for information on the used random seed.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Regionsregionsregions (output_object) region-array β†’ objectHObjectHRegionHObjectHobject *

Created regions.

Typetypetype (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of regions to be created.

Default: 'circle'"circle"
List of values: 'circle', 'ellipse', 'rectangle1', 'rectangle2', 'ring'"circle", "ellipse", "rectangle1", "rectangle2", "ring"

WidthMinwidthMinwidth_min (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Minimum object characteristic, depending on type and value.

Default: 10.010.0
Suggested values: 1.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.01.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.0
Value range: 0 ≀ WidthMin (lin)
Minimum increment: 1.0
Recommended increment: 10.0

WidthMaxwidthMaxwidth_max (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum object characteristic, depending on type and value.

Default: 20.020.0
Suggested values: 1.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.01.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.0
Value range: WidthMax (lin)
Minimum increment: 1.0
Recommended increment: 10.0
Restriction: WidthMin <= WidthMax

HeightMinheightMinheight_min (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Minimum object characteristic, depending on type and value.

Default: 10.010.0
Suggested values: 1.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.01.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.0
Value range: 0 ≀ HeightMin (lin)
Minimum increment: 1.0
Recommended increment: 10.0

HeightMaxheightMaxheight_max (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum object characteristic, depending on type and value.

Default: 30.030.0
Suggested values: 1.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.01.0, 3.0, 5.0, 10.0, 20.0, 40.0, 80.0
Value range: HeightMax (lin)
Minimum increment: 1.0
Recommended increment: 10.0
Restriction: HeightMin <= HeightMax

PhiMinphiMinphi_min (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Minimum rotation angle of the region.

Default: -0.7854-0.7854
Suggested values: 0.0, 0.1, 0.3, 0.6, 0.9, 1.2, 1.50.0, 0.1, 0.3, 0.6, 0.9, 1.2, 1.5
Value range: 0.0 ≀ PhiMin ≀ 6.28 (lin)
Restriction: PhiMin > 0

PhiMaxphiMaxphi_max (input_control) number β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum rotation angle of the region.

Default: 0.78540.7854
Suggested values: 0.0, 0.1, 0.3, 0.6, 0.9, 1.2, 1.50.0, 0.1, 0.3, 0.6, 0.9, 1.2, 1.5
Value range: 0.0 ≀ PhiMax ≀ 6.28 (lin)
Restriction: PhiMax > 0

NumRegionsnumRegionsnum_regions (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of regions.

Default: 100100
Suggested values: 1, 5, 20, 100, 200, 500, 1000, 20001, 5, 20, 100, 200, 500, 1000, 2000
Value range: 1 ≀ NumRegions (lin)
Minimum increment: 1
Recommended increment: 10

Widthwidthwidth (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Maximum horizontal expansion of the centers.

Default: 512512
Suggested values: 128, 256, 512, 1024128, 256, 512, 1024
Value range: 1 ≀ Width (lin)
Minimum increment: 1
Recommended increment: 10

Heightheightheight (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Maximum vertical expansion of the centers.

Default: 512512
Suggested values: 128, 256, 512, 1024128, 256, 512, 1024
Value range: 1 ≀ Height (lin)
Minimum increment: 1
Recommended increment: 10

ResultπŸ”—

If the parameter values are correct gen_random_regionsGenRandomRegions returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised. The clipping according to the current image format is determined by the operator set_system('clip_region',<'true'/'false'>).

Combinations with other operatorsπŸ”—

Combinations

Possible successors

paint_regionPaintRegion

ModuleπŸ”—

Foundation