pycvcam.TransformModal.to_dict#
- TransformModal.to_dict()[source]#
Serialize the transformation modal to a dictionary.
Here is an example of the dictionary structure:
from pycvcam import Cv2Distortion from pycvcam import TransformModal from pycvcam import write_transform distortion = Cv2Distortion(...) distortion.parameters = numpy.array([0.1, 0.2, 0.3, 0.01, 0.5]) modal = TransformModal(distortion, numpy.array([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0]])) modal_dict = modal.to_dict()
The content of the dict will be similar to:
{ "type": "TransformModal", "version": "1.3.0", "date": "2023-01-01T00:00:00", "transform": { "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 }, "modes": [ [1, 0, 0, 0, 0], [0, 1, 0, 0, 0] ] }
See also
from_dict(): Method to create a TransformModal object from a dictionary.
- Returns:
A dictionary representation of the transformation.
- Return type:
Dict[str, Any]