diff --git a/README.md b/README.md index 04a1528c..47bc07b1 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,12 @@ Preprocessed ShapeNetPart dataset (XYZ, normal and part labels) can be found here. +We have provided a handy point cloud visualization tool under `utils`. Run `sh compile_render_balls_so.sh` to compile it +Then you can try the demo with +```bash +python show3d_balls.py path_to_pointcloud.txt +``` +The original code is from here. #### Prepare Your Own Data You can refer to here on how to prepare your own HDF5 files for either classification or segmentation. Or you can refer to `modelnet_dataset.py` on how to read raw data files and prepare mini-batches from them. A more advanced way is to use TensorFlow's dataset APIs, for which you can find more documentations here. diff --git a/utils/show3d_balls.py b/utils/show3d_balls.py index 8122bb17..5f16f938 100644 --- a/utils/show3d_balls.py +++ b/utils/show3d_balls.py @@ -4,6 +4,8 @@ import cv2 import sys import os +from pprint import pprint + BASE_DIR = os.path.dirname(os.path.abspath(__file__)) showsz=800 mousex,mousey=0.5,0.5 @@ -103,9 +105,9 @@ def render(): changed=False cv2.imshow('show3d',show) if waittime==0: - cmd=cv2.waitKey(10)%256 + cmd=cv2.waitKey(10) % 256 else: - cmd=cv2.waitKey(waittime)%256 + cmd=cv2.waitKey(waittime) % 256 if cmd==ord('q'): break elif cmd==ord('Q'): @@ -157,5 +159,20 @@ def render(): return cmd if __name__=='__main__': np.random.seed(100) - showpoints(np.random.randn(2500,3)) + if len(sys.argv) < 2: + exit('Enter pointcloud path') + path = sys.argv[1] + + point_set = np.loadtxt(path ,delimiter=',').astype(np.float32) + random_idx = np.random.randint(point_set.shape[0], size=1024) + print(point_set.shape) + point_set = point_set[0:1024,0:3] + + #point_set = point_set[random_idx,0:3] + #pprint(point_set) + #pprint(np.random.randn(2500,3)) + + #showpoints(np.random.randn(2500,3)) + showpoints(point_set) +