MCPcopy
hub / github.com/cvg/Hierarchical-Localization / read_next_bytes

Function read_next_bytes

hloc/utils/read_write_model.py:76–85  ·  view source on GitHub ↗

Read and unpack the next bytes from a binary file. :param fid: :param num_bytes: Sum of combination of {2, 4, 8}, e.g. 2, 6, 16, 30, etc. :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. :param endian_character: Any of {@, =, <, >, !} :return: Tuple of r

(fid, num_bytes, format_char_sequence, endian_character="<")

Source from the content-addressed store, hash-verified

74
75
76def read_next_bytes(fid, num_bytes, format_char_sequence, endian_character="<"):
77 """Read and unpack the next bytes from a binary file.
78 :param fid:
79 :param num_bytes: Sum of combination of {2, 4, 8}, e.g. 2, 6, 16, 30, etc.
80 :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}.
81 :param endian_character: Any of {@, =, <, >, !}
82 :return: Tuple of read and unpacked values.
83 """
84 data = fid.read(num_bytes)
85 return struct.unpack(endian_character + format_char_sequence, data)
86
87
88def write_next_bytes(fid, data, format_char_sequence, endian_character="<"):

Callers 3

read_cameras_binaryFunction · 0.85
read_images_binaryFunction · 0.85
read_points3D_binaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected