Class CameraDevice
CameraDevice implements a camera device that outputs InputFrame (including image, camera parameters, and timestamp). It is available on Windows, Mac, Android, and iOS. After opening, start/stop can be called to start and stop data collection. start/stop do not affect previously set camera parameters. When the device is no longer needed, close can be called to close it. It should not be used after close. CameraDevice outputs InputFrame through inputFrameSource. inputFrameSource should be connected to InputFrameSink for use. bufferCapacity indicates the capacity of the InputFrame buffer. If more than this number of InputFrame objects are output from the device and not released, the device will stop outputting new InputFrame objects until previous InputFrame objects are released. This may cause problems such as a frozen image. When used on Android, the android.permission.CAMERA permission declaration must be added to AndroidManifest.xml. When used on iOS, the NSCameraUsageDescription permission declaration must be added to Info.plist.
CameraDevice
생성자
CameraDevice
void easyar_CameraDevice__ctor(easyar_CameraDevice * * Return)
+ (easyar_CameraDevice *) create
public convenience init()
메서드
isAvailable
확인합니다 whether it is available. Returns true only on Windows, Mac, Android, and iOS.
bool easyar_CameraDevice_isAvailable(void)
static bool isAvailable()
public static boolean isAvailable()
companion object fun isAvailable(): Boolean
public static func isAvailable() -> Bool
public static bool isAvailable()
반환 값
androidCameraApiType
On Android, this can be used to get the Camera API in use (camera1 or camera2). camera1 has better compatibility, but lacks some necessary information such as timestamp. camera2 has compatibility issues on some devices.
easyar_AndroidCameraApiType easyar_CameraDevice_androidCameraApiType(easyar_CameraDevice * This)
AndroidCameraApiType androidCameraApiType()
public int androidCameraApiType()
fun androidCameraApiType(): Int
- (easyar_AndroidCameraApiType)androidCameraApiType
public func androidCameraApiType() -> AndroidCameraApiType
public virtual AndroidCameraApiType androidCameraApiType()
반환 값
setAndroidCameraApiType
On Android, this can be used to set the Camera API in use (Camera 1 or Camera 2). It must be set before calling openWithIndex, openWithSpecificType, or openWithPreferredType; otherwise it will not take effect. It is recommended to use CameraDeviceSelector to create a CameraDevice with the recommended Camera API set according to the main algorithm in use.
void easyar_CameraDevice_setAndroidCameraApiType(easyar_CameraDevice * This, easyar_AndroidCameraApiType type)
void setAndroidCameraApiType(AndroidCameraApiType type)
public void setAndroidCameraApiType(int type)
fun setAndroidCameraApiType(type: Int): Unit
- (void)setAndroidCameraApiType:(easyar_AndroidCameraApiType)type
public func setAndroidCameraApiType(_ type: AndroidCameraApiType) -> Void
public virtual void setAndroidCameraApiType(AndroidCameraApiType type)
매개 변수
반환 값
bufferCapacity
Capacity of the InputFrame buffer. The default value is 8.
int easyar_CameraDevice_bufferCapacity(const easyar_CameraDevice * This)
public int bufferCapacity()
fun bufferCapacity(): Int
public func bufferCapacity() -> Int32
public virtual int bufferCapacity()
반환 값
setBufferCapacity
void easyar_CameraDevice_setBufferCapacity(easyar_CameraDevice * 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)
매개 변수
반환 값
void easyar_CameraDevice_inputFrameSource(easyar_CameraDevice * 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()
반환 값
setStateChangedCallback
설정합니다 the status change callback to notify camera disconnection or preemption state. Effective only on Windows.
void easyar_CameraDevice_setStateChangedCallback(easyar_CameraDevice * This, easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromCameraState stateChangedCallback)
void setStateChangedCallback(std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(CameraState)>> stateChangedCallback)
public void setStateChangedCallback(@Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromCameraState stateChangedCallback)
fun setStateChangedCallback(callbackScheduler: CallbackScheduler, stateChangedCallback: FunctorOfVoidFromCameraState?): Unit
- (void)setStateChangedCallback:(easyar_CallbackScheduler *)callbackScheduler stateChangedCallback:(void (^)(easyar_CameraState))stateChangedCallback
public func setStateChangedCallback(_ callbackScheduler: CallbackScheduler, _ stateChangedCallback: ((CameraState) -> Void)?) -> Void
public virtual void setStateChangedCallback(CallbackScheduler callbackScheduler, Optional<Action<CameraState>> stateChangedCallback)
매개 변수
반환 값
requestPermissions
요청합니다 camera system permission. You can choose to use this function or request permission yourself. Effective only on Android and iOS; on other platforms, the callback is called directly to notify that permission has been granted. This function should be called on the UI thread.
void easyar_CameraDevice_requestPermissions(easyar_CallbackScheduler * callbackScheduler, easyar_OptionalOfFunctorOfVoidFromPermissionStatusAndString permissionCallback)
static void requestPermissions(std::shared_ptr<CallbackScheduler> callbackScheduler, std::optional<std::function<void(PermissionStatus, std::string)>> permissionCallback)
public static void requestPermissions(@Nonnull CallbackScheduler callbackScheduler, @Nullable FunctorOfVoidFromPermissionStatusAndString permissionCallback)
companion object fun requestPermissions(callbackScheduler: CallbackScheduler, permissionCallback: FunctorOfVoidFromPermissionStatusAndString?): Unit
+ (void)requestPermissions:(easyar_CallbackScheduler *)callbackScheduler permissionCallback:(void (^)(easyar_PermissionStatus status, NSString * value))permissionCallback
public static func requestPermissions(_ callbackScheduler: CallbackScheduler, _ permissionCallback: ((PermissionStatus, String) -> Void)?) -> Void
public static void requestPermissions(CallbackScheduler callbackScheduler, Optional<Action<PermissionStatus, string>> permissionCallback)
매개 변수
반환 값
cameraCount
가져옵니다 the number of cameras recognized by the operating system.
int easyar_CameraDevice_cameraCount(void)
public static int cameraCount()
companion object fun cameraCount(): Int
public static func cameraCount() -> Int32
public static int cameraCount()
반환 값
openWithIndex
엽니다 a camera device by camera index.
bool easyar_CameraDevice_openWithIndex(easyar_CameraDevice * This, int cameraIndex)
bool openWithIndex(int cameraIndex)
public boolean openWithIndex(int cameraIndex)
fun openWithIndex(cameraIndex: Int): Boolean
- (bool)openWithIndex:(int)cameraIndex
public func openWithIndex(_ cameraIndex: Int32) -> Bool
public virtual bool openWithIndex(int cameraIndex)
매개 변수
| 이름 |
형식 |
설명 |
| cameraIndex |
Int32 |
|
반환 값
openWithSpecificType
엽니다 a camera device by exact camera device type. If no matching type exists, returns false. On Mac, camera type cannot be identified.
bool easyar_CameraDevice_openWithSpecificType(easyar_CameraDevice * This, easyar_CameraDeviceType type)
bool openWithSpecificType(CameraDeviceType type)
public boolean openWithSpecificType(int type)
fun openWithSpecificType(type: Int): Boolean
- (bool)openWithSpecificType:(easyar_CameraDeviceType)type
public func openWithSpecificType(_ type: CameraDeviceType) -> Bool
public virtual bool openWithSpecificType(CameraDeviceType type)
매개 변수
반환 값
openWithPreferredType
엽니다 a camera device by camera device type. If no matching type exists, it tries to open the first camera device.
bool easyar_CameraDevice_openWithPreferredType(easyar_CameraDevice * This, easyar_CameraDeviceType type)
bool openWithPreferredType(CameraDeviceType type)
public boolean openWithPreferredType(int type)
fun openWithPreferredType(type: Int): Boolean
- (bool)openWithPreferredType:(easyar_CameraDeviceType)type
public func openWithPreferredType(_ type: CameraDeviceType) -> Bool
public virtual bool openWithPreferredType(CameraDeviceType type)
매개 변수
반환 값
start
bool easyar_CameraDevice_start(easyar_CameraDevice * This)
public func start() -> Bool
public virtual bool start()
반환 값
stop
중지합니다 collecting data. This method only stops image capture; all parameters and connections are not affected.
void easyar_CameraDevice_stop(easyar_CameraDevice * This)
public func stop() -> Void
public virtual void stop()
반환 값
close
닫습니다 the camera. It should not be used after close.
void easyar_CameraDevice_close(easyar_CameraDevice * This)
public func close() -> Void
public virtual void close()
반환 값
index
camera index. Call after successful open.
int easyar_CameraDevice_index(const easyar_CameraDevice * This)
public func index() -> Int32
public virtual int index()
반환 값
type
camera type. Call after successful open.
easyar_CameraDeviceType easyar_CameraDevice_type(const easyar_CameraDevice * This)
- (easyar_CameraDeviceType)type
public func type() -> CameraDeviceType
public virtual CameraDeviceType type()
반환 값
cameraOrientation
The clockwise rotation angle required when displaying the camera image in the device natural orientation. Call after successful open.
int easyar_CameraDevice_cameraOrientation(const easyar_CameraDevice * This)
public int cameraOrientation()
fun cameraOrientation(): Int
public func cameraOrientation() -> Int32
public virtual int cameraOrientation()
반환 값
cameraParameters
camera parameters, including image size, focal length, principal point, camera type, and the rotation angle of the camera relative to the device natural orientation. Call after successful open.
void easyar_CameraDevice_cameraParameters(easyar_CameraDevice * This, easyar_CameraParameters * * Return)
std::shared_ptr<CameraParameters> cameraParameters()
public @Nonnull CameraParameters cameraParameters()
fun cameraParameters(): CameraParameters
- (easyar_CameraParameters *)cameraParameters
public func cameraParameters() -> CameraParameters
public virtual CameraParameters cameraParameters()
반환 값
setCameraParameters
설정합니다 camera parameters. Call after successful open.
void easyar_CameraDevice_setCameraParameters(easyar_CameraDevice * This, easyar_CameraParameters * cameraParameters)
void setCameraParameters(std::shared_ptr<CameraParameters> cameraParameters)
public void setCameraParameters(@Nonnull CameraParameters cameraParameters)
fun setCameraParameters(cameraParameters: CameraParameters): Unit
- (void)setCameraParameters:(easyar_CameraParameters *)cameraParameters
public func setCameraParameters(_ cameraParameters: CameraParameters) -> Void
public virtual void setCameraParameters(CameraParameters cameraParameters)
매개 변수
반환 값
size
가져옵니다 the current image size. Call after successful open.
easyar_Vec2I easyar_CameraDevice_size(const easyar_CameraDevice * This)
public @Nonnull Vec2I size()
public func size() -> Vec2I
public virtual Vec2I size()
반환 값
supportedSizeCount
가져옵니다 the number of all image sizes supported by the current device. Call after successful open.
int easyar_CameraDevice_supportedSizeCount(const easyar_CameraDevice * This)
public int supportedSizeCount()
fun supportedSizeCount(): Int
- (int)supportedSizeCount
public func supportedSizeCount() -> Int32
public virtual int supportedSizeCount()
반환 값
supportedSize
가져옵니다 the index-th image size among all image sizes supported by the current device. If index is out of range, returns {0, 0}. Call after successful open.
easyar_Vec2I easyar_CameraDevice_supportedSize(const easyar_CameraDevice * This, int index)
Vec2I supportedSize(int index)
public @Nonnull Vec2I supportedSize(int index)
fun supportedSize(index: Int): Vec2I
- (easyar_Vec2I *)supportedSize:(int)index
public func supportedSize(_ index: Int32) -> Vec2I
public virtual Vec2I supportedSize(int index)
매개 변수
반환 값
setSize
설정합니다 the current image size. The available value closest to the set value will be used. The actual size can be obtained with size. Call after successful open. frameRateRange may change after setting size.
bool easyar_CameraDevice_setSize(easyar_CameraDevice * This, easyar_Vec2I size)
public boolean setSize(@Nonnull Vec2I size)
fun setSize(size: Vec2I): Boolean
- (bool)setSize:(easyar_Vec2I *)size
public func setSize(_ size: Vec2I) -> Bool
public virtual bool setSize(Vec2I size)
매개 변수
반환 값
supportedFrameRateRangeCount
가져옵니다 the number of all frame rate ranges supported by the current device. Call after successful open.
int easyar_CameraDevice_supportedFrameRateRangeCount(const easyar_CameraDevice * This)
int supportedFrameRateRangeCount()
public int supportedFrameRateRangeCount()
fun supportedFrameRateRangeCount(): Int
- (int)supportedFrameRateRangeCount
public func supportedFrameRateRangeCount() -> Int32
public virtual int supportedFrameRateRangeCount()
반환 값
supportedFrameRateRangeLower
가져옵니다 the lower bound of the index-th frame rate range among all frame rate ranges supported by the current device. Call after successful open.
float easyar_CameraDevice_supportedFrameRateRangeLower(const easyar_CameraDevice * This, int index)
float supportedFrameRateRangeLower(int index)
public float supportedFrameRateRangeLower(int index)
fun supportedFrameRateRangeLower(index: Int): Float
- (float)supportedFrameRateRangeLower:(int)index
public func supportedFrameRateRangeLower(_ index: Int32) -> Float
public virtual float supportedFrameRateRangeLower(int index)
매개 변수
반환 값
supportedFrameRateRangeUpper
가져옵니다 the upper bound of the index-th frame rate range among all frame rate ranges supported by the current device. Call after successful open.
float easyar_CameraDevice_supportedFrameRateRangeUpper(const easyar_CameraDevice * This, int index)
float supportedFrameRateRangeUpper(int index)
public float supportedFrameRateRangeUpper(int index)
fun supportedFrameRateRangeUpper(index: Int): Float
- (float)supportedFrameRateRangeUpper:(int)index
public func supportedFrameRateRangeUpper(_ index: Int32) -> Float
public virtual float supportedFrameRateRangeUpper(int index)
매개 변수
반환 값
frameRateRange
가져옵니다 the index of the current frame rate range of the current device. Call after successful open. On iOS/macOS, -1 may be returned, indicating an unfixed frame rate. supportedFrameRateRangeLower and supportedFrameRateRangeUpper can be used to obtain the minimum and maximum values.
int easyar_CameraDevice_frameRateRange(const easyar_CameraDevice * This)
public int frameRateRange()
fun frameRateRange(): Int
public func frameRateRange() -> Int32
public virtual int frameRateRange()
반환 값
setFrameRateRange
설정합니다 the index of the current frame rate range of the current device. Call after successful open.
bool easyar_CameraDevice_setFrameRateRange(easyar_CameraDevice * This, int index)
bool setFrameRateRange(int index)
public boolean setFrameRateRange(int index)
fun setFrameRateRange(index: Int): Boolean
- (bool)setFrameRateRange:(int)index
public func setFrameRateRange(_ index: Int32) -> Bool
public virtual bool setFrameRateRange(int index)
매개 변수
반환 값
setFlashTorchMode
설정합니다 flash torch mode to on. Call after successful open.
bool easyar_CameraDevice_setFlashTorchMode(easyar_CameraDevice * This, bool on)
bool setFlashTorchMode(bool on)
public boolean setFlashTorchMode(boolean on)
fun setFlashTorchMode(on: Boolean): Boolean
- (bool)setFlashTorchMode:(bool)on
public func setFlashTorchMode(_ on: Bool) -> Bool
public virtual bool setFlashTorchMode(bool on)
매개 변수
반환 값
setFocusMode
설정합니다 the focus mode to focusMode. Call after successful open.
bool easyar_CameraDevice_setFocusMode(easyar_CameraDevice * This, easyar_CameraDeviceFocusMode focusMode)
bool setFocusMode(CameraDeviceFocusMode focusMode)
public boolean setFocusMode(int focusMode)
fun setFocusMode(focusMode: Int): Boolean
- (bool)setFocusMode:(easyar_CameraDeviceFocusMode)focusMode
public func setFocusMode(_ focusMode: CameraDeviceFocusMode) -> Bool
public virtual bool setFocusMode(CameraDeviceFocusMode focusMode)
매개 변수
반환 값
autoFocus
호출합니다 auto focus once. Use after start. It can be used only when FocusMode is Normal or Macro.
bool easyar_CameraDevice_autoFocus(easyar_CameraDevice * This)
public boolean autoFocus()
public func autoFocus() -> Bool
public virtual bool autoFocus()
반환 값