Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualisation of pointcloud data #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ Preprocessed ShapeNetPart dataset (XYZ, normal and part labels) can be found <a
See `scannet/README` and `scannet/train.py` for details.

#### Visualization Tools
We have provided a handy point cloud visualization tool under `utils`. Run `sh compile_render_balls_so.sh` to compile it and then you can try the demo with `python show3d_balls.py` The original code is from <a href="http://github.com/fanhqme/PointSetGeneration">here</a>.
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 <a href="http://github.com/fanhqme/PointSetGeneration">here</a>.

#### Prepare Your Own Data
You can refer to <a href="https://github.com/charlesq34/3dmodel_feature/blob/master/io/write_hdf5.py">here</a> 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 <a href="https://www.tensorflow.org/programmers_guide/datasets">here</a>.
Expand Down
23 changes: 20 additions & 3 deletions utils/show3d_balls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'):
Expand Down Expand Up @@ -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)