1 """Unit tests for track generation using a Disjoint Set Forest data structure. 13 from gtsam
import IndexPair, Point2, SfmTrack2d
17 """Tests for DsfTrackGenerator.""" 20 """Ensures that DSF generates three tracks from measurements 21 in 3 images (H=200,W=400).""" 22 kps_i0 =
Keypoints(np.array([[10.0, 20], [30, 40]]))
23 kps_i1 =
Keypoints(np.array([[50.0, 60], [70, 80], [90, 100]]))
24 kps_i2 =
Keypoints(np.array([[110.0, 120], [130, 140]]))
27 keypoints_list.append(kps_i0)
28 keypoints_list.append(kps_i1)
29 keypoints_list.append(kps_i2)
34 matches_dict[
IndexPair(0, 1)] = np.array([[0, 0], [1, 1]])
35 matches_dict[
IndexPair(1, 2)] = np.array([[2, 0], [1, 1]])
42 assert len(tracks) == 3
46 assert track0.numberMeasurements() == 2
47 np.testing.assert_allclose(track0.measurements[0][1],
Point2(10, 20))
48 np.testing.assert_allclose(track0.measurements[1][1],
Point2(50, 60))
49 assert track0.measurements[0][0] == 0
50 assert track0.measurements[1][0] == 1
51 np.testing.assert_allclose(
52 track0.measurementMatrix(),
58 np.testing.assert_allclose(track0.indexVector(), [0, 1])
62 np.testing.assert_allclose(
63 track1.measurementMatrix(),
70 np.testing.assert_allclose(track1.indexVector(), [0, 1, 2])
74 np.testing.assert_allclose(
75 track2.measurementMatrix(),
81 np.testing.assert_allclose(track2.indexVector(), [1, 2])
85 """Tests for SfmTrack2d.""" 88 """Test construction of 2D SfM track.""" 90 measurements.append((0,
Point2(10, 20)))
93 assert track.numberMeasurements() == 1
96 if __name__ ==
"__main__":
def test_track_generation(self)
std::vector< SfmTrack2d > tracksFromPairwiseMatches(const MatchIndicesMap &matches, const KeypointsVector &keypoints, bool verbose)
Creates a list of tracks from 2d point correspondences.
Track containing 2D measurements associated with a single 3D point. Note: Equivalent to gtsam...
Small utility class for representing a wrappable pairs of ints.
def test_sfm_track_2d_constructor(self)
size_t len(handle h)
Get the length of a Python object.