In [1]:
import numpy as np
import k3d
plot = k3d.plot(camera_auto_fit=False)
plot.display()
In [2]:
from k3d.helpers import download
from pyunpack import Archive
filename = download('http://www.semantic3d.net/data/point-clouds/testing1/' +
'stgallencathedral_station1_intensity_rgb.7z')
Archive(filename).extractall('./')
In [3]:
import csv
data = None
with open(filename.replace('.7z', '.txt'), mode='r') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=' ')
data = np.array(list(csv_reader), dtype=np.float32)
# compute color in hex format
data[:, 4] = np.sum(data[:, 4:7].astype(np.uint32) * np.array([1, 256, 256 ** 2]), axis=1)
data = data[:, 0:5]
data = data[::10] # every 10th points
In [4]:
data.shape, data.shape[0] / 1e6
Out[4]:
In [5]:
plot += k3d.points(data[:, 0:3],
data[:, 4].astype(np.uint32), point_size=0.15, shader="flat",
compression_level=9)
In [ ]: