-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unexcellent
committed
Nov 4, 2024
1 parent
ee79bca
commit 6b1161e
Showing
6 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
from .attributes import JSONAttributes | ||
|
||
|
||
class JSONBbox(BaseModel): | ||
"""A 2D bounding box is defined as a 4-dimensional vector [x, y, w, h]. | ||
[x, y] is the center of the bounding box and [w, h] represent the width (horizontal, | ||
x-coordinate dimension) and height (vertical, y-coordinate dimension), respectively. | ||
""" | ||
|
||
name: str | ||
"""This is a string encoding the name of this object data. It is used as index inside the | ||
corresponding object data pointers.""" | ||
|
||
val: tuple[float, float, float, float] | ||
"The array of 4 values that define the [x, y, w, h] values of the bbox." | ||
|
||
coordinate_system: str | None | ||
"Name of the coordinate system in respect of which this object data is expressed." | ||
|
||
uid: UUID | None | ||
"This is a string encoding the Universal Unique identifyer of the annotation." | ||
|
||
attributes: JSONAttributes | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
from .attributes import JSONAttributes | ||
|
||
|
||
class JSONCuboid(BaseModel): | ||
"""A cuboid or 3D bounding box. | ||
It is defined by the position of its center, the rotation in 3D, and its dimensions. | ||
""" | ||
|
||
name: str | ||
"""This is a string encoding the name of this object data. It is used as index inside the | ||
corresponding object data pointers.""" | ||
|
||
val: tuple[float, float, float, float, float, float, float, float, float, float] | ||
"""List of values encoding the position, rotation and dimensions. It is | ||
(x, y, z, qx, qy, qz, qw, sx, sy, sz) where (x, y, z) encodes the position, (qx, qy, qz, qw) | ||
encodes the quaternion that encode the rotation, and (sx, sy, sz) are the dimensions of the | ||
cuboid in its object coordinate system""" | ||
|
||
coordinate_system: str | None | ||
"Name of the coordinate system in respect of which this object data is expressed." | ||
|
||
uid: UUID | None | ||
"This is a string encoding the Universal Unique identifyer of the annotation." | ||
|
||
attributes: JSONAttributes | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
from .attributes import JSONAttributes | ||
|
||
|
||
class JSONNum(BaseModel): | ||
"""A number.""" | ||
|
||
name: str | ||
"""This is a string encoding the name of this object data. It is used as index inside the | ||
corresponding object data pointers.""" | ||
|
||
val: list[int] | ||
"The numerical value of the number." | ||
|
||
coordinate_system: str | None | ||
"Name of the coordinate system in respect of which this object data is expressed." | ||
|
||
uid: UUID | None | ||
"This is a string encoding the Universal Unique identifyer of the annotation." | ||
|
||
attributes: JSONAttributes | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Literal | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
from .attributes import JSONAttributes | ||
|
||
|
||
class JSONPoly2d(BaseModel): | ||
"""A 2D polyline defined as a sequence of 2D points.""" | ||
|
||
name: str | ||
"""This is a string encoding the name of this object data. It is used as index inside the | ||
corresponding object data pointers.""" | ||
|
||
val: list[float | str] | ||
"List of numerical values of the polyline, according to its mode." | ||
|
||
closed: bool | ||
"""A boolean that defines whether the polyline is closed or not. In case it is closed, it is | ||
assumed that the last point of the sequence is connected with the first one.""" | ||
|
||
mode: Literal["MODE_POLY2D_ABSOLUTE"] | ||
"""Mode of the polyline describes how the points should be arranged in the images. | ||
MODE_POLY2D_ABSOLUTE means that any point defined by an x-value followed by a y-value is the | ||
absolute position.""" | ||
|
||
coordinate_system: str | None | ||
"Name of the coordinate system in respect of which this object data is expressed." | ||
|
||
uid: UUID | None | ||
"This is a string encoding the Universal Unique identifyer of the annotation." | ||
|
||
attributes: JSONAttributes | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
from .attributes import JSONAttributes | ||
|
||
|
||
class JSONPoly2d(BaseModel): | ||
"""A 3D polyline defined as a sequence of 3D points.""" | ||
|
||
name: str | ||
"""This is a string encoding the name of this object data. It is used as index inside the | ||
corresponding object data pointers.""" | ||
|
||
val: list[float] | ||
"List of numerical values of the polyline, according to its mode." | ||
|
||
closed: bool | ||
"""A boolean that defines whether the polyline is closed or not. In case it is closed, it is | ||
assumed that the last point of the sequence is connected with the first one.""" | ||
|
||
coordinate_system: str | None | ||
"Name of the coordinate system in respect of which this object data is expressed." | ||
|
||
uid: UUID | None | ||
"This is a string encoding the Universal Unique identifyer of the annotation." | ||
|
||
attributes: JSONAttributes | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Literal | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
from .attributes import JSONAttributes | ||
|
||
|
||
class JSONPoly2d(BaseModel): | ||
"""A vector (list) of numbers.""" | ||
|
||
name: str | ||
"""This is a string encoding the name of this object data. It is used as index inside the | ||
corresponding object data pointers.""" | ||
|
||
val: list[float] | ||
"The numerical values of the vector (list) of numbers." | ||
|
||
coordinate_system: str | None | ||
"Name of the coordinate system in respect of which this object data is expressed." | ||
|
||
uid: UUID | None | ||
"This is a string encoding the Universal Unique identifyer of the annotation." | ||
|
||
type: Literal["values", "range"] | None | ||
"""This attribute specifies whether the vector shall be considered as a descriptor of individual | ||
values or as a definition of a range.""" | ||
|
||
attributes: JSONAttributes | None |