Beispiel #1
0
def test_depth_to_point_cloud(depth_frame, expected):
    height, width = depth_frame.shape
    camera_setup = CameraSetup('test_setup',
                               'test_type',
                               width,
                               height,
                               Transform(location=Location(0, 0, 0),
                                         rotation=Rotation(0, 0, 0)),
                               fov=90)
    depth_frame = DepthFrame(depth_frame, camera_setup)
    # Resulting unreal coordinates.
    point_cloud = depth_frame.as_point_cloud()
    for i in range(width * height):
        assert np.isclose(point_cloud[i].x, expected[i].x), 'Returned x '
        'value is not the same as expected'
        assert np.isclose(point_cloud[i].y, expected[i].y), 'Returned y '
        'value is not the same as expected'
        assert np.isclose(point_cloud[i].z, expected[i].z), 'Returned z '
        'value is not the same as expected'
Beispiel #2
0
def test_depth_to_point_cloud(depth_frame, expected):
    height, width = depth_frame.shape
    camera_setup = CameraSetup('test_setup',
                               'sensor.camera.depth',
                               width,
                               height,
                               Transform(location=Location(0, 0, 0),
                                         rotation=Rotation(0, 0, 0)),
                               fov=90)
    depth_frame = DepthFrame(depth_frame, camera_setup)
    # Resulting unreal coordinates.
    point_cloud = depth_frame.as_point_cloud()
    for i in range(width * height):
        assert np.isclose(point_cloud[i][0], expected[i][0]), \
            'Returned x value is not the same as expected'
        assert np.isclose(point_cloud[i][1], expected[i][1]), \
            'Returned y value is not the same as expected'
        assert np.isclose(point_cloud[i][2], expected[i][2]), \
            'Returned z value is not the same as expected'