ncore.data Package#
Package exposing methods related to NCore’s basic data types and abstract APIs
- class ncore.data.AsyncCameraLabelsProtocol(*args, **kwargs)#
Bases:
CameraLabelsProtocol,ProtocolCamera labels with asynchronous reads of their data (see
CameraLabelsProtocolfor the synchronous API)- class CameraLabelHandleProtocol(*args, **kwargs)#
Bases:
CameraLabelHandleProtocol,ProtocolA single camera label at a specific timestamp, loadable synchronously or asynchronously
- async get_data_async() npt.NDArray[Any]#
Loads and returns the label data as a numpy array, read asynchronously
- get_label(
- timestamp_us: int,
Return a lazy handle to the label data at the given timestamp (loadable synchronously or asynchronously)
- class ncore.data.AsyncCameraSensorProtocol(*args, **kwargs)#
Bases:
AsyncSensorProtocol,CameraSensorProtocol,ProtocolA camera sensor with asynchronous reads of its data (see
CameraSensorProtocolfor the synchronous API)- class EncodedImageDataHandleProtocol(
- *args,
- **kwargs,
Bases:
EncodedImageDataHandleProtocol,ProtocolReferences encoded image data without loading it (synchronously or asynchronously)
- async get_data_async() EncodedImageData#
Loads the referenced encoded image data to memory asynchronously
- async get_frame_data_async(
- frame_index: int,
Returns the frame’s encoded image data, read asynchronously (decode it via
EncodedImageData.get_decoded_image(), e.g., in a worker pool)
- get_frame_handle(
- frame_index: int,
Returns a handle of the frame’s encoded image data (loadable synchronously or asynchronously)
- class ncore.data.AsyncLidarSensorProtocol(*args, **kwargs)#
Bases:
AsyncRayBundleSensorProtocol,LidarSensorProtocol,ProtocolA lidar sensor with asynchronous reads of its data (see
LidarSensorProtocolfor the synchronous API)
- class ncore.data.AsyncPointCloudsSourceProtocol(*args, **kwargs)#
Bases:
PointCloudsSourceProtocol,ProtocolA point-clouds source with asynchronous reads of its data (see
PointCloudsSourceProtocolfor the synchronous API)- async get_pc_async(
- pc_index: int,
Returns the point cloud at pc_index like
PointCloudsSourceProtocol.get_pc(), with its points read asynchronously (attributes are loaded lazily, as forPointCloudsSourceProtocol.get_pc(): their loads on access are synchronous reads)
- class ncore.data.AsyncRadarSensorProtocol(*args, **kwargs)#
Bases:
AsyncRayBundleSensorProtocol,RadarSensorProtocol,ProtocolA radar sensor with asynchronous reads of its data (see
RadarSensorProtocolfor the synchronous API)
- class ncore.data.AsyncRayBundleSensorPointCloudsSourceAdapter(
- sensor: AsyncRayBundleSensorProtocol,
- *,
- return_index: int = 0,
- promote_generic_data: Dict[str,
- ~ncore.impl.data.compat.RayBundleSensorPointCloudsSourceAdapter.GenericDataPromotion]={'rgb': RayBundleSensorPointCloudsSourceAdapter.GenericDataPromotion(shape_suffix=(3,
- ),
- transform_type=<AttributeTransformType.INVARIANT: 0>)},
Bases:
RayBundleSensorPointCloudsSourceAdapterAdapts an
AsyncRayBundleSensorProtocol(lidar or radar) intoAsyncPointCloudsSourceProtocol(seeRayBundleSensorPointCloudsSourceAdapter), reading point clouds asynchronously.The protocol is declared after this class (the asynchronous protocols are defined at the end of the module), so conformance is structural.
- async get_pc_async(
- pc_index: int,
Returns the point cloud of a sensor frame with its points (and model elements) read asynchronously (see
RayBundleSensorPointCloudsSourceAdapterfor its attributes: lazily loaded ones are read synchronously on access)
- class ncore.data.AsyncRayBundleSensorProtocol(*args, **kwargs)#
Bases:
AsyncSensorProtocol,RayBundleSensorProtocol,ProtocolA ray-bundle sensor with asynchronous reads of its data (see
RayBundleSensorProtocolfor the synchronous API)- async get_frame_point_cloud_async( ) FramePointCloud#
Returns a frame point cloud like
RayBundleSensorProtocol.get_frame_point_cloud(), with its data read asynchronously (concurrently)
- async get_frame_ray_bundle_direction_async(
- frame_index: int,
Returns the per-ray directions for the ray-bundle for a specific frame [N,3], read asynchronously
- async get_frame_ray_bundle_return_distance_m_async( ) npt.NDArray[np.float32]#
Returns the per-ray measured metric distances for the ray bundle returns of a specific frame [N,], read asynchronously
- async get_frame_ray_bundle_return_valid_mask_async( ) npt.NDArray[np.bool_]#
Returns the per-ray valid mask for the ray bundle returns of a specific frame [N], read asynchronously
- class ncore.data.AsyncSensorProtocol(*args, **kwargs)#
Bases:
SensorProtocol,ProtocolA sensor with asynchronous reads of its data (see
SensorProtocolfor the synchronous API)
- class ncore.data.AsyncSequenceLoaderProtocol(*args, **kwargs)#
Bases:
SequenceLoaderProtocol,ProtocolA sequence loader whose sensors, point-clouds sources and camera labels support asynchronous reads of their data (see
SequenceLoaderProtocolfor the synchronous API).Example:
async def load_frames(loader: AsyncSequenceLoaderProtocol, camera_id: str, frame_indices: List[int]): camera = loader.get_camera_sensor(camera_id) return await asyncio.gather(*(camera.get_frame_data_async(i) for i in frame_indices))
- get_camera_labels(
- camera_label_id: str,
Get a camera label instance (with asynchronous reads) by instance ID.
- get_camera_sensor(
- sensor_id: str,
Returns a camera sensor instance (with asynchronous reads) for a given sensor id
- get_lidar_sensor(
- sensor_id: str,
Returns a lidar sensor instance (with asynchronous reads) for a given sensor id
- get_point_clouds_source( ) AsyncPointCloudsSourceProtocol#
Returns a point-clouds source (with asynchronous reads) for a given source id (see
SequenceLoaderProtocol.get_point_clouds_source())
- get_radar_sensor(
- sensor_id: str,
Returns a radar sensor instance (with asynchronous reads) for a given sensor id
- query_camera_labels(
- camera_id: str,
- label_type: LabelType | None = None,
- label_category: LabelCategory | None = None,
Query camera label instances (with asynchronous reads) matching filters (see
SequenceLoaderProtocol.query_camera_labels())
- class ncore.data.BBox3(
- centroid: Tuple[float, float, float],
- dim: Tuple[float, float, float],
- rot: Tuple[float, float, float],
Bases:
DataClassJsonMixinParameters of a 3D bounding-box
- centroid: Tuple[float, float, float]#
Coordinates [meters] of the bounding-box’s centroid in the frame of reference
- dim: Tuple[float, float, float]#
Extents [meters] of the local bounding-box dimensions in its local frame
- classmethod from_array(
- array: ndarray,
Convert from convenience single-array representation
- class ncore.data.BivariateWindshieldModelParameters(
- reference_poly: ReferencePolynomial = None,
- horizontal_poly: ndarray = None,
- vertical_poly: ndarray = None,
- horizontal_poly_inverse: ndarray = None,
- vertical_poly_inverse: ndarray = None,
Bases:
ExternalDistortionParametersRepresents parameters required to create a windshield external distortion model
- horizontal_poly: ndarray = None#
Polynomial coefficients used for forward projection on the horizontal component of a ray via its projected angle phi=asin(x/norm(x,y)). The polynomial is of order N in both phi and theta with the form P(phi,N)*P(theta,0) + P(phi, N-1)*P(theta,1) … + P(phi, N-N)*P(theta,N), where P(i, N) is a polynomial over “i” of degree N (float32, [(N + 1) * (N + 2) / 2,])
- horizontal_poly_inverse: ndarray = None#
Polynomial coefficients used to evaluate the inverse distortion in backprojection of the horizontal component of a ray via its projected angle phi=asin(x/norm(x,y)). The polynomial is of order N in both phi and theta with the form P(phi,N)*P(theta,0) + P(phi, N-1)*P(theta,1) … + P(phi, N-N)*P(theta,N), where P(i, N) is a polynomial over “i” of degree N (float32, [(N + 1) * (N + 2) / 2,])
- reference_poly: ReferencePolynomial = None#
Reference polynomial of the model
- vertical_poly: ndarray = None#
Polynomial coefficients used for forward projection on the vertical component of a ray via its projected angle theta=asin(y/norm(x,y)). The polynomial is of order M in both phi and theta with the form P(phi,M)*P(theta,0) + P(phi, M-1)*P(theta,1) … + P(phi, M-M)*P(theta,M), where P(i, M) is a polynomial over “i” of degree M (float32, [(M + 1) * (M + 2) / 2,])
- vertical_poly_inverse: ndarray = None#
Polynomial coefficients used to evaluate the inverse distortion in backprojection of the vertical component of a ray via its projected angle theta=asin(y/norm(x,y)). The polynomial is of order M in both phi and theta with the form P(phi,M)*P(theta,0) + P(phi, M-1)*P(theta,1) … + P(phi, M-M)*P(theta,M), where P(i, M) is a polynomial over “i” of degree M (float32, [(M + 1) * (M + 2) / 2,])
- class ncore.data.CameraLabelDescriptor(
- camera_id: str,
- label_type: LabelType,
- label_schema: LabelSchema,
- label_source: LabelSource = None,
Bases:
DataClassJsonMixinCompound descriptor bundling the identity and schema of one camera label instance.
Passed directly to
CameraLabelsComponent.Writerto define what it stores. Thedefault_instance_nameproperty provides a recommended naming convention.- classmethod from_dict( ) CameraLabelDescriptor#
Decodes a descriptor like the generic dataclasses-json
from_dict, but reuses decoded label types and schemas vialabel_type_cache/label_schema_cache.The generic decoder resolves type hints on every call (~0.5 ms per descriptor). Sequences can have one descriptor per camera and label type (e.g., hundreds for per-frame cameras), which typically all share the same label type and schema, so decoding them dominated opening such sequences.
- label_schema: LabelSchema#
- label_schema_cache: ClassVar[DecodedValueCache[dict | list | str | int | float | bool | None, LabelSchema]] = <ncore.impl.data.util.DecodedValueCache object>#
- label_source: LabelSource#
- label_type_cache: ClassVar[DecodedValueCache[dict | list | str | int | float | bool | None, LabelType]] = <ncore.impl.data.util.DecodedValueCache object>#
Caches of decoded label types / schemas used by
from_dict(). All label components of a sequence typically share these, and only differ in their camera.max_sizecan be tuned (None: unbounded,0: no caching).
- class ncore.data.CameraLabelsProtocol(*args, **kwargs)#
Bases:
ProtocolProtocol for accessing camera-associated image labels.
Each instance provides labels of one type for one camera, with independently-managed timestamps.
- class CameraLabelHandleProtocol(*args, **kwargs)#
Bases:
ProtocolProtocol for a single camera label at a specific timestamp.
Returned by
CameraLabelsProtocol.get_label()and provides deferred access to the label data and metadata.- property generic_meta_data: JsonDocument#
Per-label generic metadata.
- get_data() npt.NDArray[Any]#
Load and return the label data as a numpy array.
- get_label(
- timestamp_us: int,
Return a lazy handle to the label data at the given timestamp.
- property label_descriptor: CameraLabelDescriptor#
Descriptor of this label instance.
- property label_timestamps_us: npt.NDArray[np.uint64]#
Timestamps of all stored labels, sorted ascending.
- property labels_generic_meta_data: JsonDocument#
Generic metadata associated with all labels.
- class ncore.data.CameraModelParameters(
- resolution: ndarray = None,
- shutter_type: ShutterType = None,
- external_distortion_parameters: ExternalDistortionParameters | None = None,
Bases:
DataClassJsonMixin,ABCRepresents parameters common to all camera models
The JSON (de)serialization interface (
to_dict()/from_dict()) is provided bydataclasses_json.DataClassJsonMixinon this base, so that code operating on the abstract type can serialize parameters without narrowing to a concrete model first.- external_distortion_parameters: ExternalDistortionParameters | None = None#
Optional external distortion source associated to the camera (e.g. windshield). If a source exists, rays will be distorted prior to reaching the camera and its associated lens distortion if applicable
- abstractmethod paraxial_pinhole_geometry() ParaxialPinholeGeometry#
The ideal pinhole agreeing with this model to first order about the optical axis
The single extension point behind
IdealPinholeCameraModelParameters.from_source()andIdealPinholeCameraModelParameters.natural_fov(). Implementing it is all a model registered out of tree withncore.sensors.register_camera_model()needs to be usable by both.Required rather than defaulted, like
transform(), so that a new model has to make a deliberate decision here instead of inheriting a silent refusal. A model with no meaningful paraxial pinhole opts out explicitly by raisingTypeError.- Raises:
TypeError – If the concrete model does not define a paraxial pinhole.
- shutter_type: ShutterType = None#
Shutter type of the camera’s imaging sensor
- abstractmethod transform(
- image_domain_scale: float | Tuple[float, float],
- image_domain_offset: Tuple[float, float] = (0.0, 0.0),
- new_resolution: Tuple[int, int] | None = None,
Applies a transformation to camera model parameter
- Parameters:
image_domain_scale – an isotropic (if float) or anisotropic (if tuple of floats) scaling of the full image domain to a scaled image domain (e.g., to account for up-/downsampling). Resulting scaled image resolution needs to be integer if no explicit ‘new_resolution’ is provided.
image_domain_offset – an offset of the _scaled_ image domain (e.g., to account for cropping).
new_resolution – an optional new resolution to set (if None, the full scaled resolution is used).
- Returns:
a transformed version of the concrete camera model parameters
- class ncore.data.CameraSensorProtocol(*args, **kwargs)#
Bases:
SensorProtocol,ProtocolCameraSensorProtocol provides unified access to a relevant subset of common NCore camera sensor APIs
- class EncodedImageDataHandleProtocol(*args, **kwargs)#
Bases:
ProtocolReferences encoded image data without loading it
- get_data() EncodedImageData#
Loads the referenced encoded image data to memory
- get_frame_data(
- frame_index: int,
Returns the frame’s encoded image data
- get_frame_handle(
- frame_index: int,
Returns a handle of the frame’s encoded image data
- get_frame_image_array(
- frame_index: int,
Returns decoded image data as array [W,H,C]
- property model_parameters: CameraModelParameters#
Returns parameters specific to the camera’s intrinsic model
- ncore.data.ConcreteExternalDistortionParametersUnion#
alias of
BivariateWindshieldModelParameters
- ncore.data.ConcreteLidarModelParametersUnion#
- class ncore.data.CuboidTrackObservation(
- track_id: str,
- class_id: str,
- timestamp_us: int,
- reference_frame_id: str,
- reference_frame_timestamp_us: int,
- bbox3: BBox3,
- source: LabelSource = None,
- source_version: str | None = None,
Bases:
DataClassJsonMixinIndividual cuboid track observation relative to a reference frame
- bbox3: BBox3#
Bounding-box coordinates of the object relative to the reference frame’s coordinate system
- source: LabelSource = None#
The source for the current label
- timestamp_us: int#
The timestamp associated with the centroid of the observation (possibly an accurate in-frame time)
- transform(
- target_frame_id: str,
- target_frame_timestamp_us: int,
- pose_graph: PoseGraphInterpolator,
- anchor_frame_id: str = 'world',
Transform the observation’s bounding box to a different reference frame.
- Parameters:
target_frame_id – ID of the target reference frame
target_frame_timestamp_us – Timestamp of the target reference frame
pose_graph – PoseGraphInterpolator to perform the evaluation of transformations
anchor_frame_id – ID of the common anchor frame for transformations (default: “world”)
- Returns:
A CuboidTrackObservation instance with the transformed bounding box and updated reference frame info
- class ncore.data.EncodedImageData(encoded_image_data: bytes, encoded_image_format: str)#
Bases:
objectRepresents encoded image data of a specific format in memory
- get_decoded_image() Image#
Returns decoded image from image data.
The result is memoized per instance. (Using
functools.lru_cacheon a method is avoided here: it keys the cache onselfand keeps a global, process-wide strong reference to the instance, which both leaks memory and survivesfork()into DataLoader workers in whatever state it held.)
- ncore.data.EncodedImageHandle#
alias of
EncodedImageDataHandleProtocol
- class ncore.data.ExternalDistortionParameters#
Bases:
DataClassJsonMixin,ABCRepresents parameters common to all external distortion models
External distortion is any source of distortion outside the camera itself (e.g. a windshield). The JSON (de)serialization interface (
to_dict()/from_dict()) is provided bydataclasses_json.DataClassJsonMixinon this base, so that code operating on the abstract type can serialize parameters without narrowing to a concrete model first.
- class ncore.data.FOV( )#
Bases:
objectRepresents a field-of-view with start and span in radians
- class ncore.data.FThetaCameraModelParameters(
- resolution: np.ndarray = None,
- shutter_type: ShutterType = None,
- external_distortion_parameters: ExternalDistortionParameters | None = None,
- principal_point: np.ndarray = None,
- reference_poly: PolynomialType = None,
- pixeldist_to_angle_poly: np.ndarray = None,
- angle_to_pixeldist_poly: np.ndarray = None,
- max_angle: float = 0.0,
- linear_cde: np.ndarray = <factory>,
- tangential_coeffs: np.ndarray = <factory>,
Bases:
CameraModelParametersRepresents FTheta-specific camera model parameters
- POLYNOMIAL_DEGREE = 6#
- class PolynomialType(value)#
Bases:
IntEnumEnumerates different possible polynomial types
- ANGLE_TO_PIXELDIST = 2#
Polynomial mapping angles-to-pixeldistances (also known as “forward” polynomial)
- PIXELDIST_TO_ANGLE = 1#
Polynomial mapping pixeldistances-to-angles (also known as “backward” polynomial)
- angle_to_pixeldist_poly: np.ndarray = None#
Coefficients of the angles-to-pixeldistances polynomial (float32, [6,])
- linear_cde: np.ndarray#
Coefficients of the constrained linear term [c,d;e,1] transforming between sensor coordinates (in mm) to image coordinates (in px) (float32, [3,]). The identity [1, 0, 0] (the default) is omitted when serializing
- paraxial_pinhole_geometry() ParaxialPinholeGeometry#
First-order term of the angles-to-pixeldistances polynomial, scaled by the linear term
The forward polynomial maps
delta = f(theta) = c0 + c1*theta + ..., andr = f*tan(theta) ~= f*thetaneartheta = 0, sod(delta)/d(theta)|_0 = c1. The linear term contributes a per-axis scale; its shear componentsdandeare not representable by a pinhole and are dropped. The principal point is stored in the NVIDIA pixel-center convention, so a+0.5shift brings it into image coordinates.- Raises:
ValueError – If the polynomial does not yield a positive focal length.
- pixeldist_to_angle_poly: np.ndarray = None#
Coefficients of the pixeldistances-to-angles polynomial (float32, [6,])
- principal_point: np.ndarray = None#
U and v coordinate of the principal point, following the NVIDIA default convention for FTheta camera models in which the pixel indices represent the center of the pixel (not the top-left corners). Principal point coordinates will be adapted internally in camera model APIs to reflect the image coordinate conventions
- reference_poly: PolynomialType = None#
Indicating which of the two stored polynomials is the model’s reference polynomial (the other polynomial is only an approximation)
- tangential_coeffs: np.ndarray#
Tangential distortion coefficients [t0, t1] in pixels (float32, [2,]). With normalized coordinates
x = X/Z, y = Y/Zthe offsetsdu = 2*t0*x*y + t1*(r^2 + 2*x^2)anddv = t0*(r^2 + 2*y^2) + 2*t1*x*y(r^2 = x^2 + y^2) are added to the radial (polynomial) offset from the principal point before the linear term is applied. All zeros (the default) means no tangential distortion; such values are omitted when serializing
- transform(
- image_domain_scale: float | Tuple[float, float],
- image_domain_offset: Tuple[float, float] = (0.0, 0.0),
- new_resolution: Tuple[int, int] | None = None,
Applies a transformation to FTheta camera model parameter
- Parameters:
image_domain_scale – an isotropic (if float) or anisotropic (if tuple of floats) scaling of the full image domain to a scaled image domain (e.g., to account for up-/downsampling). Resulting scaled image resolution needs to be integer if no explicit ‘new_resolution’ is provided.
image_domain_offset – an offset of the _scaled_ image domain (e.g., to account for cropping).
new_resolution – an optional new resolution to set (if None, the full scaled resolution is used).
- Returns:
a transformed version of the FTheta camera model parameters
- class ncore.data.FrameTimepoint(value)#
Bases:
IntEnumEnumerates special timepoints within a frame (values used to index into buffers)
- END = 1#
Requested timepoint is referencing the end time of the frame
- START = 0#
Requested timepoint is referencing the start time of the frame
- class ncore.data.IdealPinholeCameraModelParameters(
- resolution: ndarray = None,
- shutter_type: ShutterType = None,
- external_distortion_parameters: ExternalDistortionParameters | None = None,
- principal_point: ndarray = None,
- focal_length: ndarray = None,
Bases:
PinholeCameraModelParametersRepresents an ideal (distortion-free) pinhole camera
An ideal pinhole maps normalized camera coordinates directly to image coordinates via
focal_lengthandprincipal_pointwith no lens distortion. It is the most efficient camera model and the natural target for rectification.- fov() ndarray#
Per-axis full field-of-view angles
[fov_x, fov_y][rad] of this ideal pinholeThe pinhole maps angle to pixel distance as
r = f * tan(theta), so the full field of view to the farthest image border along each axis is2 * atan(half_extent / focal).
- static from_source(
- source: CameraModelParameters,
- target_fov: float | ndarray | None = None,
Construct an ideal (distortion-free) pinhole approximating
sourceThe source camera’s paraxial pinhole geometry (focal length, principal point, resolution) is extracted and an ideal pinhole is assembled. The angular extent is controlled by
target_fov(full field-of-view angles [rad]):None: use the source’s natural per-axis field of view (natural_fov()).float: an isotropic target full field of view, preserving the source focal-length aspect ratio (the most binding axis lands exactly at this value).np.ndarray[2,]: per-axis target full field of view[fov_x, fov_y];from_source(source, target_fov=natural_fov(source))reproduces the default.
target_fovselects which rays the pinhole covers (the angular extent), not a magnification: because a pinhole maps angle to pixel distance asr = f * tan(theta), different values yield genuinely different views (the periphery stretches increasingly for wider fields of view; the optical axis stays fixed). Widening past the source’s captured field of view is allowed and yields invalid (out-of-source) regions when rectifying.- Parameters:
source – the source camera model parameters to convert. Supported types are F-Theta, OpenCV pinhole, OpenCV fisheye and ideal pinhole.
target_fov – optional target full field-of-view angle(s) [rad] (see above).
- Returns:
ideal pinhole camera model parameters approximating
source.- Raises:
TypeError – if
sourceis of an unsupported camera model type.ValueError – if the resulting field of view cannot be represented by a pinhole (any axis at or beyond 180 degrees), or
target_fovis invalid.
- static natural_fov(
- source: CameraModelParameters,
Per-axis full field-of-view angles
[fov_x, fov_y][rad] ofsource’s ideal pinholeThis is the field of view of the (paraxial) ideal pinhole that
from_source()produces by default (target_fov=None). It is the natural value to scale when choosing atarget_fov(e.g.0.8 * natural_fov(source)to narrow,1.2 * ...to widen). May be>= pifor wide fisheye / omnidirectional cameras, in which casefrom_source()requires an explicit feasibletarget_fov.- Parameters:
source – the source camera model parameters to convert.
- Returns:
per-axis full field-of-view angles [rad] (float,
[2,]).
- class ncore.data.LabelCategory(value)#
Bases:
IntEnumHigh-level category of a label types.
- DEPTH = 0#
Distance measures (z-axis, ray, relative)
- FEATURE = 6#
Feature embeddings (DINOv2, CLIP)
- FLOW = 1#
Motion displacement fields (optical, scene)
- GEOMETRY = 4#
Geometric vectors (normals, ray directions)
- MASK = 3#
Binary / multi-level masks
- MATERIAL = 5#
Material / surface properties (albedo, roughness)
- OTHER = 7#
Catch-all for uncategorised labels
- SEGMENTATION = 2#
Classification (semantic, instance, panoptic)
- UNKNOWN = -1#
Unrecognised / fallback category (reader-only)
- classmethod resolve(
- name: str,
Return the member matching name, or
UNKNOWNif unrecognised.
- class ncore.data.LabelEncoding(value)#
Bases:
IntEnumDescribes how the raw label data is stored on disk.
- IMAGE_ENCODED = 1#
Stored as an encoded image (e.g. PNG, JPEG)
- RAW = 0#
Stored as a raw numeric array
- UNKNOWN = -1#
Unrecognised / fallback encoding (reader-only)
- classmethod resolve(
- name: str,
Return the member matching name, or
UNKNOWNif unrecognised.
- class ncore.data.LabelSchema(
- dtype: dtype = None,
- shape_suffix: Tuple[int, ...] = (),
- encoding: LabelEncoding = None,
- encoded_format: str | None = None,
- quantization: QuantizationParams | None = None,
Bases:
DataClassJsonMixinSchema describing the dtype, shape, encoding and quantization of a single label layer.
- encoding: LabelEncoding#
How the label data is stored on disk
- quantization: QuantizationParams | None#
Optional quantization parameters
- class ncore.data.LabelSource(value)#
Bases:
IntEnumEnumerates different sources for labels (auto, manual, GT, synthetic etc.)
- AUTOLABEL = 1#
Label originates from an autolabeling pipeline
- EXTERNAL = 2#
Label originates from an unspecified external source, e.g., from third-party processes
- GT_ANNOTATION = 4#
Label originates from manual annotation and is considered ground-truth
- GT_SYNTHETIC = 3#
Label originates from a synthetic data simulation and is considered ground-truth
- UNKNOWN = -1#
Unrecognised / fallback source (reader-only)
- classmethod resolve(name: str) LabelSource#
Return the member matching name, or
UNKNOWNif unrecognised.
- class ncore.data.LabelType(
- category: LabelCategory = None,
- qualifier: str = '',
- unit: LabelUnit | None = None,
Bases:
DataClassJsonMixinDescribes the semantic kind of a label: category + qualifier + unit.
Well-known combinations are exposed as class-level constants (e.g.
LabelType.DEPTH_Z_M). Project-specific labels use custom qualifiers with no code changes required.- DEPTH_RAY_M: ClassVar[LabelType] = LabelType(category=<LabelCategory.DEPTH: 0>, qualifier='ray', unit=<LabelUnit.METERS: 0>)#
- DEPTH_RELATIVE: ClassVar[LabelType] = LabelType(category=<LabelCategory.DEPTH: 0>, qualifier='relative', unit=<LabelUnit.UNITLESS: 2>)#
- DEPTH_Z_M: ClassVar[LabelType] = LabelType(category=<LabelCategory.DEPTH: 0>, qualifier='z', unit=<LabelUnit.METERS: 0>)#
- FLOW_OPTICAL_BACKWARD_PX: ClassVar[LabelType] = LabelType(category=<LabelCategory.FLOW: 1>, qualifier='optical_backward', unit=<LabelUnit.PIXELS: 1>)#
- FLOW_OPTICAL_FORWARD_PX: ClassVar[LabelType] = LabelType(category=<LabelCategory.FLOW: 1>, qualifier='optical_forward', unit=<LabelUnit.PIXELS: 1>)#
- FLOW_SCENE_BACKWARD_M: ClassVar[LabelType] = LabelType(category=<LabelCategory.FLOW: 1>, qualifier='scene_backward', unit=<LabelUnit.METERS: 0>)#
- FLOW_SCENE_FORWARD_M: ClassVar[LabelType] = LabelType(category=<LabelCategory.FLOW: 1>, qualifier='scene_forward', unit=<LabelUnit.METERS: 0>)#
- GEOMETRY_NORMAL_CAMERA: ClassVar[LabelType] = LabelType(category=<LabelCategory.GEOMETRY: 4>, qualifier='normal_camera', unit=<LabelUnit.UNITLESS: 2>)#
- GEOMETRY_NORMAL_WORLD: ClassVar[LabelType] = LabelType(category=<LabelCategory.GEOMETRY: 4>, qualifier='normal_world', unit=<LabelUnit.UNITLESS: 2>)#
- GEOMETRY_RAY_DIRECTION: ClassVar[LabelType] = LabelType(category=<LabelCategory.GEOMETRY: 4>, qualifier='ray_direction', unit=<LabelUnit.UNITLESS: 2>)#
- MASK_BACKGROUND: ClassVar[LabelType] = LabelType(category=<LabelCategory.MASK: 3>, qualifier='background', unit=<LabelUnit.UNITLESS: 2>)#
- MASK_DYNAMIC: ClassVar[LabelType] = LabelType(category=<LabelCategory.MASK: 3>, qualifier='dynamic', unit=<LabelUnit.UNITLESS: 2>)#
- SEGMENTATION_INSTANCE: ClassVar[LabelType] = LabelType(category=<LabelCategory.SEGMENTATION: 2>, qualifier='instance', unit=<LabelUnit.UNITLESS: 2>)#
- SEGMENTATION_SEMANTIC: ClassVar[LabelType] = LabelType(category=<LabelCategory.SEGMENTATION: 2>, qualifier='semantic', unit=<LabelUnit.UNITLESS: 2>)#
- category: LabelCategory#
High-level label family
- class ncore.data.LabelUnit(value)#
Bases:
IntEnumPhysical unit associated with a label’s numeric values.
- METERS = 0#
Meters (metric)
- PIXELS = 1#
Pixel displacement
- UNITLESS = 2#
Dimensionless quantity (e.g. class IDs, masks)
- UNKNOWN = -1#
Unrecognised / fallback unit (reader-only)
- class ncore.data.LidarModelParameters#
Bases:
DataClassJsonMixin,ABCRepresents parameters common to all lidar models
The JSON (de)serialization interface (
to_dict()/from_dict()) is provided bydataclasses_json.DataClassJsonMixinon this base, so that code operating on the abstract type can serialize parameters without narrowing to a concrete model first.- abstractmethod get_horizontal_fov(
- dtype: npt.DTypeLike = <class 'numpy.float32'>,
The lidar’s horizontal field of view, in the requested dtype precision
See
get_vertical_fov(). A model that spins through a full revolution reports a span of2 * pi.
- abstractmethod get_vertical_fov(
- dtype: npt.DTypeLike = <class 'numpy.float32'>,
The lidar’s vertical field of view, in the requested dtype precision
Every lidar has a vertical and a horizontal field of view, whatever its scanning design, so both are declared here rather than on the one concrete model that happens to implement them today. A model derives them from whatever it stores: elevations and azimuths for a structured spinning lidar, something else entirely for a flash or solid-state one.
- class ncore.data.LidarSensorProtocol(*args, **kwargs)#
Bases:
RayBundleSensorProtocol,ProtocolLidarSensorProtocol provides unified access to a relevant subset of common NCore lidar sensor APIs
- get_frame_ray_bundle_model_element(
- frame_index: int,
Returns the per-ray model elements for a ray bundle for a specific frame, if available.
- Parameters:
frame_index – Index of the frame
- Returns:
Array of per-ray model elements [N,] or None if not available
- get_frame_ray_bundle_return_intensity( ) npt.NDArray[np.float32]#
Returns the per-ray measured intensities for a ray bundle return for a specific frame.
- Parameters:
frame_index – Index of the frame
return_index – Index of the ray bundle return to retrieve (for multi-return sensors)
- Returns:
Array of per-ray intensities [N,]
- property model_parameters: LidarModelParameters | None#
Returns parameters specific to the lidar’s intrinsic model (optional as not mandatory)
- class ncore.data.OpenCVFisheyeCameraModelParameters(
- resolution: ndarray = None,
- shutter_type: ShutterType = None,
- external_distortion_parameters: ExternalDistortionParameters | None = None,
- principal_point: ndarray = None,
- focal_length: ndarray = None,
- radial_coeffs: ndarray = None,
- max_angle: float = 0.0,
Bases:
CameraModelParametersRepresents Fisheye-specific (OpenCV-like) camera model parameters
- static compute_max_angle( ) float#
Estimate
max_anglefrom the farthest image corner, respecting monotonicity of the forward polynomial.Finds the largest angle theta such that the OpenCV fisheye forward distortion model
\[r(\theta) = \theta\,(1 + k_1\theta^2 + k_2\theta^4 + k_3\theta^6 + k_4\theta^8)\]is monotonically increasing (i.e. \(r'(\theta) > 0\)) and \(r(\theta)\) does not exceed the normalised pixel distance of the farthest image corner.
- Parameters:
resolution (np.ndarray) – Image resolution
[width, height](uint64 or int,[2,]).focal_length (np.ndarray) – Focal lengths
[fu, fv](float32,[2,]).principal_point (np.ndarray) – Principal point
[cu, cv](float32,[2,]).radial_coeffs (np.ndarray) – Fisheye radial distortion coefficients
[k1, k2, k3, k4](float32,[4,]).
- Returns:
Maximum angle in radians.
- Return type:
- focal_length: ndarray = None#
Focal lengths in u and v direction, resp., mapping (distorted) normalized camera coordinates to image coordinates relative to the principal point (float32, [2,])
- paraxial_pinhole_geometry() ParaxialPinholeGeometry#
The model’s own focal length and principal point, already in image coordinates
- principal_point: ndarray = None#
U and v coordinate of the principal point, following the image coordinate conventions (float32, [2,])
- radial_coeffs: ndarray = None#
Radial distortion coefficients radial_coeffs represent OpenCV-like
[k1,k2,k3,k4]coefficients to parameterize the
- transform(
- image_domain_scale: float | Tuple[float, float],
- image_domain_offset: Tuple[float, float] = (0.0, 0.0),
- new_resolution: Tuple[int, int] | None = None,
Applies a transformation to OpenCV fisheye camera model parameter
- Parameters:
image_domain_scale – an isotropic (if float) or anisotropic (if tuple of floats) scaling of the full image domain to a scaled image domain (e.g., to account for up-/downsampling). Resulting scaled image resolution needs to be integer if no explicit ‘new_resolution’ is provided.
image_domain_offset – an offset of the _scaled_ image domain (e.g., to account for cropping).
new_resolution – an optional new resolution to set (if None, the full scaled resolution is used).
- Returns:
a transformed version of the OpenCV fisheye camera model parameters
- class ncore.data.OpenCVPinholeCameraModelParameters(
- resolution: ndarray = None,
- shutter_type: ShutterType = None,
- external_distortion_parameters: ExternalDistortionParameters | None = None,
- principal_point: ndarray = None,
- focal_length: ndarray = None,
- radial_coeffs: ndarray = None,
- tangential_coeffs: ndarray = <factory>,
- thin_prism_coeffs: ndarray = <factory>,
Bases:
PinholeCameraModelParametersRepresents Pinhole-specific (OpenCV-like) camera model parameters
- static compute_max_normalized_radius_squared(
- radial_coeffs: ndarray,
Computes the largest squared radius of normalized coordinates up to which the radial distortion is valid
With
s = r^2the squared radius of the normalized coordinates(x/z, y/z)andd(s) = N(s) / D(s)the rational radial distortion factor (N(s) = 1 + k1 s + k2 s^2 + k3 s^3,D(s) = 1 + k4 s + k5 s^2 + k6 s^3), the distorted radiusr d(s)is a one-to-one function of the radiusrup to its first extremum (beyond it, distinct rays project to the same image points). The bound is the smallest positive root of either the derivative of the distorted radius (whose sign is the one of the polynomialN D + 2 s (N' D - N D')) or ofD(a pole of the distortion factor), andmath.infif the distortion has neither.Only the radial distortion is taken into account (tangential and thin-prism distortions are not).
- Parameters:
radial_coeffs – the radial distortion coefficients
[k1, k2, k3, k4, k5, k6]- Returns:
the exclusive bound on the squared radius of the normalized coordinates of valid camera rays
- property is_distortion_free: bool#
Whether this OpenCV pinhole is free of any distortion
Trueiff all radial, tangential and thin-prism coefficients are zero and no external distortion is attached. A distortion-free OpenCV pinhole is equivalent to an ideal pinhole (seeIdealPinholeCameraModelParameters.from_source()).
- radial_coeffs: ndarray = None#
Radial distortion coefficients
[k1,k2,k3,k4,k5,k6]parameterizing the rational radial distortion factor \(\frac{1 + k_1r^2 + k_2r^4 + k_3r^6}{1 + k_4r^2 + k_5r^4 + k_6r^6}\) for squared norms \(r^2\) of normalized camera coordinates (float32, [6,])
- tangential_coeffs: ndarray#
Tangential distortion coefficients
[p1,p2]parameterizing the tangential distortion components \(\begin{bmatrix} 2p_1x'y' + p_2 \left(r^2 + 2{x'}^2 \right) \\ p_1 \left(r^2 + 2{y'}^2 \right) + 2p_2x'y' \end{bmatrix}\) for normalized camera coordinates \(\begin{bmatrix} x' \\ y' \end{bmatrix}\) (float32, [2,], defaults to zeros if absent; always serialized)
- thin_prism_coeffs: ndarray#
Thins prism distortion coefficients
[s1,s2,s3,s4]parameterizing the thin prism distortion components \(\begin{bmatrix} s_1r^2 + s_2r^4 \\ s_3r^2 + s_4r^4 \end{bmatrix}\) for squared norms \(r^2\) of normalized camera coordinates (float32, [4,], defaults to zeros if absent; always serialized)
- class ncore.data.ParaxialPinholeGeometry( )#
Bases:
objectGeometry of the ideal pinhole that best matches a camera model near the optical axis
The paraxial approximation a model is willing to make of itself: the pinhole agreeing with it to first order about the principal direction. It is what
IdealPinholeCameraModelParameters.from_source()builds on, and whatIdealPinholeCameraModelParameters.natural_fov()measures.
- class ncore.data.PointCloud(
- _xyz: npt.NDArray[np.floating],
- reference_frame_id: str,
- reference_frame_timestamp_us: int,
- coordinate_unit: PointCloud.CoordinateUnit,
- _attributes: Dict[str, PointCloud.Attribute],
- _T_raw_reference: npt.NDArray[np.floating] | None = None,
Bases:
objectImmutable point cloud with lazy attribute loading and rigid-transform support.
All points share a single reference frame and timestamp (the snapshot timestamp). Per-point timestamps, if available, are stored as a regular
INVARIANTattribute.The
transform()method returns a newPointCloudwith an accumulated rigid transform stored in_T_raw_reference. Thexyzproperty and covariant attributes apply this transform lazily on access.- class Attribute(
- loader: Callable[[], 'npt.NDArray'],
- transform_type: PointCloud.AttributeTransformType,
Bases:
objectA lazily-loaded point-cloud attribute together with its transform semantics.
- loader: Callable[[], 'npt.NDArray']#
- transform_type: PointCloud.AttributeTransformType#
- class AttributeTransformType(value)#
Bases:
IntEnumHow an attribute behaves under a rigid transformation.
- DIRECTION = 1#
R @ v (normals, flow directions)
- Type:
Rotate only
- INVARIANT = 0#
Unchanged (rgb, intensity, confidence, label_id, timestamp_us)
- POINT = 2#
R @ p + t (secondary xyz positions)
- Type:
Full rigid
- class CoordinateUnit(value)#
Bases:
IntEnumPhysical unit of the point coordinates.
- METERS = 1#
Metric (meters)
- UNITLESS = 0#
Arbitrary / unknown scale (e.g. SfM reconstruction)
- coordinate_unit: PointCloud.CoordinateUnit#
- get_attribute(name: str) npt.NDArray#
Load and return an attribute, applying the accumulated transform if applicable.
- Raises:
KeyError – if name does not refer to a known attribute.
- get_attribute_transform_type(
- name: str,
Return the
AttributeTransformTypefor name.- Raises:
KeyError – if name does not refer to a known attribute.
- transform(
- target_frame_id: str,
- target_frame_timestamp_us: int,
- pose_graph: PoseGraphInterpolator,
- anchor_frame_id: str = 'world',
Transform this point cloud to a different reference frame.
Signature is aligned with
CuboidTrackObservation.transform().The transform is not applied eagerly – it is stored and applied lazily when
xyzorget_attribute()are accessed.- Parameters:
target_frame_id – ID of the target reference frame.
target_frame_timestamp_us – Timestamp of the target reference frame.
pose_graph – PoseGraphInterpolator to evaluate transformations.
anchor_frame_id – ID of the common anchor frame (default:
"world").
- Returns:
A new PointCloud with updated reference frame and an accumulated lazy transform.
- property xyz: npt.NDArray#
Points in the target reference frame (transform applied lazily).
- class ncore.data.PointCloudsSourceProtocol(*args, **kwargs)#
Bases:
ProtocolUniform access to point clouds from any source (native component, lidar, or radar).
A point-clouds source exposes an indexed sequence of
PointCloudsnapshots, each with its own reference frame and timestamp. Per-pc generic data and metadata are available alongside the typedPointCloudattributes.- get_pc(
- pc_index: int,
Return the point cloud at pc_index as an immutable
PointCloudinstance.Schema-declared attributes are available via
PointCloud.get_attribute().
- get_pc_generic_data( ) npt.NDArray#
Return a generic data array by name for the given point cloud.
Unlike
PointCloudattributes, generic data arrays are not necessarily per-point and do not participate in coordinate-frame transforms.
- get_pc_generic_data_names(
- pc_index: int,
Return the names of all generic data arrays stored for the given point cloud.
- get_pc_generic_meta_data(
- pc_index: int,
Returns generic point cloud meta-data for a specific point-cloud.
- get_pc_index_range( ) range#
Return a range of pc indices following
start:stop:stepslice conventions.Absent bounds default to the full
[0, pcs_count)range.
- has_pc_generic_data( ) bool#
Check whether a named generic data array exists for the given point cloud.
- property pc_timestamps_us: npt.NDArray[np.uint64]#
Snapshot timestamps in microseconds, shape
(pcs_count,).
- class ncore.data.QuantizationParams(
- quantized_dtype: dtype = None,
- scale: float = 1.0,
- offset: float = 0.0,
- intermediate_dtype: dtype = dtype('float64'),
Bases:
DataClassJsonMixinParameters for de-quantizing stored integer data back to physical values.
The physical value is recovered as
value = stored * scale + offset.
- class ncore.data.RadarSensorProtocol(*args, **kwargs)#
Bases:
RayBundleSensorProtocol,ProtocolRadarSensorProtocol provides unified access to a relevant subset of common NCore radar sensor APIs
- class ncore.data.RayBundleSensorPointCloudsSourceAdapter(
- sensor: RayBundleSensorProtocol,
- *,
- return_index: int = 0,
- promote_generic_data: Dict[str,
- GenericDataPromotion]={'rgb': RayBundleSensorPointCloudsSourceAdapter.GenericDataPromotion(shape_suffix=(3,
- ),
- transform_type=<AttributeTransformType.INVARIANT: 0>)},
Bases:
objectAdapts a
RayBundleSensorProtocol(lidar or radar) intoPointCloudsSourceProtocol.Each sensor frame maps to one point cloud. Per-point sensor data (timestamps, valid mask, and – for lidar – intensity and model element) are exposed as lazy
PointCloud.Attributeinstances. Sensor-levelgeneric_datais forwarded throughget_pc_generic_data().Additionally, generic_data entries listed in
promote_generic_dataare auto-promoted toPointCloud.Attributeinstances when their name matches (case-insensitive). By default,"rgb"with shape(N, 3)is promoted. Shape validation happens lazily on first access (ValueError for mismatching shapes).The
timestamp_usattribute holds the per-ray timestamps read for the motion compensation of the point cloud (if the sensor returns them, seeRayBundleSensorProtocol.FramePointCloud.timestamp_us), other attributes are loaded lazily, synchronously, on first access.- Parameters:
sensor – The ray-bundle sensor to adapt.
return_index – Which ray-bundle return to use for multi-return sensors.
promote_generic_data – Generic-data entries to auto-promote to
PointCloud.Attribute. Defaults toDEFAULT_GENERIC_DATA_PROMOTIONS.
- DEFAULT_GENERIC_DATA_PROMOTIONS: Dict[str, GenericDataPromotion] = {'rgb': RayBundleSensorPointCloudsSourceAdapter.GenericDataPromotion(shape_suffix=(3,), transform_type=<AttributeTransformType.INVARIANT: 0>)}#
- class GenericDataPromotion(
- shape_suffix: Tuple[int, ...],
- transform_type: AttributeTransformType = AttributeTransformType.INVARIANT,
Bases:
objectShape suffix and transform type for a promoted
generic_dataframe entry.Used as the value in the
promote_generic_datadict whose keys are the normalised (lowercase) attribute names. Shape validation(N,) + shape_suffixhappens lazily on first attribute access.- transform_type: AttributeTransformType = 0#
- get_pc(
- pc_index: int,
- get_pc_generic_meta_data(
- pc_index: int,
- property pc_timestamps_us: npt.NDArray[np.uint64]#
- class ncore.data.RayBundleSensorProtocol(*args, **kwargs)#
Bases:
SensorProtocol,ProtocolRayBundleSensorProtocol provides unified access to a relevant subset of common NCore ray-bundle sensor APIs
- class FramePointCloud(
- motion_compensation: bool,
- xyz_m_start: npt.NDArray[np.floating] | None,
- xyz_m_end: npt.NDArray[np.floating],
- timestamp_us: npt.NDArray[np.uint64] | None = None,
Bases:
objectContainer for point cloud data with optional motion compensation
- motion_compensation: bool#
Whether coordinates are relative to sensor frame at end-of-frame time (True) or sensor frame at point-time (False)
- timestamp_us: npt.NDArray[np.uint64] | None = None#
Per-ray timestamps [N] read for the motion compensation, or None if not read (e.g., without motion compensation)
- xyz_m_end: npt.NDArray[np.floating]#
Motion-compensated ray segment end points [N,3]
- get_frame_point_cloud( ) FramePointCloud#
Returns a frame-point cloud motion-compensated or non-motion-compensated for a specific frame.
- Parameters:
frame_index – Index of the frame to retrieve
motion_compensation – If True, returns points in sensor frame at end-of-frame time. If False, returns points in sensor frame at point-time
with_start_points – If True, include ray segment start points
return_index – Index of the point cloud return to retrieve (for multi-return sensors)
- Returns:
FramePointCloud containing the point cloud data with requested motion compensation
- get_frame_ray_bundle_count(
- frame_index: int,
Returns the number of rays for a specific frame without decoding it.
- Parameters:
frame_index – Index of the frame
- Returns:
Number of rays for a specific frame
- get_frame_ray_bundle_direction(
- frame_index: int,
Returns the per-ray directions for the ray-bundle for a specific frame.
- Parameters:
frame_index – Index of the frame
- Returns:
Array of per-ray directions [N,3]
- get_frame_ray_bundle_return_count(
- frame_index: int,
Returns the number of different ray returns for a specific frame without decoding it.
- Parameters:
frame_index – Index of the frame
- Returns:
Number of ray returns for a specific frame
- get_frame_ray_bundle_return_distance_m( ) npt.NDArray[np.float32]#
Returns the per-ray measured metric distances for the ray bundle returns of a specific frame.
- Parameters:
frame_index – Index of the frame
return_index – Index of the ray bundle return to retrieve (for multi-return sensors)
- Returns:
Array of per-ray metric distances [N,]
- get_frame_ray_bundle_return_valid_mask( ) npt.NDArray[np.bool_]#
Returns the per-ray valid mask for the ray bundle returns of a specific frame.
- Parameters:
frame_index – Index of the frame
return_index – Index of the ray bundle return to retrieve (for multi-return sensors)
- Returns:
Array of per-ray return valid masks [N]
- class ncore.data.ReferencePolynomial(value)#
Bases:
IntEnumEnumerates different possible reference polynomial types
- BACKWARD = 2#
The backward polynomial is the reference polynomial, the forward polynomial is its (approximate) inverse
- FORWARD = 1#
The forward polynomial is the reference polynomial, the backward polynomial is its (approximate) inverse
- class ncore.data.RowOffsetStructuredSpinningLidarModelParameters(
- spinning_frequency_hz: float,
- spinning_direction: Literal['cw', 'ccw'],
- n_rows: int,
- n_columns: int,
- row_elevations_rad: ndarray = None,
- column_azimuths_rad: ndarray = None,
- row_azimuth_offsets_rad: ndarray = None,
Bases:
StructuredSpinningLidarModelParametersRepresents parameters for a structured spinning lidar model that is using a per-row azimuth-offset (compatible with, e.g., Hesai P128 sensors)
- get_horizontal_fov(
- dtype: npt.DTypeLike = <class 'numpy.float32'>,
Returns the horizontal field-of-view of the lidar model (starting at first element) in the requested dtype precision
- class ncore.data.SensorProtocol(*args, **kwargs)#
Bases:
ProtocolSensorProtocol provides unified access to a relevant subset of common NCore sensor data APIs
- property frames_timestamps_us: npt.NDArray[np.uint64]#
The start/end timestamps of the frames associated with the sensor [(N,2) array]
- get_T_sensor_rig(
- rig_node: str = 'rig',
Return static extrinsic transformation from sensor to named rig coordinate frame.
Returns the 4x4 homogeneous transformation matrix T_sensor_rig that transforms points from the sensor coordinate frame to the rig coordinate frame.
rig_nodedefaults to"rig", the well-known name of the rig frame in NCore pose graphs; pass another node name for sequences that name their rig frame differently. For transformations to other frames, or time-dependent ones, useget_frames_T_source_sensor()/get_frames_T_source_target()directly.- Parameters:
rig_node – Name of the rig coordinate frame (default: “rig”)
- Returns:
4x4 transformation matrix if the static transformation exists, None otherwise
- get_closest_frame_index( ) int#
Given a timestamp, returns the frame index of the closest frame based on the specified relative frame time-point (0.0 ~= start-of-frames / 1.0 ~= end-of-frames)
- get_frame_generic_data( ) npt.NDArray[Any]#
Returns generic frame-data for a specific frame and name
- get_frame_generic_meta_data(
- frame_index: int,
Returns generic frame meta-data for a specific frame
- get_frame_index_range(
- start_frame_index: int | None = None,
- stop_frame_index: int | None = None,
- step_frame_index: int | None = None,
Returns a (potentially empty) range of frame indices following start:stop:step slice conventions, defaulting to full frame index range for absent range bound specifiers
- get_frame_timestamp_us(
- frame_index: int,
- frame_timepoint: FrameTimepoint = FrameTimepoint.END,
Returns the timestamp of a specific frame at the specified relative frame timepoint (start or end)
- get_frames_T_sensor_target(
- target_node: str,
- frame_indices: int | npt.NDArray[np.integer],
- frame_timepoint: FrameTimepoint | None = FrameTimepoint.END,
Evaluates relative poses of the sensor at timestamps inferred from frame indices.
Computes transformation matrices T_sensor_target that transform points from the sensor coordinate frame to the target coordinate frame at specified frame times.
- Parameters:
target_node – Name of the target coordinate frame
frame_indices – Individual index or array of frame indices at which to evaluate poses
frame_timepoint – Frame-relative timepoint (START or END). If None, returns both
- Returns:
Transformation matrices with shape [frame_indices-shape,2,4,4] if frame_timepoint is None (both start and end poses), else [frame_indices-shape,4,4] (single timepoint)
- get_frames_T_source_sensor(
- source_node: str,
- frame_indices: int | npt.NDArray[np.integer],
- frame_timepoint: FrameTimepoint | None = FrameTimepoint.END,
Evaluates relative sensor-relative poses at timestamps inferred from frame indices.
Computes transformation matrices T_source_sensor that transform points from the source coordinate frame to the sensor coordinate frame at specified frame times.
- Parameters:
source_node – Name of the source coordinate frame
frame_indices – Individual index or array of frame indices at which to evaluate poses
frame_timepoint – Frame-relative timepoint (START or END). If None, returns both
- Returns:
Transformation matrices with shape [frame_indices-shape,2,4,4] if frame_timepoint is None (both start and end poses), else [frame_indices-shape,4,4] (single timepoint)
- get_frames_T_source_target(
- source_node: str,
- target_node: str,
- frame_indices: int | npt.NDArray[np.integer],
- frame_timepoint: FrameTimepoint | None = FrameTimepoint.END,
Evaluates relative poses at timestamps inferred from frame indices.
Computes transformation matrices T_source_target that transform points from the source coordinate frame to the target coordinate frame at specified frame times.
- Parameters:
source_node – Name of the source coordinate frame (defaults to sensor_id if None)
target_node – Name of the target coordinate frame
frame_indices – Individual index or array of frame indices at which to evaluate poses
frame_timepoint – Frame-relative timepoint (START or END). If None, returns both
- Returns:
Transformation matrices with shape [frame_indices-shape,2,4,4] if frame_timepoint is None (both start and end poses), else [frame_indices-shape,4,4] (single timepoint)
- get_frames_timestamps_us(
- frame_timepoint: FrameTimepoint = FrameTimepoint.END,
Returns the timestamps of all frames at the specified frame-relative timepoint (start or end) [shape (N,)]
- property pose_graph: PoseGraphInterpolator#
Access the sensor-associated pose graph (usually the sequence-wide one, unless overwritten)
- set_pose_graph(
- pose_graph: PoseGraphInterpolator,
Assigns a new pose graph to the sensor instance (e.g., to overwrite / use a sensor-exclusive pose graph)
- class ncore.data.SequenceLoaderProtocol(*args, **kwargs)#
Bases:
ProtocolSequenceLoaderProtocol provides unified access to a relevant subset of common NCore sequence data APIs
- property generic_meta_data: JsonDocument#
Generic meta-data associated with the sequence
- get_camera_labels(
- camera_label_id: str,
Get a camera label instance by instance ID.
- get_camera_sensor(
- sensor_id: str,
Returns a camera sensor instance for a given sensor id
- get_cuboid_track_observations(
- timestamp_interval_us: HalfClosedInterval | None = None,
Returns all available cuboid track observations in the sequence.
- Parameters:
timestamp_interval_us – If provided, only observations whose
timestamp_usfalls within this half-closed interval[start, stop)are returned. WhenNone(default), all observations are returned.
- get_lidar_sensor(
- sensor_id: str,
Returns a lidar sensor instance for a given sensor id
- get_point_clouds_source( ) PointCloudsSourceProtocol#
Returns a point-clouds source for a given source id.
For native point-clouds sources,
return_indexis ignored. For lidar/radar-adapted sources,return_indexselects the ray-bundle return.
- get_radar_sensor(
- sensor_id: str,
Returns a radar sensor instance for a given sensor id
- get_sequence_meta() JsonDocument#
Returns sequence-wide meta-data summary as a JSON document (format is instance-dependent, e.g. the dictionary of a
SequenceMetafor V4 loaders)
- property pose_graph: PoseGraphInterpolator#
The pose graph representing all static and dynamic transformations in the sequence
- query_camera_labels(
- camera_id: str,
- label_type: LabelType | None = None,
- label_category: LabelCategory | None = None,
Query camera label instances matching filters.
- Parameters:
camera_id – Camera ID to match.
label_type – If provided, only return sources with this exact label type.
label_category – If provided, only return sources whose label type category matches.
- reload_resources() None#
Reloads any resources used by the internal sequence loader (potentially required for multi-process data loading)
- property sequence_paths: List[UPath]#
List of all dataset paths comprising this sequence (shards / components)
- property sequence_timestamp_interval_us: HalfClosedInterval#
The time range of the sequence in microseconds
- class ncore.data.ShutterType(value)#
Bases:
IntEnumEnumerates different possible camera imager shutter types
- GLOBAL = 5#
Instantaneous global shutter (no rolling shutter)
- ROLLING_BOTTOM_TO_TOP = 3#
Rolling shutter from bottom to top of the imager
- ROLLING_LEFT_TO_RIGHT = 2#
Rolling shutter from left to right of the imager
- ROLLING_RIGHT_TO_LEFT = 4#
Rolling shutter from right to left of the imager
- ROLLING_TOP_TO_BOTTOM = 1#
Rolling shutter from top to bottom of the imager
- class ncore.data.SpinningLidarModelParameters( )#
Bases:
LidarModelParametersRepresents parameters common to all spinning lidar models
- class ncore.data.StructuredSpinningLidarModelParameters(
- spinning_frequency_hz: float,
- spinning_direction: Literal['cw', 'ccw'],
- n_rows: int,
- n_columns: int,
Bases:
SpinningLidarModelParametersRepresents parameters for a structured spinning lidar model.
A structured lidar model consists of a fixed number of rows x columns point measurements per frame
- ncore.data.register_camera_model_parameters(
- parameters_class: Type[CameraModelParametersT],
Registers a concrete camera model parameters class for deserialization
Usable as a class decorator. The class is keyed by its
type()identifier, which is what the serialized form carries incamera_model_type, so that a model registered out of tree round-trips throughdecode_camera_model_parameters()as the in-tree ones do.This is the deserialization counterpart to
ncore.sensors.register_camera_model(), which registers the model built from these parameters. A model that is registered but whose parameters are not can be constructed in memory yet not read back from storage.
- ncore.data.register_external_distortion_parameters(
- parameters_class: Type[ExternalDistortionParametersT],
Registers a concrete external distortion parameters class for deserialization
Usable as a class decorator. The class is keyed by its
type()identifier, which is what the serialized form carries, so that out-of-tree external distortion parameters round-trip throughCameraModelParameters.from_dict()as well as the in-tree ones.
- ncore.data.register_lidar_model_parameters(
- parameters_class: Type[LidarModelParametersT],
Registers a concrete lidar model parameters class for deserialization
The lidar counterpart to
register_camera_model_parameters(), keyed bytype()and read back bydecode_lidar_model_parameters().
JSON Types#
- ncore.data.Json#
A JSON value as read (e.g., attributes of nodes): of concrete types, dictionaries and lists. alias of
Dict[str,Json] |List[Json] |str|int|float|bool|None
- ncore.data.JsonDocument#
A JSON document as read (a dictionary at the top level). alias of
Dict[str,Dict[str,Json] |List[Json] |str|int|float|bool|None]
- ncore.data.JsonLike#
A JSON-like value to write (e.g., attributes of nodes): of any mappings / sequences of JSON-like values (e.g., read-only mappings, tuples), written as JSON objects / arrays. JSON values are JSON-like. alias of
Mapping[str,JsonLike] |Sequence[JsonLike] |str|int|float|bool|None