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