blenderproc.python.camera.CameraValidation module
Useful functions ot evaluate the objects in the camera’s viewport.
- blenderproc.python.camera.CameraValidation.check_novel_pose(cam2world_matrix, existing_poses, check_pose_novelty_rot, check_pose_novelty_translation, min_var_diff_rot=-1, min_var_diff_translation=-1)[source]
Checks if a newly sampled pose is novel based on variance checks.
- Parameters:
cam2world_matrix (
Union
[Matrix
,ndarray
]) – The world matrix which describes the camera pose to check.existing_poses (
List
[Union
[Matrix
,ndarray
]]) – The list of already sampled valid poses.check_pose_novelty_rot (
bool
) – Checks that a sampled new pose is novel with respect to the rotation component.check_pose_novelty_translation (
bool
) – Checks that a sampled new pose is novel with respect to the translation component.min_var_diff_rot (
float
) – Considers a pose novel if it increases the variance of the rotation component of all poses sampled by this parameter’s value in percentage. If set to -1, then it would only check that the variance is increased. Default: sys.float_info.min.min_var_diff_translation (
float
) – Same as min_var_diff_rot but for translation. If set to -1, then it would only check that the variance is increased. Default: sys.float_info.min.
- Returns:
True, if the given pose is novel.
- blenderproc.python.camera.CameraValidation.decrease_interest_score(interest_score, min_interest_score, interest_score_step)[source]
Decreases the interest scores in the given interval
- Parameters:
interest_score (
float
) – The current interest score.min_interest_score (
float
) – The minimum desired interest scores.interest_score_step (
float
) – The step size in which the interest score should be reduced.
- Returns:
Returns the new interest score, and True/False if minimum has not been reached.
- blenderproc.python.camera.CameraValidation.perform_obstacle_in_view_check(cam2world_matrix, proximity_checks, bvh_tree, sqrt_number_of_rays=10)[source]
- Check if there are obstacles in front of the camera which are too far or too close based on the given
proximity_checks.
- Parameters:
cam2world_matrix (
Union
[Matrix
,ndarray
]) – Transformation matrix that transforms from the camera space to the world space.proximity_checks (
dict
) – A dictionary containing operators (e.g. avg, min) as keys and as values dictionaries containing thresholds in the form of {“min”: 1.0, “max”:4.0} or just the numerical threshold in case of max or min. The operators are combined in conjunction (i.e boolean AND). This can also be used to avoid the background in images, with the no_background: True option.bvh_tree (
BVHTree
) – A bvh tree containing all objects that should be considered here.sqrt_number_of_rays (
int
) – The square root of the number of rays which will be used to determine the visible objects.
- Return type:
bool
- Returns:
True, if the given camera pose does not violate any of the specified proximity_checks.
- blenderproc.python.camera.CameraValidation.scene_coverage_score(cam2world_matrix, special_objects=None, special_objects_weight=2, sqrt_number_of_rays=10)[source]
Evaluate the interestingness/coverage of the scene.
This module tries to look at as many objects at possible, this might lead to a focus on the same objects from similar angles.
- Only for SUNCG and 3D Front:
The least interesting objects: walls, ceilings, floors.
- Parameters:
cam2world_matrix (
Union
[Matrix
,ndarray
]) – The world matrix which describes the camera pose to check.special_objects (
Optional
[list
]) – Objects that weights differently in calculating whether the scene is interesting or not, uses the coarse_grained_class or if not SUNCG, 3D Front, the category_id.special_objects_weight (
float
) – Weighting factor for more special objects, used to estimate how interesting the scene is. Default: 2.0.sqrt_number_of_rays (
int
) – The square root of the number of rays which will be used to determine the visible objects.
- Return type:
float
- Returns:
the scoring of the scene.
- blenderproc.python.camera.CameraValidation.visible_objects(cam2world_matrix, sqrt_number_of_rays=10)[source]
Returns a set of objects visible from the given camera pose.
Sends a grid of rays through the camera frame and returns all objects hit by at least one ray.
- Parameters:
cam2world_matrix (
Union
[Matrix
,ndarray
]) – The world matrix which describes the camera orientation to check.sqrt_number_of_rays (
int
) – The square root of the number of rays which will be used to determine the visible objects.
- Return type:
Set
[MeshObject
]- Returns:
A set of objects visible hit by the sent rays.