pycvcam.TransformMasked.to_dict#

TransformMasked.to_dict()[source]#

Serialize the transformation masked to a dictionary.

Here is an example of the dictionary structure:

from pycvcam import Cv2Distortion
from pycvcam import TransformMasked
from pycvcam import write_transform

distortion = Cv2Distortion(...)
distortion.parameters = numpy.array([0.1, 0.2, 0.3, 0.01, 0.5])
masked = TransformMasked(distortion, numpy.array([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0]]))
masked_dict = masked.to_dict()

The content of the dict will be similar to:

{
    "type": "TransformMasked",
    "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
        },
    "mask": [true, true, false, false, false]
}

See also

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

Returns:

A dictionary representation of the transformation.

Return type:

Dict[str, Any]