pycvcam.core.Transform.from_json#

classmethod Transform.from_json(filepath)[source]#

Read a Transform object from a JSON file.

The input JSON file should have the following structure:

{
    "type": "Cv2Distortion",
    "version": "1.3.0",
    "date": "2023-01-01T00:00:00",
    "parameters": [0.1, 0.2, 0.3, 0.01, 0.5],
    "constants": null
}

See also

  • to_dict() : Method to serialize the Transform object to a dictionary.

  • to_json() : Method to write the Transform object to a JSON file.

Parameters:

filepath (str) – The path to the JSON file containing the transformation data.

Returns:

A Transform object created from the input JSON file.

Return type:

Transform

Raises:

ValueError – If the JSON file does not contain the required keys or has invalid values.