@@ -119,8 +119,7 @@ def testSegmentPlaneObject(self):
119
119
120
120
121
121
def test_pcd_read ():
122
- TMPL = """
123
- # .PCD v.7 - Point Cloud Data file format
122
+ TMPL = """# .PCD v.7 - Point Cloud Data file format
124
123
VERSION .7
125
124
FIELDS x y z
126
125
SIZE 4 4 4
@@ -135,10 +134,11 @@ def test_pcd_read():
135
134
136
135
a = np .array (np .mat (SEGDATA , dtype = np .float32 ))
137
136
npts = a .shape [0 ]
138
- with open ("/tmp/test.pcd" , "w" ) as f :
137
+ tmp_file = tempfile .mkstemp (suffix = '.pcd' )[1 ]
138
+ with open (tmp_file , "w" ) as f :
139
139
f .write (TMPL % {"npts" : npts , "data" : SEGDATA .replace (";" , "" )})
140
140
141
- p = pcl .load ("/tmp/test.pcd" )
141
+ p = pcl .load (tmp_file )
142
142
143
143
assert p .width == npts
144
144
assert p .height == 1
@@ -169,7 +169,7 @@ def test_copy():
169
169
class TestSegmentCylinder (unittest .TestCase ):
170
170
171
171
def setUp (self ):
172
- self .p = pcl .load ("tests/ table_scene_mug_stereo_textured_noplane.pcd" )
172
+ self .p = pcl .load ("tests" + os . path . sep + " table_scene_mug_stereo_textured_noplane.pcd" )
173
173
174
174
def testSegment (self ):
175
175
seg = self .p .make_segmenter_normals (50 )
@@ -194,7 +194,7 @@ def testSegment(self):
194
194
class TestSave (unittest .TestCase ):
195
195
196
196
def setUp (self ):
197
- self .p = pcl .load ("tests/ table_scene_mug_stereo_textured_noplane.pcd" )
197
+ self .p = pcl .load ("tests" + os . path . sep + " table_scene_mug_stereo_textured_noplane.pcd" )
198
198
self .tmpdir = tempfile .mkdtemp (suffix = 'pcl-test' )
199
199
200
200
def tearDown (self ):
@@ -211,7 +211,7 @@ def testSave(self):
211
211
class TestFilter (unittest .TestCase ):
212
212
213
213
def setUp (self ):
214
- self .p = pcl .load ("tests/ flydracyl.pcd" )
214
+ self .p = pcl .load ("tests" + os . path . sep + " flydracyl.pcd" )
215
215
216
216
def testFilter (self ):
217
217
mls = self .p .make_moving_least_squares ()
@@ -228,7 +228,7 @@ def testFilter(self):
228
228
class TestExtract (unittest .TestCase ):
229
229
230
230
def setUp (self ):
231
- self .p = pcl .load ("tests/ flydracyl.pcd" )
231
+ self .p = pcl .load ("tests" + os . path . sep + " flydracyl.pcd" )
232
232
233
233
def testExtractPos (self ):
234
234
p2 = self .p .extract ([1 , 2 , 3 ], False )
@@ -261,7 +261,7 @@ def testResize(self):
261
261
class TestSegmenterNormal (unittest .TestCase ):
262
262
263
263
def setUp (self ):
264
- self .p = pcl .load ("tests/ table_scene_mug_stereo_textured_noplane.pcd" )
264
+ self .p = pcl .load ("tests" + os . path . sep + " table_scene_mug_stereo_textured_noplane.pcd" )
265
265
266
266
def _tpos (self , c ):
267
267
self .assertEqual (c .size , 22745 )
@@ -308,7 +308,7 @@ def testFilterPosNeg(self):
308
308
class TestVoxelGridFilter (unittest .TestCase ):
309
309
310
310
def setUp (self ):
311
- self .p = pcl .load ("tests/ table_scene_mug_stereo_textured_noplane.pcd" )
311
+ self .p = pcl .load ("tests" + os . path . sep + " table_scene_mug_stereo_textured_noplane.pcd" )
312
312
313
313
def testFilter (self ):
314
314
fil = self .p .make_voxel_grid_filter ()
@@ -381,7 +381,7 @@ def setUp(self):
381
381
self .t = pcl .OctreePointCloud (0.1 )
382
382
383
383
def testLoad (self ):
384
- pc = pcl .load ("tests/ table_scene_mug_stereo_textured_noplane.pcd" )
384
+ pc = pcl .load ("tests" + os . path . sep + " table_scene_mug_stereo_textured_noplane.pcd" )
385
385
self .t .set_input_cloud (pc )
386
386
self .t .define_bounding_box ()
387
387
self .t .add_points_from_input_cloud ()
@@ -402,7 +402,7 @@ class TestOctreePointCloudSearch(unittest.TestCase):
402
402
403
403
def setUp (self ):
404
404
self .t = pcl .OctreePointCloudSearch (0.1 )
405
- pc = pcl .load ("tests/ table_scene_mug_stereo_textured_noplane.pcd" )
405
+ pc = pcl .load ("tests" + os . path . sep + " table_scene_mug_stereo_textured_noplane.pcd" )
406
406
self .t .set_input_cloud (pc )
407
407
self .t .define_bounding_box ()
408
408
self .t .add_points_from_input_cloud ()
0 commit comments