@@ -16,7 +16,7 @@ def write_ply_pcl(out_path, xyz, color=[128,128,128], color_array=None):
16
16
f .write ('property uchar blue\n ' )
17
17
f .write ('end_header\n ' )
18
18
19
- for row in xrange (xyz .shape [0 ]):
19
+ for row in range (xyz .shape [0 ]):
20
20
xyz_row = xyz [row ]
21
21
if color_array is not None :
22
22
c = color_array [row ]
@@ -27,7 +27,10 @@ def write_ply_pcl(out_path, xyz, color=[128,128,128], color_array=None):
27
27
28
28
29
29
def write_ply_boxes (out_path , bxs , binary = False ):
30
- f = open (out_path , 'wb' )
30
+ if binary :
31
+ f = open (out_path , 'wb' )
32
+ else :
33
+ f = open (out_path , 'w' )
31
34
f .write ("ply\n " );
32
35
if binary :
33
36
f .write ("format binary_little_endian 1.0\n " )
@@ -118,9 +121,9 @@ def write_ply_boxes(out_path, bxs, binary=False):
118
121
def write_ply_voxels (out_path , grid , color = [128 ,128 ,128 ], color_fcn = None , explode = 1 , binary = False ):
119
122
bxs = []
120
123
width = 1
121
- for d in xrange (grid .shape [0 ]):
122
- for h in xrange (grid .shape [1 ]):
123
- for w in xrange (grid .shape [2 ]):
124
+ for d in range (grid .shape [0 ]):
125
+ for h in range (grid .shape [1 ]):
126
+ for w in range (grid .shape [2 ]):
124
127
if grid [d ,h ,w ] == 0 :
125
128
continue
126
129
x = w * explode
0 commit comments