Example #1
0
 def from_xml(element):
     """
     @type element: lxml.etree.SubElement
     @param element: the element to construct an CameraIntrinsics object from
     @return a new CameraIntrinsics object constructed from XML node with matrices in OpenCV format
     """
     if element is None:
         return Camera.Intrinsics(DEFAULT_RESOLUTION)
     resolution = _resolution_from_xml(element)
     intrinsic_mat = xml.parse_xml_matrix(element.find("intrinsic_mat"))
     distortion_coeffs = xml.parse_xml_matrix(element.find("distortion_coeffs"))
     error, time = _meta_info_from_xml(element)
     return Camera.Intrinsics(resolution, intrinsic_mat, distortion_coeffs, error, time)
Example #2
0
 def from_xml(element):
     """
     Build a CameraExtrinsics object out of the provided XML node with matrices in
     OpenCV format
     @type element: lxml.etree.SubElement
     @param element: the element to construct an StereoRig object from
     @rtype: calib.CameraExtrinsics|None
     @return a new StereoRig object constructed from given XML node, None if element is None
     """
     if element is None:
         return Camera.Extrinsics()
     rotation = xml.parse_xml_matrix(element.find("rotation"))
     translation = xml.parse_xml_matrix(element.find("translation"))
     error, time = _meta_info_from_xml(element)
     return Camera.Extrinsics(rotation, translation, error, time)
Example #3
0
 def from_xml(element):
     """
     Build a CameraExtrinsics object out of the provided XML node with matrices in
     OpenCV format
     @type element: lxml.etree.SubElement
     @param element: the element to construct an StereoRig object from
     @rtype: calib.CameraExtrinsics|None
     @return a new StereoRig object constructed from given XML node, None if element is None
     """
     if element is None:
         return Camera.Extrinsics()
     rotation = xml.parse_xml_matrix(element.find("rotation"))
     translation = xml.parse_xml_matrix(element.find("translation"))
     error, time, calibration_image_count = _meta_info_from_xml(element)
     return Camera.Extrinsics(rotation, translation, error, time,
                              calibration_image_count)
Example #4
0
 def from_xml(element):
     """
     @type element: lxml.etree.SubElement
     @param element: the element to construct an CameraIntrinsics object from
     @return a new CameraIntrinsics object constructed from XML node with matrices in OpenCV format
     """
     if element is None:
         return Camera.Intrinsics(DEFAULT_RESOLUTION)
     resolution = _resolution_from_xml(element)
     intrinsic_mat = xml.parse_xml_matrix(element.find("intrinsic_mat"))
     distortion_coeffs = xml.parse_xml_matrix(
         element.find("distortion_coeffs"))
     error, time, calibration_image_count = _meta_info_from_xml(element)
     return Camera.Intrinsics(resolution, intrinsic_mat,
                              distortion_coeffs, error, time,
                              calibration_image_count)