def setUp(self): self.datadir = 'data/stillscans/' self.Pall, self.Q, self.guesspose, self.res = generate_tst_data_from_file(self.datadir + 'empty-map.txt', self.datadir + '1271124950-scan.txt', self.datadir + '1271124950-pose.txt') # override guess pose to make it harder for the algorithms self.guesspose = np.array([-2, 42, 80, 0.2, 0.1, 2.58]) # sampling self.P = util.volumetricsample(self.Pall, self.res) # shuffles P as well # setup the mrol for the alignment self.mapmrol = mrol.MROL(self.res, levels=5) self.mapmrol.addpoints(self.Q) # setup the occupiedlist for the segmentation mv = occupiedlist.pointstovoxels(self.Q, self.res) self.mapvoxels = {} occupiedlist.increment(self.mapvoxels, mv) # setup a dilated occupiedlist for segmentation self.dilated = {} mv = occupiedlist.dilate(self.mapmrol.getvoxels().keys()) occupiedlist.increment(self.dilated, mv) # setup a mapset for fast alignment self.mapset = set(occupiedlist.hashrows(self.mapvoxels.keys())) # Ground truths and tolerances self.lin_tol = 1e-1 self.ang_tol = np.deg2rad(2.0) self.truepose = np.array([-1.8572, 41.7913, 79.3341, np.deg2rad(12.4607), np.deg2rad(4.3733), np.deg2rad(147.2011)]) # Overlap: 6094, Pose (m, degrees): -1.8572 41.7913 79.3341 12.4607 4.3733 147.2011 self.truePoints = poseutil.transformPoints(self.Pall, poseutil.mat(self.truepose)) # list the aligners to be tested self.aligners = [ self.align_mrol_optimize_00001, self.align_mrol_optimize_11111, ] # list the segmenters to be tested self.segmenters = [ self.segment_ovl, self.segment_ovl_dilated ]
def testdilate(self): X = ((0,0,0), (100,100,100)) dilated = occupiedlist.dilate(X) expected = set([(0, 1, 1), (99, 100, 99), (100, 100, 99), (100, 100, 101), (100, 100, 100), (1, 0, 0), (-1, -1, -1), (-1, 1, -1), (101, 100, 99), (99, 101, 101), (101, 101, 100), (99, 101, 100), (100, 101, 99), (101, 99, 101), (101, 99, 99), (100, 101, 100), (0, -1, -1), (0, 0, -1), (-1, 0, 1), (100, 101, 101), (0, -1, 1), (-1, 0, 0), (101, 100, 100), (1, -1, 1), (99, 99, 99), (100, 99, 100), (1, -1, -1), (101, 100, 101), (101, 99, 100), (-1, 0, -1), (0, 0, 1), (99, 99, 101), (99, 100, 100), (0, 0, 0), (101, 101, 99), (0, -1, 0), (99, 100, 101), (1, 1, 1), (1, 0, 1), (-1, 1, 0), (1, 1, 0), (-1, 1, 1), (-1, -1, 1), (100, 99, 101), (1, 0, -1), (1, -1, 0), (-1, -1, 0), (99, 101, 99), (100, 99, 99), (1, 1, -1), (0, 1, 0), (101, 101, 101), (0, 1, -1), (99, 99, 100)]) self.assertEquals(54, len(expected.intersection(dilated)))