blenderproc.python.modules.provider.sampler.UpperRegionSamplerModule module

class blenderproc.python.modules.provider.sampler.UpperRegionSamplerModule.UpperRegionSamplerModule(config)[source]

Bases: blenderproc.python.modules.main.Provider.Provider

Uniformly samples 3-dimensional value over the bounding box of the specified objects (can be just a plane) in the defined upper direction. If “use_upper_dir” is False, samples along the face normal closest to “upper_dir”. The sampling volume results in a parallelepiped. “min_height” and “max_height” define the sampling distance from the face.

Example 1: Sample a location on the surface of the first object to match the name pattern with height above this surface in range of [1.5, 1.8].

{
  "provider": "sampler.UpperRegionSampler",
  "min_height": 1.5,
  "max_height": 1.8,
  "to_sample_on": {
    "provider": "getter.Entity",
    "index": 0,
    "conditions": {
      "name": "Table.*"
    }
  }
}

Configuration:

Parameter Description Type
to_sample_on Objects, on which to sample on. Provider
min_height Minimum distance to the bounding box that a point is sampled on. Default: 0.0. float
max_height Maximum distance to the bounding box that a point is sampled on. Default: 1.0. float
face_sample_range Restricts the area on the face where objects are sampled. Specifically describes relative lengths of both face vectors between which points are sampled. Default: [0.0, 1.0] list
upper_dir The ‘up’ direction of the sampling box. Default: [0.0, 0.0, 1.0]. list
use_upper_dir Toggles the sampling above the selected surface, can be done with the upper_dir or with the face normal, if this is true the upper_dir is used. Default: True. bool
use_ray_trace_check Toggles using a ray casting towards the sampled object (if the object is directly below the sampled position is the position accepted). Default: False. bool
run()[source]

Samples based on the description above.

Returns:Sampled value. Type: mathutils.Vector