@@ -62,35 +62,27 @@ def compute_and_save_undistorted_reconstruction(
6262 reconstruction , tracks_manager , data , udata
6363):
6464 image_format = data .config ["undistorted_image_format" ]
65- # pyrefly: ignore [missing-attribute]
6665 urec = types .Reconstruction ()
67- # pyrefly: ignore [missing-attribute]
6866 utracks_manager = pymap .TracksManager ()
6967 undistorted_shots = []
7068 for shot in reconstruction .shots .values ():
7169 if shot .camera .projection_type == "perspective" :
72- # pyrefly: ignore [missing-attribute]
7370 ucamera = osfm_u .perspective_camera_from_perspective (shot .camera )
7471 elif shot .camera .projection_type == "brown" :
75- # pyrefly: ignore [missing-attribute]
7672 ucamera = osfm_u .perspective_camera_from_brown (shot .camera )
7773 elif shot .camera .projection_type == "fisheye" :
78- # pyrefly: ignore [missing-attribute]
7974 ucamera = osfm_u .perspective_camera_from_fisheye (shot .camera )
8075 else :
8176 raise ValueError
8277 urec .add_camera (ucamera )
83- # pyrefly: ignore [missing-attribute]
8478 ushot = osfm_u .get_shot_with_different_camera (urec , shot , image_format )
8579 if tracks_manager :
86- # pyrefly: ignore [missing-attribute]
8780 osfm_u .add_subshot_tracks (tracks_manager , utracks_manager , shot , ushot )
8881 undistorted_shots .append (ushot )
8982
9083 image = data .load_image (shot .id , unchanged = True , anydepth = True )
9184 if image is not None :
9285 max_size = data .config ["undistorted_image_max_size" ]
93- # pyrefly: ignore [missing-attribute]
9486 undistorted = osfm_u .undistort_image (
9587 shot , undistorted_shots , image , cv2 .INTER_AREA , max_size
9688 )
@@ -130,7 +122,6 @@ def import_cameras_images(db, data):
130122 cameras = {}
131123 for row in cursor :
132124 camera_id , camera_model_id , width , height , prior_focal , params = row
133- # pyrefly: ignore [no-matching-overload]
134125 params = np .fromstring (params , dtype = np .double )
135126 cam = cam_from_colmap_params (
136127 camera_model_id , width , height , params , prior_focal
@@ -197,15 +188,13 @@ def import_features(db, data, image_map, camera_map):
197188 filename , camera_id = image_map [image_id ]
198189 cam = camera_map [camera_id ]
199190
200- # pyrefly: ignore [no-matching-overload]
201191 arr = np .fromstring (arr , dtype = np .float32 ).reshape ((n_rows , n_cols ))
202192
203193 rgb = data .load_image (filename ).astype (np .float32 )
204194 xc = np .clip (arr [:, 1 ].astype (int ), 0 , rgb .shape [0 ] - 1 )
205195 yc = np .clip (arr [:, 0 ].astype (int ), 0 , rgb .shape [1 ] - 1 )
206196 colors [image_id ] = rgb [xc , yc , :]
207197
208- # pyrefly: ignore [missing-attribute]
209198 arr [:, :2 ] = features .normalized_image_coordinates (
210199 arr [:, :2 ], cam .width , cam .height
211200 )
@@ -227,10 +216,8 @@ def import_features(db, data, image_map, camera_map):
227216 for row in cursor :
228217 image_id , n_rows , n_cols , arr = row
229218 filename , _ = image_map [image_id ]
230- # pyrefly: ignore [no-matching-overload]
231219 descriptors = np .fromstring (arr , dtype = np .uint8 ).reshape ((n_rows , n_cols ))
232220 kp = keypoints [image_id ]
233- # pyrefly: ignore [missing-attribute]
234221 features_data = features .FeaturesData (kp , descriptors , colors [image_id ], None )
235222 data .save_features (filename , features_data )
236223
@@ -249,7 +236,6 @@ def import_matches(db, data, image_map):
249236
250237 for row in cursor :
251238 pair_id = row [0 ]
252- # pyrefly: ignore [no-matching-overload]
253239 inlier_matches = np .fromstring (row [1 ], dtype = np .uint32 ).reshape (- 1 , 2 )
254240 image_id1 , image_id2 = pair_id_to_image_ids (pair_id )
255241 image_name1 = image_map [image_id1 ][0 ]
@@ -294,13 +280,10 @@ def cam_from_colmap_params(camera_model_id, width, height, params, prior_focal=1
294280 normalizer = max (width , height )
295281 focal = params [0 ] / normalizer if prior_focal else 0.85
296282 if projection_type == "perspective" :
297- # pyrefly: ignore [missing-attribute]
298283 cam = pygeometry .Camera .create_perspective (focal , params [3 ], params [4 ])
299284 elif projection_type == "pinhole" :
300- # pyrefly: ignore [missing-attribute]
301285 cam = pygeometry .Camera .create_perspective (focal , 0 , 0 )
302286 else : # projection_type == 'fisheye'
303- # pyrefly: ignore [missing-attribute]
304287 cam = pygeometry .Camera .create_fisheye (focal , params [3 ], 0 )
305288 cam .width = width
306289 cam .height = height
@@ -388,7 +371,6 @@ def import_images_reconstruction(path_images, keypoints, rec):
388371 Read images.bin, building shots and tracks graph
389372 """
390373 logger .info ("Importing images from {}" .format (path_images ))
391- # pyrefly: ignore [missing-attribute]
392374 tracks_manager = pymap .TracksManager ()
393375 image_ix_to_shot_id = {}
394376 with open (path_images , "rb" ) as f :
@@ -413,7 +395,6 @@ def import_images_reconstruction(path_images, keypoints, rec):
413395 q /= np .linalg .norm (q )
414396 t = np .array ([t0 , t1 , t2 ])
415397
416- # pyrefly: ignore [missing-attribute]
417398 pose = pygeometry .Pose (rotation = quaternion_to_angle_axis (q ), translation = t )
418399 shot = rec .create_shot (filename , str (camera_id ), pose )
419400 image_ix_to_shot_id [image_ix ] = shot .id
@@ -426,7 +407,6 @@ def import_images_reconstruction(path_images, keypoints, rec):
426407 if point3d_id != np .iinfo (np .uint64 ).max :
427408 kp = keypoints [image_id ][point2d_ix ]
428409 r , g , b = rec .points [str (point3d_id )].color
429- # pyrefly: ignore [missing-attribute]
430410 obs = pymap .Observation (
431411 x ,
432412 y ,
@@ -492,7 +472,6 @@ def project_pointcloud_save_depth(udata, urec, points, shot_id, max_sz):
492472
493473 points_2d = shot .project_many (points )
494474
495- # pyrefly: ignore [missing-attribute]
496475 pixel_coords = features .denormalized_image_coordinates (points_2d , w , h ).astype (int )
497476 # Filter out points that fall out of the image
498477 # <<< aren't we supposed to have points that are visible from this image only??!?!
@@ -570,7 +549,6 @@ def main():
570549 ):
571550 os .symlink (p_db .parent .parent / "config.yaml" , export_folder / "config.yaml" )
572551
573- # pyrefly: ignore [missing-attribute]
574552 data = dataset .DataSet (export_folder )
575553 db = sqlite3 .connect (p_db .as_posix ())
576554 camera_map , image_map = import_cameras_images (db , data )
@@ -588,7 +566,6 @@ def main():
588566 rec_points = p_db .parent / "points3D.bin"
589567 rec_images = p_db .parent / "images.bin"
590568 if rec_cameras .exists () and rec_images .exists () and rec_points .exists ():
591- # pyrefly: ignore [missing-attribute]
592569 reconstruction = types .Reconstruction ()
593570 import_cameras_reconstruction (rec_cameras , reconstruction )
594571 import_points_reconstruction (rec_points , reconstruction )
@@ -600,7 +577,6 @@ def main():
600577 data .save_tracks_manager (tracks_manager )
601578
602579 # Save undistorted reconstruction as well
603- # pyrefly: ignore [missing-attribute]
604580 udata = dataset .UndistortedDataSet (data , io_handler = data .io_handler )
605581 urec = compute_and_save_undistorted_reconstruction (
606582 reconstruction , tracks_manager , data , udata
@@ -612,7 +588,6 @@ def main():
612588 rec_cameras = p_db .parent / "dense/sparse/cameras.bin"
613589 rec_images = p_db .parent / "dense/sparse/images.bin"
614590 rec_points = p_db .parent / "points3D.bin"
615- # pyrefly: ignore [missing-attribute]
616591 reconstruction = types .Reconstruction ()
617592 import_cameras_reconstruction (rec_cameras , reconstruction )
618593 import_points_reconstruction (rec_points , reconstruction )
0 commit comments