Load cached scene data. Returns: Tuple of (trajectory_dict, point_clouds_list, is_aligned)
(self)
| 151 | return False |
| 152 | |
| 153 | def load(self) -> tuple[Dict[str, np.ndarray], List[Dict[str, np.ndarray]], bool]: |
| 154 | """Load cached scene data. |
| 155 | |
| 156 | Returns: |
| 157 | Tuple of (trajectory_dict, point_clouds_list, is_aligned) |
| 158 | """ |
| 159 | try: |
| 160 | data = np.load(self.cache_file, allow_pickle=True) |
| 161 | |
| 162 | # Load trajectory |
| 163 | traj_dict = {} |
| 164 | num_frames = int(data.get('num_frames', 0)) |
| 165 | for i in range(num_frames): |
| 166 | if f'c2w_{i}' in data: |
| 167 | c2w = data[f'c2w_{i}'] |
| 168 | traj_dict[i] = c2w |
| 169 | |
| 170 | # Load point clouds |
| 171 | point_clouds = [] |
| 172 | for i in range(num_frames): |
| 173 | pcd_dict = {} |
| 174 | if f'xyz_{i}' in data: |
| 175 | pcd_dict['xyz'] = data[f'xyz_{i}'] |
| 176 | if f'rgb_{i}' in data: |
| 177 | pcd_dict['rgb'] = data[f'rgb_{i}'] |
| 178 | point_clouds.append(pcd_dict) |
| 179 | |
| 180 | # Load alignment status |
| 181 | with open(self.params_file, 'r') as f: |
| 182 | params = json.load(f) |
| 183 | is_aligned = params.get('is_aligned', False) |
| 184 | |
| 185 | logger.info(f"Loaded {len(traj_dict)} poses and {len(point_clouds)} point clouds from cache (aligned={is_aligned})") |
| 186 | return traj_dict, point_clouds, is_aligned |
| 187 | except Exception as e: |
| 188 | logger.error(f"Failed to load cache: {e}") |
| 189 | return {}, [], False |
| 190 | |
| 191 | def save( |
| 192 | self, |
no outgoing calls
no test coverage detected