Table of Contents

Class XREALCameraDevice

命名空间
easyar

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 被释放。这可能造成画面卡住等问题。

XREALCameraDevice

构造函数

XREALCameraDevice

void easyar_XREALCameraDevice__ctor(easyar_XREALCameraDevice * * Return)
XREALCameraDevice()
public XREALCameraDevice()
constructor()
+ (easyar_XREALCameraDevice *) create
public convenience init()
public XREALCameraDevice()

方法

isAvailable

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

bool easyar_XREALCameraDevice_isAvailable(void)
static bool isAvailable()
public static boolean isAvailable()
companion object fun isAvailable(): Boolean
+ (bool)isAvailable
public static func isAvailable() -> Bool
public static bool isAvailable()

返回

类型 描述
Boolean

isDeviceSupported

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

easyar_OptionalOfBool easyar_XREALCameraDevice_isDeviceSupported(void)
static std::optional<bool> isDeviceSupported()
public static java.lang.@Nullable Boolean isDeviceSupported()
companion object fun isDeviceSupported(): Boolean?
+ (NSNumber *)isDeviceSupported
public static func isDeviceSupported() -> Bool?
public static Optional<bool> isDeviceSupported()

返回

类型 描述
Optional<>

bufferCapacity

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

int easyar_XREALCameraDevice_bufferCapacity(const easyar_XREALCameraDevice * This)
int bufferCapacity()
public int bufferCapacity()
fun bufferCapacity(): Int
- (int)bufferCapacity
public func bufferCapacity() -> Int32
public virtual int bufferCapacity()

返回

类型 描述
Int32

setBufferCapacity

设置 InputFrame 缓冲的容量。

void easyar_XREALCameraDevice_setBufferCapacity(easyar_XREALCameraDevice * This, int capacity)
void setBufferCapacity(int capacity)
public void setBufferCapacity(int capacity)
fun setBufferCapacity(capacity: Int): Unit
- (void)setBufferCapacity:(int)capacity
public func setBufferCapacity(_ capacity: Int32) -> Void
public virtual void setBufferCapacity(int capacity)

参数

名称 类型 描述
capacity Int32

返回

类型 描述
Void

inputFrameSource

InputFrame 输出端口。

void easyar_XREALCameraDevice_inputFrameSource(const easyar_XREALCameraDevice * This, easyar_InputFrameSource * * Return)
std::shared_ptr<InputFrameSource> inputFrameSource()
public @Nonnull InputFrameSource inputFrameSource()
fun inputFrameSource(): InputFrameSource
- (easyar_InputFrameSource *)inputFrameSource
public func inputFrameSource() -> InputFrameSource
public virtual InputFrameSource inputFrameSource()

返回

类型 描述
InputFrameSource

getMotionInputData

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

void easyar_XREALCameraDevice_getMotionInputData(const easyar_XREALCameraDevice * This, easyar_OptionalOfMotionInputData * Return)
std::optional<std::shared_ptr<MotionInputData>> getMotionInputData()
public @Nullable MotionInputData getMotionInputData()
fun getMotionInputData(): MotionInputData?
- (easyar_MotionInputData *)getMotionInputData
public func getMotionInputData() -> MotionInputData?
public virtual Optional<MotionInputData> getMotionInputData()

返回

类型 描述
Optional<MotionInputData>

receivedFrameCount

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

int easyar_XREALCameraDevice_receivedFrameCount(const easyar_XREALCameraDevice * This)
int receivedFrameCount()
public int receivedFrameCount()
fun receivedFrameCount(): Int
- (int)receivedFrameCount
public func receivedFrameCount() -> Int32
public virtual int receivedFrameCount()

返回

类型 描述
Int32

open

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

bool easyar_XREALCameraDevice_open(easyar_XREALCameraDevice * This)
bool open()
public boolean open()
fun open(): Boolean
- (bool)open
public func `open`() -> Bool
public virtual bool open()

返回

类型 描述
Boolean

start

开始采集视频流数据。

bool easyar_XREALCameraDevice_start(easyar_XREALCameraDevice * This)
bool start()
public boolean start()
fun start(): Boolean
- (bool)start
public func start() -> Bool
public virtual bool start()

返回

类型 描述
Boolean

stop

停止采集视频流数据。

void easyar_XREALCameraDevice_stop(easyar_XREALCameraDevice * This)
void stop()
public void stop()
fun stop(): Unit
- (void)stop
public func stop() -> Void
public virtual void stop()

返回

类型 描述
Void

close

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

void easyar_XREALCameraDevice_close(easyar_XREALCameraDevice * This)
void close()
public void close()
fun close(): Unit
- (void)close
public func close() -> Void
public virtual void close()

返回

类型 描述
Void

type

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

easyar_CameraDeviceType easyar_XREALCameraDevice_type(const easyar_XREALCameraDevice * This)
CameraDeviceType type()
public int type()
fun type(): Int
- (easyar_CameraDeviceType)type
public func type() -> CameraDeviceType
public virtual CameraDeviceType type()

返回

类型 描述
CameraDeviceType

cameraOrientation

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

int easyar_XREALCameraDevice_cameraOrientation(const easyar_XREALCameraDevice * This)
int cameraOrientation()
public int cameraOrientation()
fun cameraOrientation(): Int
- (int)cameraOrientation
public func cameraOrientation() -> Int32
public virtual int cameraOrientation()

返回

类型 描述
Int32

size

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

easyar_Vec2I easyar_XREALCameraDevice_size(const easyar_XREALCameraDevice * This)
Vec2I size()
public @Nonnull Vec2I size()
fun size(): Vec2I
- (easyar_Vec2I *)size
public func size() -> Vec2I
public virtual Vec2I size()

返回

类型 描述
Vec2I

frameRate

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

double easyar_XREALCameraDevice_frameRate(const easyar_XREALCameraDevice * This)
double frameRate()
public double frameRate()
fun frameRate(): Double
- (double)frameRate
public func frameRate() -> Double
public virtual double frameRate()

返回

类型 描述
Double