blenderproc.python.sampler.UpperRegionSampler module
Uniformly samples 3-dimensional value over the bounding box of the specified objects
- class blenderproc.python.sampler.UpperRegionSampler.Region2D(vectors, normal, base_point)[source]
Bases:
object
Helper class for UpperRegionSampler: Defines a 2D region in 3D.
- blenderproc.python.sampler.UpperRegionSampler.upper_region(objects_to_sample_on, face_sample_range=None, min_height=0.0, max_height=1.0, use_ray_trace_check=False, upper_dir=None, use_upper_dir=True)[source]
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 given objects with height above this surface in range of [1.5, 1.8].
UpperRegionSampler.sample( objects_to_sample_on=objs, min_height=1.5, max_height=1.8 )
- Parameters:
objects_to_sample_on (
Union
[MeshObject
,List
[MeshObject
]]) – Objects, on which to sample on.face_sample_range (
Union
[Vector
,ndarray
,List
[float
],None
]) – 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]min_height (
float
) – Minimum distance to the bounding box that a point is sampled on.max_height (
float
) – Maximum distance to the bounding box that a point is sampled on.use_ray_trace_check (
bool
) – Toggles using a ray casting towards the sampled object (if the object is directly below the sampled position is the position accepted).upper_dir (
Union
[Vector
,ndarray
,List
[float
],None
]) – The ‘up’ direction of the sampling box. Default: [0.0, 0.0, 1.0].use_upper_dir (
bool
) – Toggles using a ray casting towards the sampled object (if the object is directly below the sampled position is the position accepted).
- Return type:
ndarray
- Returns:
Sampled value.