def test_actual_data_confidence(name, filename, expected_meter, expect_confident): pc = load('tests/testdata/' + filename) meter, confidence = get_stick_scale(pc) if expect_confident: assert_greater(confidence, .5, "confidence too low") else: assert_less(confidence, .5, "confidence too high")
def test_stickscale(noise): s1 = make_red_stick([0, 0, 0], [0, 1, 0]) s2 = make_red_stick([1, 2, 0], [1, 1, 0]) s3 = make_red_stick([3, 3, 0], [3, 4, 0]) pc = make_pointcloud((s1, s2, s3), noise) meter, confidence = get_stick_scale(pc) red_part_length = 0.25 + noise assert_with_error(meter, 4 * red_part_length / 0.8) assert_with_error(confidence, 1.0)
def test_stickscale_nocluster(noise): '''Cloud without clusters should return zero confidence.''' pc = pcl.PointCloudXYZRGB([[0, 0, 0], [10000, 10000, 10000]]) meter, confidence = get_stick_scale(pc) np.testing.assert_almost_equal(confidence, 0.0)
def test_stickscale_emptycloud(noise): '''Cloud with zero point should return zero confidence.''' pc = pcl.PointCloudXYZRGB() meter, confidence = get_stick_scale(pc) np.testing.assert_almost_equal(confidence, 0.0)