mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-27 19:40:17 +08:00
Fix parsing of non ascii image names in colmap's images.bin (#3256)
Co-authored-by: Justin Kerr <justin.g.kerr@gmail.com>
This commit is contained in:
1 parent
df57a8db72
commit
1af71f2fff
1 file changed
+3
-2
@@ -235,11 +235,12 @@ def read_images_binary(path_to_model_file):
|
||||
qvec = np.array(binary_image_properties[1:5])
|
||||
tvec = np.array(binary_image_properties[5:8])
|
||||
camera_id = binary_image_properties[8]
|
||||
image_name = ""
|
||||
image_name = b""
|
||||
current_char = read_next_bytes(fid, 1, "c")[0]
|
||||
while current_char != b"\x00": # look for the ASCII 0 entry
|
||||
image_name += current_char.decode("utf-8")
|
||||
image_name += current_char
|
||||
current_char = read_next_bytes(fid, 1, "c")[0]
|
||||
image_name = image_name.decode("utf-8")
|
||||
num_points2D = read_next_bytes(fid, num_bytes=8, format_char_sequence="Q")[0]
|
||||
x_y_id_s = read_next_bytes(fid, num_bytes=24 * num_points2D, format_char_sequence="ddq" * num_points2D)
|
||||
xys = np.column_stack([tuple(map(float, x_y_id_s[0::3])), tuple(map(float, x_y_id_s[1::3]))])
|
||||
|
||||
Reference in new issue
Block a user