blenderproc.python.modules.writer.WriterInterface module

class blenderproc.python.modules.writer.WriterInterface.WriterInterface(config)[source]

Bases: blenderproc.python.modules.main.Module.Module

Parent class for all other writers classes, it had the functionality to return objects attributes and write them to file and to load and process post processing modules

Configuration:

Parameter Description Type
postprocessing_modules A dict of list of postprocessing modules. The key in the dict specifies the output to which the postprocessing modules should be applied. Every postprocessing module has to have a run function which takes in the raw data and returns the processed data. dict
destination_frame Used to transform point to blender coordinate frame. Default: [“X”, “Y”, “Z”] list
attributes_to_write A list of attribute names that should written to file. The next table lists all attributes that can be used here. list
output_file_prefix The prefix of the file that should be created. string
output_key The key which should be used for storing the output in a merged file. string
write_alpha_channel If true, the alpha channel will be written to file. Default: False. bool
_apply_postprocessing(output_key, data, version)[source]

Applies all postprocessing modules registered for this output type.

Parameters:
  • output_key (str) – The key of the output type. Type: string
  • data (ndarray) – The numpy data.
  • version (str) – The version number original data.
Returns:

The modified numpy data after doing the postprocessing

_load_and_postprocess(file_path, key, version='1.0.0')[source]

Loads an image and post process it.

Parameters:
  • file_path – Image path. Type: string.
  • key – The image’s key with regards to the hdf5 file. Type: string.
  • version – The version number original data. Type: String. Default: 1.0.0.
Returns:

The post-processed image that was loaded using the file path.

write_attributes_to_file(item_writer, items, default_file_prefix, default_output_key, default_attributes, version='1.0.0')[source]

Writes the state of the given items to a file with the configured prefix.

This method also registers the corresponding output.

Parameters:
  • item_writer – The item writer object to use. Type: object.
  • items – The list of items. Type: list.
  • default_file_prefix – The default file name prefix to use. Type: string.
  • default_output_key – The default output key to use. Type: string.
  • default_attributes – The default attributes to write, if no attributes are specified in the config. Type: list.
  • version – The version to use when registering the output. Type: string.