Gets Frame Data Arguments: idx {int} -- Index of frame color_files {list} -- list of color images depth_files {list} -- list of depth images traj {list} -- list of extrinsic matrices corresponding to frames intrinsic {Open3D intrisics} -- Open3D intrinsic
(idx, color_files, depth_files, traj, intrinsic, depth_trunc=3.0, stride=2)
| 163 | |
| 164 | |
| 165 | def get_frame_data(idx, color_files, depth_files, traj, intrinsic, depth_trunc=3.0, stride=2): |
| 166 | """Gets Frame Data |
| 167 | |
| 168 | Arguments: |
| 169 | idx {int} -- Index of frame |
| 170 | color_files {list} -- list of color images |
| 171 | depth_files {list} -- list of depth images |
| 172 | traj {list} -- list of extrinsic matrices corresponding to frames |
| 173 | intrinsic {Open3D intrisics} -- Open3D intrinsics array |
| 174 | |
| 175 | Keyword Arguments: |
| 176 | depth_trunc {float} -- How much to truncate depth image in meters (default: {3.0}) |
| 177 | stride {int} -- stride for downsampling pont cloud (default: {2}) |
| 178 | |
| 179 | Returns: |
| 180 | tuple -- PointCloud, RGBD Image, extrinsics (D4XX Frame -> Global Standard Frame) |
| 181 | """ |
| 182 | depth_1 = o3d.io.read_image(depth_files[idx]) |
| 183 | color_1 = o3d.io.read_image(color_files[idx]) |
| 184 | |
| 185 | extrinsic = traj[idx] |
| 186 | rgbd_image_1 = o3d.geometry.RGBDImage.create_from_color_and_depth( |
| 187 | color_1, depth_1, convert_rgb_to_intensity=False, depth_trunc=depth_trunc) |
| 188 | |
| 189 | pcd_1 = o3d.geometry.PointCloud.create_from_depth_image( |
| 190 | depth_1, intrinsic, extrinsic, stride=stride, depth_trunc=depth_trunc) |
| 191 | return pcd_1, rgbd_image_1, R_Standard_d400 @ np.linalg.inv(extrinsic) |
| 192 | |
| 193 | |
| 194 | def prep_mesh(mesh): |