Skip to main content
API Reference SwiftyNsdk

NsdkObjectDetectionSession


Declaration

final class NsdkObjectDetectionSession

Properties

NameTypeSummary
var classNamesObjectDetectionClassNamesBuffer
Returns the list of possible object detection classifications, if available.
Reads from the currently loaded native model and returns its data.
- Returns: The list of possible object detection classifications, or nil if not available.

Methods

NameTypeSummary
configurevoid
Configures the session with the specified settings.
- Attention: This method must be called while the session is stopped,
or else configuration will fail. In that case, while this function returns without
throwing, configuration will still fail asynchronously. Use featureStatus()
to check that configuration has not failed.
- Parameter config: An object that defines this session's behavior.
Only settings that differ from the defaults will be applied.
- Throws: NsdkError.invalidArgument if the configuration is invalid.
Check NSDK's C logs for more information.
featureStatusNsdkFeatureStatus
Reports the current status of the object detection feature.
This method can be used to detect errors that have occurred within the feature’s
internal processes. Once an error is flagged, it will remain flagged until the
relevant process has been rerun and completed successfully.
Typical usage is to call this at the beginning of a session to check whether
object detection is still initializing or if a previous failure has occurred.
- Returns: An NsdkFeatureStatus value
latestDetectionsNsdkAsyncState<ObjectDetectionResult, AwarenessError>
Retrieves the latest object detection results from the object detection session.
- Returns: An NsdkAsyncState containing either the latest ObjectDetectionResult,
or an AwarenessError.
metadataNsdkAsyncState<ObjectDetectionMetadata, AwarenessError>
Retrieves the metadata for object detection.
- Returns: An NsdkAsyncState containing either the latest ObjectDetectionMetadata,
or an AwarenessError.
modelToImageTransformCGAffineTransform?
Returns an affine transform that maps coordinates from the model's frame to the image frame,
accounting for the model image being rotated to align with gravity, while the source image
is always oriented in landscape.
- Parameter orientation: The gravity aligned interface orientation.
- Returns: A CGAffineTransform to convert model coordinates to image coordinates,
or nil if the model frame size, source frame size, or orientation is unavailable.
startvoid
Starts the object detection session.
stopvoid
Stops the object detection session.
After stopping, the session can be reconfigured and restarted.

Nested Types

Structs

NameTypeSummary
ConfigurationConfiguration
Configuration structure for the object detection session.

Relationships

conforms to: NsdkFeatureSession