ARCoreCameraDevice Class¶
Description¶
ARCoreCameraDevice实现了一个基于ARCore的camera设备,输出 InputFrame (包含图像、摄像机参数、时间戳、6DOF位置信息和跟踪状态)。
使用时需要先使用java.lang.System.loadLibrary加载libarcore_sdk_c.so。
创建之后,可以调用start/stop来开始和停止采集视频流数据。
当不再需要该设备时,可以调用close对其进行关闭。close之后不应继续使用。
ARCoreCameraDevice通过inputFrameSource输出 InputFrame ,应将inputFrameSource连接到 InputFrameSink 上进行使用。参考 概览 。
bufferCapacity表示 InputFrame 缓冲的容量,如果有超过此数量的 InputFrame 从该设备中输出并且没有被释放,该设备将不再输出新的 InputFrame ,直到之前的 InputFrame 被释放。这可能造成画面卡住等问题。参考 概览 。
注意:当前ARCore(v1.13.0)的实现在创建和销毁session时存在内存泄漏,多次创建和销毁会导致内存占用不断增长且销毁后也不释放。
Constructor¶
- C
void easyar_ARCoreCameraDevice__ctor(easyar_ARCoreCameraDevice * * Return)
- C++
ARCoreCameraDevice()
- Java
public ARCoreCameraDevice()
- Kotlin
constructor()
- Objective-C
+ (easyar_ARCoreCameraDevice *) create
- Swift
public convenience init()
- C#
public ARCoreCameraDevice()
isAvailable¶
检查是否可用。只在Android系统上并安装了ARCore时返回true。
在没有加载libarcore_sdk_c.so时调用会返回false。
注意:如果设备不支持ARCore,但却通过旁加载方式安装了ARCore的apk,则该函数会返回true,但ARCore不能正常使用。
- C
bool easyar_ARCoreCameraDevice_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¶
检查当前设备是否支持。
- C
bool easyar_ARCoreCameraDevice_isDeviceSupported(void)
- C++
static bool isDeviceSupported()
- Java
public static boolean isDeviceSupported()
- Kotlin
companion object fun isDeviceSupported(): Boolean
- Objective-C
+ (bool)isDeviceSupported
- Swift
public static func isDeviceSupported() -> Bool
- C#
public static bool isDeviceSupported()
bufferCapacity¶
InputFrame 缓冲的容量,默认值为8。
- C
int easyar_ARCoreCameraDevice_bufferCapacity(const easyar_ARCoreCameraDevice * 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_ARCoreCameraDevice_setBufferCapacity(easyar_ARCoreCameraDevice * 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_ARCoreCameraDevice_inputFrameSource(easyar_ARCoreCameraDevice * 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()
inputFrameSourceType¶
InputFrame来源类型。
- C
easyar_InputFrameSourceType easyar_ARCoreCameraDevice_inputFrameSourceType(easyar_ARCoreCameraDevice * This)
- C++
InputFrameSourceType inputFrameSourceType()
- Java
public int inputFrameSourceType()
- Kotlin
fun inputFrameSourceType(): Int
- Objective-C
- (easyar_InputFrameSourceType)inputFrameSourceType
- Swift
public func inputFrameSourceType() -> InputFrameSourceType
- C#
public virtual InputFrameSourceType inputFrameSourceType()
setFocusMode¶
设置对焦模式为focusMode。在start之前调用。
- C
void easyar_ARCoreCameraDevice_setFocusMode(easyar_ARCoreCameraDevice * This, easyar_ARCoreCameraDeviceFocusMode focusMode)
- C++
void setFocusMode(ARCoreCameraDeviceFocusMode focusMode)
- Java
public void setFocusMode(int focusMode)
- Kotlin
fun setFocusMode(focusMode: Int): Unit
- Objective-C
- (void)setFocusMode:(easyar_ARCoreCameraDeviceFocusMode)focusMode
- Swift
public func setFocusMode(_ focusMode: ARCoreCameraDeviceFocusMode) -> Void
- C#
public virtual void setFocusMode(ARCoreCameraDeviceFocusMode focusMode)
start¶
开始采集视频流数据。
- C
bool easyar_ARCoreCameraDevice_start(easyar_ARCoreCameraDevice * 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_ARCoreCameraDevice_stop(easyar_ARCoreCameraDevice * 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_ARCoreCameraDevice_close(easyar_ARCoreCameraDevice * 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()