annofabapiの3DPC Editor用の拡張機能です。
Project description
annofabapi-3dpc-extensions
annofabapiの3次元アノテーション用の拡張機能です。
Install
- Python 3.9+
Install
$ pip install annofabapi-3dpc-extensions
Usage
cuboidアノテーションやセグメントアノテーションに対応したデータクラスを利用できます。
from annofabapi.parser import SimpleAnnotationDirParser
from annofab_3dpc.annotation import (
CuboidAnnotationDetailDataV2,
EulerAnglesZXY,
SegmentAnnotationDetailData,
SegmentData,
convert_annotation_detail_data,
)
parser = SimpleAnnotationDirParser("tests/data/task1/input1.json")
result = parser.parse(convert_annotation_detail_data)
segment_annotation_data = result.details[0].data
cuboid_annotation_data = result.details[1].data
assert type(segment_annotation_data) == SegmentAnnotationDetailData
assert type(cuboid_annotation_data) == CuboidAnnotationDetailDataV2
### cuboid annotation
print(cuboid_annotation_data)
# => CuboidAnnotationDetailDataV2(shape=CuboidShapeV2(dimensions=Size(width=6.853874863204751, height=0.2929844409227371, depth=4.092537841193188), location=Location(x=-11.896872014598989, y=-3.0571381239812996, z=0.3601047024130821), rotation=EulerAnglesZXY(x=0, y=0, z=0), direction=CuboidDirection(front=Vector3(x=1, y=0, z=0), up=Vector3(x=0, y=0, z=1))), kind='CUBOID', version='2')
# オイラー角をクォータニオンに変換
print(cuboid_annotation_data.shape.rotation.to_quaternion())
# => [1.0, 0.0, 0.0, 0.0]
# クォータニオンからオイラー角に変換
print(EulerAnglesZXY.from([1.0, 0.0, 0.0, 0.0]))
# => EulerAnglesZXY(x=-0.0, y=0.0, z=0.0)
### segment annotation
print(segment_annotation_data)
# => SegmentAnnotationDetailData(data_uri='./input1/7ba51c15-f07a-4e29-8584-a4eaf3a6812a')
# セグメント情報が格納されたファイルを読み込む
with parser.open_outer_file(Path(segment_annotation_data.data_uri).name) as f:
dict_segmenta_data = json.load(f)
segment_data = SegmentData.from_dict(dict_segmenta_data)
assert type(segment_data) == SegmentData
assert len(segment_data.points) > 0
print(segment_data.points)
# => [130439, 130442, ... ]
開発者向けドキュメント
https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions/blob/main/README_for_developer.md 参照
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file annofabapi_3dpc_extensions-0.3.0.tar.gz.
File metadata
- Download URL: annofabapi_3dpc_extensions-0.3.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7441d90431b2b1b2416a0db9edac24716261ebd1850366240cde8e031e8f98d
|
|
| MD5 |
556a94aad673faad2d10a3f76d339157
|
|
| BLAKE2b-256 |
917ab9c92a9d70b6f271b15295ff7ddf80533bbe28256a1de55035d3f0db4bc7
|
File details
Details for the file annofabapi_3dpc_extensions-0.3.0-py3-none-any.whl.
File metadata
- Download URL: annofabapi_3dpc_extensions-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43f028fa94bf5de1824e6739b408e5cdc51b774fc8b840cdcf70ba34ead54614
|
|
| MD5 |
1ebdbe50fd9dfe336e1b1ae769427b50
|
|
| BLAKE2b-256 |
180ad7a5c7402a01850cba94e420e584f2d11386a5db10c2071443be9a34d6d9
|