pycvcam.read_transform#

read_transform(file_path, cls=None)[source]#

Convenience function to read a Transform object from a JSON file.

See also

pycvcam.core.Transform.to_json() for the corresponding method to write a Transform object to JSON format. The JSON file must contain the following keys: ‘parameters’, ‘constants’, and optional ‘type’.

Important

This function only works with the default Transform subclasses defined in pycvcam. If you have a custom Transform subclass, you should implement your own reading function that uses the pycvcam.core.Transform.from_json() method directly.

Parameters:
  • file_path (str) – The path to the JSON file to read from.

  • cls (Optional[Type[Transform]]) – The class of the Transform object to create. If None, the typewill be determined from the ‘type’ key in the JSON file.

Returns:

An instance of the specified Transform subclass with parameters and constants loaded from the JSON file.

Return type:

Transform