| | |
| | | semantic_colors = np.asarray([np.asarray(SEMANTIC_CLASSES[int(code)]["color"], dtype=float) / 255.0 for code in semantic_classes]) |
| | | downsampled.colors = o3d.utility.Vector3dVector(semantic_colors) |
| | | o3d.io.write_point_cloud(str(classified), downsampled, write_ascii=False) |
| | | # Retain sparse candidate classes in the browser preview. Uniform sampling |
| | | # made thin conductors disappear even when they were correctly labelled. |
| | | candidate_indices = np.flatnonzero(np.isin(semantic_classes, [15, 16])) |
| | | remaining = max(0, min(len(values), 400_000) - len(candidate_indices)) |
| | | other_indices = np.flatnonzero(~np.isin(semantic_classes, [15, 16])) |
| | | sampled_other = other_indices[np.linspace(0, len(other_indices) - 1, min(remaining, len(other_indices)), dtype=int)] if len(other_indices) and remaining else np.array([], dtype=int) |
| | | preview_indices = np.sort(np.concatenate((candidate_indices, sampled_other))) |
| | | # The console now renders the entire processed point set, so sparse |
| | | # conductors and all other classes are retained without preview sampling. |
| | | preview_indices = np.arange(len(values), dtype=np.int64) |
| | | preview_cloud = downsampled.select_by_index(preview_indices.tolist()) |
| | | o3d.io.write_point_cloud(str(semantic_preview_cloud), preview_cloud, write_ascii=False) |
| | | # Annotation must retain observed RGB. The semantic preview uses rule |
| | |
| | | "classified_point_cloud": classified.name, |
| | | "semantic_preview_point_cloud": semantic_preview_cloud.name, |
| | | "semantic_annotation_source_point_cloud": annotation_source_cloud.name, |
| | | "semantic_annotation_source_kind": "deterministic 400000-point RGB/XYZ subset from original input after voxel sampling; no semantic display colours", |
| | | "semantic_annotation_source_kind": "complete processed RGB/XYZ point set after voxel sampling; no semantic display colours", |
| | | "semantic_preview_points": int(len(preview_indices)), |
| | | "semantic_classified_las": semantic_las.name, |
| | | "semantic_raster_file": semantic_raster_path.name, |