XREALCameraDevice Class

Description

XREALCameraDevice实现了一个基于XREAL Enterprise Native SDK Plugin的camera设备,输出 InputFrame (不可获取图像、摄像机参数、时间戳、6DOF位置信息和跟踪状态)。

创建之后,可以调用start/stop来开始和停止采集视频流数据。需要确保在isDeviceSupported返回true之后才能调用start。

当不再需要该设备时,可以调用close对其进行关闭。close之后不应继续使用。

XREALCameraDevice通过inputFrameSource输出 InputFrame ,应将inputFrameSource连接到 InputFrameSink 上进行使用。参考 概览

bufferCapacity表示 InputFrame 缓冲的容量,如果有超过此数量的 InputFrame 从该设备中输出并且没有被释放,该设备将不再输出新的 InputFrame ,直到之前的 InputFrame 被释放。这可能造成画面卡住等问题。参考 概览

Constructor

C

void easyar_XREALCameraDevice__ctor(easyar_XREALCameraDevice * * Return)

C++

XREALCameraDevice()

Java

public XREALCameraDevice()

Kotlin

constructor()

Objective-C

+ (easyar_XREALCameraDevice *) create

Swift

public convenience init()

C#

public XREALCameraDevice()

isAvailable

检查是否可用。只在支持XREAL眼镜的设备上且成功连接XREAL眼镜之后返回true。

C

bool easyar_XREALCameraDevice_isAvailable(void)

C++

static bool isAvailable()

Java

public static boolean isAvailable()

Kotlin

companion object fun isAvailable(): Boolean

Objective-C

+ (bool)isAvailable

Swift

public static func isAvailable() -> Bool

C#

public static bool isAvailable()

isDeviceSupported

检查眼镜是否被支持。在可用的设备上,只有XREAL完成初始化之后有值。

C

easyar_OptionalOfBool easyar_XREALCameraDevice_isDeviceSupported(void)

C++

static std::optional<bool> isDeviceSupported()

Java

public static java.lang.@Nullable Boolean isDeviceSupported()

Kotlin

companion object fun isDeviceSupported(): Boolean?

Objective-C

+ (NSNumber *)isDeviceSupported

Swift

public static func isDeviceSupported() -> Bool?

C#

public static Optional<bool> isDeviceSupported()

bufferCapacity

InputFrame 缓冲的容量,默认值为8。

C

int easyar_XREALCameraDevice_bufferCapacity(const easyar_XREALCameraDevice * This)

C++

int bufferCapacity()

Java

public int bufferCapacity()

Kotlin

fun bufferCapacity(): Int

Objective-C

- (int)bufferCapacity

Swift

public func bufferCapacity() -> Int32

C#

public virtual int bufferCapacity()

setBufferCapacity

设置 InputFrame 缓冲的容量。

C

void easyar_XREALCameraDevice_setBufferCapacity(easyar_XREALCameraDevice * This, int capacity)

C++

void setBufferCapacity(int capacity)

Java

public void setBufferCapacity(int capacity)

Kotlin

fun setBufferCapacity(capacity: Int): Unit

Objective-C

- (void)setBufferCapacity:(int)capacity

Swift

public func setBufferCapacity(_ capacity: Int32) -> Void

C#

public virtual void setBufferCapacity(int capacity)

inputFrameSource

InputFrame 输出端口。

C

void easyar_XREALCameraDevice_inputFrameSource(const easyar_XREALCameraDevice * This, easyar_InputFrameSource * * Return)

C++

std::shared_ptr<InputFrameSource> inputFrameSource()

Java

public @Nonnull InputFrameSource inputFrameSource()

Kotlin

fun inputFrameSource(): InputFrameSource

Objective-C

- (easyar_InputFrameSource *)inputFrameSource

Swift

public func inputFrameSource() -> InputFrameSource

C#

public virtual InputFrameSource inputFrameSource()

getMotionInputData

获取同步的运动输入数据。在isDeviceSupported返回true之后使用。

C

void easyar_XREALCameraDevice_getMotionInputData(const easyar_XREALCameraDevice * This, easyar_OptionalOfMotionInputData * Return)

C++

std::optional<std::shared_ptr<MotionInputData>> getMotionInputData()

Java

public @Nullable MotionInputData getMotionInputData()

Kotlin

fun getMotionInputData(): MotionInputData?

Objective-C

- (easyar_MotionInputData *)getMotionInputData

Swift

public func getMotionInputData() -> MotionInputData?

C#

public virtual Optional<MotionInputData> getMotionInputData()

receivedFrameCount

从相机获取到的帧数。在start之后它应该持续增加,否则可能设备连接不稳定或XREAL服务/SDK工作不正常,这时需要直接从XREAL官方获取帮助。

C

int easyar_XREALCameraDevice_receivedFrameCount(const easyar_XREALCameraDevice * This)

C++

int receivedFrameCount()

Java

public int receivedFrameCount()

Kotlin

fun receivedFrameCount(): Int

Objective-C

- (int)receivedFrameCount

Swift

public func receivedFrameCount() -> Int32

C#

public virtual int receivedFrameCount()

open

打开camera设备。在isDeviceSupported返回true之后使用。在Air2 Ultra等设备上,XREAL 许可证必须先通过XREAL官方方法完成校验。

C

bool easyar_XREALCameraDevice_open(easyar_XREALCameraDevice * This)

C++

bool open()

Java

public boolean open()

Kotlin

fun open(): Boolean

Objective-C

- (bool)open

Swift

public func `open`() -> Bool

C#

public virtual bool open()

getXREALError

获取XREAL错误,一般在open失败时可以查询是否有XREAL相关错误。

C

easyar_OptionalOfXREALError easyar_XREALCameraDevice_getXREALError(const easyar_XREALCameraDevice * This)

C++

std::optional<XREALError> getXREALError()

Java

public @Nullable Integer getXREALError()

Kotlin

fun getXREALError(): Int?

Objective-C

- (NSNumber *)getXREALError

Swift

public func getXREALError() -> XREALError?

C#

public virtual Optional<XREALError> getXREALError()

start

开始采集视频流数据。

C

bool easyar_XREALCameraDevice_start(easyar_XREALCameraDevice * This)

C++

bool start()

Java

public boolean start()

Kotlin

fun start(): Boolean

Objective-C

- (bool)start

Swift

public func start() -> Bool

C#

public virtual bool start()

stop

停止采集视频流数据。

C

void easyar_XREALCameraDevice_stop(easyar_XREALCameraDevice * This)

C++

void stop()

Java

public void stop()

Kotlin

fun stop(): Unit

Objective-C

- (void)stop

Swift

public func stop() -> Void

C#

public virtual void stop()

close

关闭。close之后不应继续使用。

C

void easyar_XREALCameraDevice_close(easyar_XREALCameraDevice * This)

C++

void close()

Java

public void close()

Kotlin

fun close(): Unit

Objective-C

- (void)close

Swift

public func close() -> Void

C#

public virtual void close()

type

camera类型。在成功的open之后调用。

C

easyar_CameraDeviceType easyar_XREALCameraDevice_type(const easyar_XREALCameraDevice * This)

C++

CameraDeviceType type()

Java

public int type()

Kotlin

fun type(): Int

Objective-C

- (easyar_CameraDeviceType)type

Swift

public func type() -> CameraDeviceType

C#

public virtual CameraDeviceType type()

cameraOrientation

camera图像在设备的自然方向上显示时需要顺时针旋转的角度。在成功的open之后调用。

C

int easyar_XREALCameraDevice_cameraOrientation(const easyar_XREALCameraDevice * This)

C++

int cameraOrientation()

Java

public int cameraOrientation()

Kotlin

fun cameraOrientation(): Int

Objective-C

- (int)cameraOrientation

Swift

public func cameraOrientation() -> Int32

C#

public virtual int cameraOrientation()

size

获取当前图像大小。在成功的open之后调用。

C

easyar_Vec2I easyar_XREALCameraDevice_size(const easyar_XREALCameraDevice * This)

C++

Vec2I size()

Java

public @Nonnull Vec2I size()

Kotlin

fun size(): Vec2I

Objective-C

- (easyar_Vec2I *)size

Swift

public func size() -> Vec2I

C#

public virtual Vec2I size()

frameRate

获取当前帧率。在成功的open之后调用。

C

double easyar_XREALCameraDevice_frameRate(const easyar_XREALCameraDevice * This)

C++

double frameRate()

Java

public double frameRate()

Kotlin

fun frameRate(): Double

Objective-C

- (double)frameRate

Swift

public func frameRate() -> Double

C#

public virtual double frameRate()