blenderproc.utility package¶
Module contents¶
-
class
blenderproc.utility.BlockStopWatch(block_name)¶ Bases:
objectCalls a print statement to mark the start and end of this block and also measures execution time.
Usage: with BlockStopWatch(‘text’):
-
class
blenderproc.utility.LabelIdMapping¶ Bases:
objectHandles category id mapping for semantic segmentation maps.
-
add(label, id_value)¶ Inserts the given label-id pair into the mapping.
Parameters:
-
static
from_csv(path, label_col_name='name', id_col_name='id')¶ Builds a label-id mapping based on the given csv file.
Parameters: - path – The path to a csv file.
- label_col_name – The name of the column which should be used as label.
- id_col_name – The name of the column which should be used as id.
Return type: Returns: The built label mapping object.
-
static
from_dict(label_to_id)¶ Builds a label-id mapping based on the given dict.
Parameters: label_to_id ( dict) – A dict where keys are labels and values are ids.Return type: LabelIdMappingReturns: The built label mapping object.
-
has_id(id_value)¶ Checks if the mapping contains the given id.
Parameters: id_value ( int) – The id to look for.Return type: boolReturns: True, if the id is already in use.
-
has_label(label)¶ Checks if the mapping contains the given label.
Parameters: label ( str) – The label to look for.Return type: boolReturns: True, if the label is already in use.
-
-
class
blenderproc.utility.UndoAfterExecution(check_point_name=None, perform_undo_op=True)¶ Bases:
objectReverts all changes done to the blender project inside this block.
Usage: with UndoAfterExecution():
-
blenderproc.utility.generate_random_pattern_img(width, height, n_points)¶ Generate transparent image with random pattern.
Parameters: Return type: ndarray
-
blenderproc.utility.num_frames()¶ Returns the currently total number of registered frames.
Return type: intReturns: The number of frames.
-
blenderproc.utility.reset_keyframes()¶ Removes registered keyframes from all objects and resets frame_start and frame_end
Return type: None
-
blenderproc.utility.resolve_path(path)¶ Returns an absolute path. If given path is relative, current working directory is put in front.
Parameters: path ( str) – The path to resolve.Return type: strReturns: The absolute path.
-
blenderproc.utility.resolve_resource(relative_resource_path)¶ Returns an absolute path to the given BlenderProc resource.
Parameters: relative_resource_path ( str) – The relative path inside the BlenderProc resource folder.Return type: strReturns: The absolute path.
-
blenderproc.utility.set_keyframe_render_interval(frame_start=None, frame_end=None)¶ Sets frame_start and/or frame_end which determine the frames that will be rendered.
Parameters: