Polylines are useful for tasks such as lane and horizon marking.

Import

Python SDK

Line is a type of ObjectAnnotation

Definition

Line(points=list(Points(x,y))

Parameter

Value

points

List of Points

Supported data types

Data type

Supported

Image

Yes

Tiled imagery

Yes

ObjectAnnotation(
  name = "polyline",
  value = Line(points=[Point(x=10, y=10), Point(x=0, y=10), Point(x=10, y=10)]),
)
## Coordinates in the desired EPSG coordinate system
line_points = list([Point(x=-99.21052827588443, y=19.405662413477728), Point(x=-99.20534818927473, y=19.400498983095076), Point(x=-100.505348189274754, y=29.400498983095045)])

ObjectAnnotation(
  name = "polygon_geospatial",
  value = Line(points=line_points),
)

Format convertors

Method

Usage

Comments

from_shapely()

Line.from_shapely(shapely_object)

Transforms a shapely object. Learn more about shapely

NDJSON

NDJSON format is recommended if an annotation type is not yet supported in Python SDK or if you are unable to use the Python environment.

Definition

Parameter

Asset type

Required

Description

uuid

Image
Tiled imagery

Yes

A user-generated UUID for each annotation. If you import an annotation to a Data Row and there is already an imported annotation with the same uuid on that Data Row, the latest import will override the previous one. The uuid must be 128 bits (32 characters). The following formats are supported:

  • A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11

  • {a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11}

  • a0eebc999c0b4ef8bb6d6bb9bd380a11

  • a0ee-bc99-9c0b-4ef8-bb6d-6bb9-bd38-0a11

  • {a0eebc99-9c0b4ef8-bb6d6bb9-bd380a11}

schemaId

Image
Tiled imagery

Yes

The ID of the schema that contains all of the information needed for rendering your annotation.

dataRow.id

Image
Tiled imagery

Yes

The ID of the Data Row where you want to attach the imported annotations.

line.x

Image
Tiled imagery

Yes

x-coordinate for a single point on the Polyline annotation.

line.y

Image
Tiled imagery

Yes

y-coordinate for a single point on the Polyline annotation.

Supported data types

Data type

Supported

Image

Yes

Tiled imagery

Yes

Format

{
    "uuid": "62e1d949-1c75-47f6-9ea2-e938da17d37c",
    "schemaId": "ck68grts29n7z08903nvgaim5",
    "dataRow": { 
        "id": "cjxav5aa07r1g0dsq70t9eveg" 
    }, 
    "line": [ 
        { 
            "x": 58, 
            "y": 148 
        }, 
        { 
            "x": 135, 
            "y": 79 
        }, 
        { 
            "x": 53, 
            "y": 191 
        } 
    ]
}
{
    "uuid": "1b5762e9-416c-44cf-9a5f-07effb51f863",
    "schemaId": "ck67grts29n7y0890q89jdcyp",
    "dataRow": {
        "id": "cjxav4aa07r1g0dsq70t9eveg"
    },
    "line": [
        {
            "x": -99.21052827588443,
            "y": 19.405662413477728
        },
        {
            "x": -99.20534818927473,
            "y": 19.400498983095076
        },
        {
            "x": -100.505348189274754,
            "y": 29.400498983095045
        }
    ]
}

Export

When you export your Polyline annotations from Labelbox, the export file will contain the following information for each Polyline.

Python SDK

The export format of the polygon is similar to the import format.

Learn more about exporting annotations using the SDK here

JSON

You will receive a JSON file when you generate an export from the app.

Parameter

Asset type

Description

schemaId

Image
Video
Tiled imagery

The ID of the schema containing all of the information needed for rendering your annotation.

featureId

Image
Video
Tiled imagery

ID of the annotation.

title

Image
Video
Tiled imagery

Name of the annotation in the ontology.

color

Image
Video
Tiled imagery

Color of the annotation in the ontology.

line.x

Image
Video

x coordinate for a single point on the Polyline annotation.

line.y

Image
Video

y coordinate for a single point on the Polyline annotation.

instanceURI

Image

Annotation information hosted on Labelbox servers.

type

Tiled imagery

Annotation type. Value should be polyline.

geometry.coordinates

Tiled imagery

Longitude and latitude, in that order.

Format

{
    "featureId": "ckmuuwb1p00073g68vg3t615r",
    "schemaId": "ckmuuvs5r5njc0y623c4s1dob",
    "title": "Tree branch",
    "value": "tree_branch",
    "color": "#008941",
    "line": [
        {
            "x": 198.027,
            "y": 1979.196
        },
        {
            "x": 321.472,
            "y": 1801.743
        },
        {
            "x": 465.491,
            "y": 1655.152
        }
    ],
}
{
    "featureId": "ckt37btlp00063h6b8srqrsr8",
    "schemaId": "ckt09rb8q7zsu0yc24y3w85m5",
    "title": "Center lane",
    "value": "center_lane",
    "color": "#2f05f1",
    "keyframe": true,
    "line": [{
            "x": 661.215,
            "y": 2146.298
        },
        {
            "x": 961.767,
            "y": 1907.624
        },
        {
            "x": 1262.32,
            "y": 1668.95
        }
    ],
    "classifications": []
}
{
    "featureId": "ckossvrll00033h68tczgb8p9",
    "schemaId": "ckosstz24fhci0yag63j377hz",
    "title": "line",
    "value": "line",
    "color": "#FF34FF",
    "type": "polyline",
    "geometry": {
        "coordinates": [
            [
                151.20330452874953,
                -33.866105019363175
            ],
            [
                151.20364785147953,
                -33.866737933344254
            ]
        ]
    }
}
{ // This is from the frame data of the DICOM file for one of the axes
    "frameNumber": 185,
    "classifications": [],
    "objects": [
        {
            "featureId": "cl2y5hjr200073g6cidkf0pqj",
            "schemaId": "ckzohkul206420z974x2q4a9h",
            "title": "Tool 2",
            "value": "tool_2",
            "color": "#FF34FF",
            "keyframe": true,
            "line": [
                {
                    "x": 95.237,
                    "y": 117.232
                },
                {
                    "x": 223.735,
                    "y": 196
                },
                {
                    "x": 262.608,
                    "y": 124.785
                }
            ],
            "classifications": []
        }
    ],
    "relationships": []
}