라이다 및 카메라
2 분
kognic-io 2.5.0부터는 씬 타입(LidarsAndCameras)을 노출하지 않고 단일 모델로부터 모든 씬 생성을 간소화하는 새로운 씬 모델을 권장하고 있습니다. 가능하다면 이를 채택하는 것을 권장하지만, 이 방식은 단일 프레임 시퀀스를 생성하므로 LidarsAndCameras 씬을 요구하는 기존 Request와 호환되지 않을 수 있다는 점에 유의하세요.
LidarsAndCameras는 112개의 카메라 이미지와 120개의 포인트 클라우드를 포함하는 단일 프레임으로 구성됩니다. LidarsAndCameras 객체의 각 필드가 무엇에 대응하는지에 대한 자세한 문서는 씬 개요 섹션을 참고하세요.
from __future__ import absolute_import
from datetime import datetime
from typing import Optional
from uuid import uuid4
import kognic.io.model.scene.lidars_and_cameras as LCM
from examples.calibration.calibration import create_sensor_calibration
from kognic.io.client import KognicIOClient
from kognic.io.logger import setup_logging
from kognic.io.model import CreateSceneResponse, Image, PointCloud
def run(client: KognicIOClient, dryrun: bool = True, **kwargs) -> Optional[CreateSceneResponse]:
print("Creating Lidars And Cameras Scene...")
lidar_sensor1 = "lidar"
cam_sensor1 = "RFC01"
cam_sensor2 = "RFC02"
metadata = {"location-lat": 27.986065, "location-long": 86.922623, "vehicle_id": "abg"}
# Create calibration
# (Please refer to the API documentation about calibration for more details)
calibration_spec = create_sensor_calibration(
f"Collection {datetime.now()}",
[lidar_sensor1],
[cam_sensor1, cam_sensor2],
)
created_calibration = client.calibration.create_calibration(calibration_spec)
scene = LCM.LidarsAndCameras(
external_id=f"lidars-and-cameras-example-{uuid4()}",
frame=LCM.Frame(
point_clouds=[
PointCloud(
filename="./examples/resources/point_cloud_RFL01.las",
sensor_name=lidar_sensor1,
)
],
images=[
Image(
filename="./examples/resources/img_RFC01.jpg",
sensor_name=cam_sensor1,
),
Image(
filename="./examples/resources/img_RFC02.jpg",
sensor_name=cam_sensor2,
),
],
),
calibration_id=created_calibration.id,
metadata=metadata,
)
# Create scene
return client.lidars_and_cameras.create(scene, dryrun=dryrun, **kwargs)
if __name__ == "__main__":
setup_logging(level="INFO")
client = KognicIOClient()
# Project - Available via `client.project.get_projects()`
project = "<project-identifier>"
run(client, project=project)dryrun을 사용하여 씬 검증하기
메서드 호출 시 dryrun 파라미터를 true로 설정하면 API를 사용해 씬을 검증하지만 실제로 생성하지는 않습니다.