blenderproc.python.writer.WriterUtility module¶
-
class
blenderproc.python.writer.WriterUtility.
WriterUtility
[source]¶ Bases:
object
-
static
_get_shapenet_attribute
(shapenet_obj, attribute_name, local_frame_change=None, world_frame_change=None)[source]¶ Returns the value of the requested attribute for the given object.
Parameters: - shapenet_obj (
Object
) – The ShapeNet object. - attribute_name (
str
) – The attribute name. - local_frame_change (
Optional
[List
[str
]]) – Can be used to change the local coordinate frame of matrices. Default: [“X”, “Y”, “Z”] - world_frame_change (
Optional
[List
[str
]]) – Can be used to change the world coordinate frame of points and matrices. Default: [“X”, “Y”, “Z”]
Returns: The attribute value.
- shapenet_obj (
-
static
_get_stereo_path_pair
(file_path)[source]¶ Returns stereoscopic file path pair for a given “normal” image file path.
Parameters: file_path ( str
) – The file path of a single image.Return type: Tuple
[str
,str
]Returns: The pair of file paths corresponding to the stereo images,
-
static
_load_csv
(file_path)[source]¶ Load the csv file at the given path.
Parameters: file_path ( str
) – The path. Type: string.Return type: List
[Any
]Returns: The content of the file
-
static
_write_to_hdf_file
(file, key, data, compression='gzip')[source]¶ Adds the given data as a new entry to the given hdf5 file.
Parameters:
-
static
get_cam_attribute
(cam_ob, attribute_name, local_frame_change=None, world_frame_change=None)[source]¶ Returns the value of the requested attribute for the given object.
Parameters: - cam_ob (<bpy_struct, Object("Camera") at 0x7f3820897408>) – The camera object.
- attribute_name (
str
) – The attribute name. - local_frame_change (
Optional
[List
[str
]]) – Can be used to change the local coordinate frame of matrices. Default: [“X”, “Y”, “Z”] - world_frame_change (
Optional
[List
[str
]]) – Can be used to change the world coordinate frame of points and matrices. Default: [“X”, “Y”, “Z”]
Return type: Returns: The attribute value.
-
static
get_common_attribute
(item, attribute_name, local_frame_change=None, world_frame_change=None)[source]¶ Returns the value of the requested attribute for the given item.
This method covers all general attributes that blender objects have.
Parameters: - item (
Object
) – The item. Type: blender object. - attribute_name (
str
) – The attribute name. Type: string. - local_frame_change (
Optional
[List
[str
]]) – Can be used to change the local coordinate frame of matrices. Default: [“X”, “Y”, “Z”] - world_frame_change (
Optional
[List
[str
]]) – Can be used to change the world coordinate frame of points and matrices. Default: [“X”, “Y”, “Z”]
Return type: Returns: The attribute value.
- item (
-
static
get_light_attribute
(light, attribute_name, local_frame_change=None, world_frame_change=None)[source]¶ Returns the value of the requested attribute for the given light.
Parameters: - light (
Light
) – The light. Type: blender scene object of type light. - attribute_name (
str
) – The attribute name. - local_frame_change (
Optional
[List
[str
]]) – Can be used to change the local coordinate frame of matrices. Default: [“X”, “Y”, “Z”] - world_frame_change (
Optional
[List
[str
]]) – Can be used to change the world coordinate frame of points and matrices. Default: [“X”, “Y”, “Z”]
Return type: Returns: The attribute value.
- light (
-
static
load_output_file
(file_path, load_alpha_channel=False, remove=True)[source]¶ Tries to read in the file with the given path into a numpy array.
Parameters: Return type: Returns: Loaded data from the file as numpy array if possible.
-
static
-
blenderproc.python.writer.WriterUtility.
write_hdf5
(output_dir_path, output_data_dict, append_to_existing_output=False, stereo_separate_keys=False)[source]¶ Saves the information provided inside of the output_data_dict into a .hdf5 container
Parameters: - output_dir_path (
str
) – The folder path in which the .hdf5 containers will be generated - output_data_dict (
Dict
[str
,List
[Union
[ndarray
,list
,dict
]]]) – The container, which keeps the different images, which should be saved to disc. Each key will be saved as its own key in the .hdf5 container. - append_to_existing_output (
bool
) – If this is True, the output_dir_path folder will be scanned for pre-existing .hdf5 containers and the numbering of the newly added containers, will start right where the last run left off. - stereo_separate_keys (
bool
) – If this is True and the rendering was done in stereo mode, than the stereo images won’t be saved in one tensor [2, img_x, img_y, channels], where the img[0] is the left image and img[1] the right. They will be saved in separate keys: for example for colors in colors_0 and colors_1.
- output_dir_path (