pycvcam.core.Transform.to_json#

Transform.to_json(filepath)[source]#

Write the transformation to a JSON file.

from pycvcam import Cv2Distortion
from pycvcam import write_transform

distortion = Cv2Distortion(...)
distortion.parameters = numpy.array([0.1, 0.2, 0.3, 0.01, 0.5])
distortion.to_json("distortion.json")

The content of the JSON file will be similar to:

{
    "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

  • from_dict() : Method to create a Transform object from a dictionary.

  • from_json() : Method to read a Transform object from a JSON file.

Parameters:

filepath (str) – The path to the JSON file where the transformation will be saved.

Return type:

None