(args, id, cam_info, resolution_scale)
| 17 | WARNED = False |
| 18 | |
| 19 | def loadCam(args, id, cam_info, resolution_scale): |
| 20 | orig_w, orig_h = cam_info.image.size |
| 21 | |
| 22 | if args.resolution in [1, 2, 4, 8]: |
| 23 | resolution = round(orig_w/(resolution_scale * args.resolution)), round(orig_h/(resolution_scale * args.resolution)) |
| 24 | else: # should be a type that converts to float |
| 25 | if args.resolution == -1: |
| 26 | if orig_w > 1600: |
| 27 | global WARNED |
| 28 | if not WARNED: |
| 29 | print("[ INFO ] Encountered quite large input images (>1.6K pixels width), rescaling to 1.6K.\n " |
| 30 | "If this is not desired, please explicitly specify '--resolution/-r' as 1") |
| 31 | WARNED = True |
| 32 | global_down = orig_w / 1600 |
| 33 | else: |
| 34 | global_down = 1 |
| 35 | else: |
| 36 | global_down = orig_w / args.resolution |
| 37 | |
| 38 | scale = float(global_down) * float(resolution_scale) |
| 39 | resolution = (int(orig_w / scale), int(orig_h / scale)) |
| 40 | |
| 41 | resized_image_rgb = PILtoTorch(cam_info.image, resolution) |
| 42 | |
| 43 | gt_image = resized_image_rgb[:3, ...] |
| 44 | loaded_mask = None |
| 45 | |
| 46 | if resized_image_rgb.shape[1] == 4: |
| 47 | loaded_mask = resized_image_rgb[3:4, ...] |
| 48 | |
| 49 | return Camera(colmap_id=cam_info.uid, R=cam_info.R, T=cam_info.T, |
| 50 | FoVx=cam_info.FovX, FoVy=cam_info.FovY, |
| 51 | image=gt_image, gt_alpha_mask=loaded_mask, |
| 52 | image_name=cam_info.image_name, uid=id, |
| 53 | K=cam_info.K, use_K=cam_info.use_K, |
| 54 | data_device=args.data_device) |
| 55 | |
| 56 | def cameraList_from_camInfos(cam_infos, resolution_scale, args): |
| 57 | camera_list = [] |
no test coverage detected