Skip to content

How to Generate .vg and .cc Files Processed in the Same Way as the Munich Database #27 #28

@stepwhal

Description

@stepwhal

Thank you for your excellent work! I am currently trying to convert a point cloud file into the .cc format required by the algorithm. I used part of the point cloud from the mini dataset you provided and attempted to perform the format conversion with the following code. However, I found it difficult to make the generated .cc file consistent with the sample you provided.

Specifically, I first used the .VG format conversion script provided by Easy3D, and then applied your .cc format conversion script. Still, I was unable to generate a .cc file similar in format to the one you provided. I suspect there might be an issue with the generation process of the .vg format. Would it be possible for you to provide the conversion script for generating the .vg format?

Here are the scripts I use to convert files to .vg and .cc formats.
Script 1: .VG Format Conversion Script:
import sys
sys.path.append("../../cmake-build-release/lib/python")

import easy3d

easy3d.initialize(True)

pointcloud_file = r"D:\toolsv2\polygnn\data7\DEBY_LOD2_4867013.xyz"
point_cloud = easy3d.PointCloudIO.load(pointcloud_file)
print(f"Loaded point cloud with {point_cloud.n_vertices()} points.")

easy3d.PointCloudNormals.estimate(point_cloud, 200)
easy3d.PointCloudNormals.reorient(point_cloud, 200)

ransac = easy3d.PrimitivesRansac()

ransac.add_primitive_type(easy3d.PrimitivesRansac.PLANE)

ransac.detect(point_cloud,
min_support=100,
dist_threshold=0.001,
bitmap_resolution=0.005,
normal_threshold=0.95,
overlook_probability=0.01,
)

planes = ransac.get_planes()
print(f"Number of planes extracted: {len(planes)}")

for i, plane in enumerate(planes):
print(f"Plane {i}:")
print(f" Index: {plane.primitive_index}")
print(f" Position: {plane.position}")
print(f" Normal: {plane.normal}")
vertex_count = len(plane.vertices)

result_file_name = r"D:\toolsv2\polygnn\data7\DEBY_LOD2_4867013.vg"
if easy3d.PointCloudIO.save(result_file_name, point_cloud):
print(f'Plane extraction result saved to file {result_file_name}')
else:
print(f'Failed to save plane extraction result to file {result_file_name}')

viewer = easy3d.Viewer("Easy3D Viewer - Plane extraction")
viewer.set_usage("")
viewer.add_model(point_cloud)

point_cloud.renderer().color_by_segmentation("v:primitive_index")

viewer.run()

Script 2: .CC Format Conversion Script:
from abspy import VertexGroup, CellComplex

vertex_group = VertexGroup("/data/wh/polygnn/polygnn/data/mini/raw/DEBY_LOD2_4867013.vg", quiet=True)
cell_complex = CellComplex(vertex_group.planes, vertex_group.aabbs,
vertex_group.points_grouped, build_graph=True, quiet=True)
cell_complex.prioritise_planes(prioritise_verticals=True)
cell_complex.construct()
cell_complex.save("/data/wh/polygnn/polygnn/data/mini/raw/05_complexes/DEBY_LOD2_4867013.cc")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions