voideasyar_castImmediateCallbackSchedulerToCallbackScheduler(consteasyar_ImmediateCallbackScheduler*This,/* OUT */easyar_CallbackScheduler**Return);
voideasyar_tryCastCallbackSchedulerToImmediateCallbackScheduler(consteasyar_CallbackScheduler*This,/* OUT */easyar_ImmediateCallbackScheduler**Return);
/// There are two subclasses: `DelayedCallbackScheduler`_ and `ImmediateCallbackScheduler`_ .
/// `DelayedCallbackScheduler`_ is used to delay callback to be invoked manually, and it can be used in single-threaded environments (such as various UI environments).
/// `ImmediateCallbackScheduler`_ is used to mark callback to be invoked when event is dispatched, and it can be used in multi-threaded environments (such as server or service daemon).
/// Executes a callback. If there is no callback to execute, false is returned.
/// </summary>
boolrunOne();
staticvoidtryCastFromCallbackScheduler(CallbackScheduler*v,/* OUT */DelayedCallbackScheduler**Return);
};
/// <summary>
/// Immediate callback scheduler.
/// It is used to mark callback to be invoked when event is dispatched, and it can be used in multi-threaded environments (such as server or service daemon).
/// There are two subclasses: `DelayedCallbackScheduler`_ and `ImmediateCallbackScheduler`_ .
/// `DelayedCallbackScheduler`_ is used to delay callback to be invoked manually, and it can be used in single-threaded environments (such as various UI environments).
/// `ImmediateCallbackScheduler`_ is used to mark callback to be invoked when event is dispatched, and it can be used in multi-threaded environments (such as server or service daemon).
/// </summary>
@interfaceeasyar_CallbackScheduler:easyar_RefBase
+(instancetype)newNS_UNAVAILABLE;
-(instancetype)initNS_UNAVAILABLE;
@end
/// <summary>
/// Delayed callback scheduler.
/// It is used to delay callback to be invoked manually, and it can be used in single-threaded environments (such as various UI environments).
/// Executes a callback. If there is no callback to execute, false is returned.
/// </summary>
-(bool)runOne;
@end
/// <summary>
/// Immediate callback scheduler.
/// It is used to mark callback to be invoked when event is dispatched, and it can be used in multi-threaded environments (such as server or service daemon).
voideasyar_CameraDevice__ctor(/* OUT */easyar_CameraDevice**Return);
/// <summary>
/// Checks if the component is available. It returns true only on Windows, Mac, Android or iOS.
/// </summary>
booleasyar_CameraDevice_isAvailable(void);
/// <summary>
/// Gets current camera API (camera1 or camera2) on Android. camera1 is better for compatibility, but lacks some necessary information such as timestamp. camera2 has compatibility issues on some devices.
/// Sets current camera API (camera1 or camera2) on Android. It must be called before calling openWithIndex, openWithSpecificType or openWithPreferredType, or it will not take effect.
/// It is recommended to use `CameraDeviceSelector`_ to create camera with camera API set to recommended based on primary algorithm to run.
/// Requests camera permission from operating system. You can call this function or request permission directly from operating system. It is only available on Android and iOS. On other platforms, it will call the callback directly with status being granted. This function need to be called from the UI thread.
/// Opens a camera by specific camera device type. If no camera is matched, false will be returned. On Mac, camera device types can not be distinguished.
/// Camera parameters, including image size, focal length, principal point, camera type and camera rotation against natural orientation. Call after a successful open.
/// </summary>
voideasyar_CameraDevice_cameraParameters(easyar_CameraDevice*This,/* OUT */easyar_CameraParameters**Return);
/// <summary>
/// Sets camera parameters. Call after a successful open.
/// Sets the preview size. The available nearest value will be selected. Call size to get the actual size. Call after a successful open. frameRateRange may change after calling setSize.
/// CameraDevice implements a camera device, which outputs `InputFrame`_ (including image, camera paramters, and timestamp). It is available on Windows, Mac, Android and iOS.
/// After open, start/stop can be invoked to start or stop data collection. start/stop will not change previous set camera parameters.
/// When the component is not needed anymore, call close function to close it. It shall not be used after calling close.
/// CameraDevice outputs `InputFrame`_ from inputFrameSource. inputFrameSource shall be connected to `InputFrameSink`_ for use. Refer to `Overview <Overview.html>`__ .
/// bufferCapacity is the capacity of `InputFrame`_ buffer. If the count of `InputFrame`_ which has been output from the device and have not been released is more than this number, the device will not output new `InputFrame`_ , until previous `InputFrame`_ have been released. This may cause screen stuck. Refer to `Overview <Overview.html>`__ .
/// On Android, it is required to add android.permission.CAMERA to AndroidManifest.xml for use.
/// On iOS, it is required to add NSCameraUsageDescription to Info.plist for use.
/// Checks if the component is available. It returns true only on Windows, Mac, Android or iOS.
/// </summary>
staticboolisAvailable();
/// <summary>
/// Gets current camera API (camera1 or camera2) on Android. camera1 is better for compatibility, but lacks some necessary information such as timestamp. camera2 has compatibility issues on some devices.
/// </summary>
AndroidCameraApiTypeandroidCameraApiType();
/// <summary>
/// Sets current camera API (camera1 or camera2) on Android. It must be called before calling openWithIndex, openWithSpecificType or openWithPreferredType, or it will not take effect.
/// It is recommended to use `CameraDeviceSelector`_ to create camera with camera API set to recommended based on primary algorithm to run.
/// Requests camera permission from operating system. You can call this function or request permission directly from operating system. It is only available on Android and iOS. On other platforms, it will call the callback directly with status being granted. This function need to be called from the UI thread.
/// Gets count of cameras recognized by the operating system.
/// </summary>
staticintcameraCount();
/// <summary>
/// Opens a camera by index.
/// </summary>
boolopenWithIndex(intcameraIndex);
/// <summary>
/// Opens a camera by specific camera device type. If no camera is matched, false will be returned. On Mac, camera device types can not be distinguished.
/// </summary>
boolopenWithSpecificType(CameraDeviceTypetype);
/// <summary>
/// Opens a camera by camera device type. If no camera is matched, the first camera will be used.
/// </summary>
boolopenWithPreferredType(CameraDeviceTypetype);
/// <summary>
/// Starts video stream capture.
/// </summary>
boolstart();
/// <summary>
/// Stops video stream capture. It will only stop capture and will not change previous set camera parameters and connection.
/// </summary>
voidstop();
/// <summary>
/// Close. The component shall not be used after calling close.
/// </summary>
voidclose();
/// <summary>
/// Camera index.
/// </summary>
intindex();
/// <summary>
/// Camera type.
/// </summary>
CameraDeviceTypetype();
/// <summary>
/// Camera parameters, including image size, focal length, principal point, camera type and camera rotation against natural orientation. Call after a successful open.
/// </summary>
voidcameraParameters(/* OUT */CameraParameters**Return);
/// <summary>
/// Sets camera parameters. Call after a successful open.
/// Gets the current preview size. Call after a successful open.
/// </summary>
Vec2Isize();
/// <summary>
/// Gets the number of supported preview sizes. Call after a successful open.
/// </summary>
intsupportedSizeCount();
/// <summary>
/// Gets the index-th supported preview size. It returns {0, 0} if index is out of range. Call after a successful open.
/// </summary>
Vec2IsupportedSize(intindex);
/// <summary>
/// Sets the preview size. The available nearest value will be selected. Call size to get the actual size. Call after a successful open. frameRateRange may change after calling setSize.
/// </summary>
boolsetSize(Vec2Isize);
/// <summary>
/// Gets the number of supported frame rate ranges. Call after a successful open.
/// </summary>
intsupportedFrameRateRangeCount();
/// <summary>
/// Gets range lower bound of the index-th supported frame rate range. Call after a successful open.
/// </summary>
floatsupportedFrameRateRangeLower(intindex);
/// <summary>
/// Gets range upper bound of the index-th supported frame rate range. Call after a successful open.
/// </summary>
floatsupportedFrameRateRangeUpper(intindex);
/// <summary>
/// Gets current index of frame rate range. Call after a successful open.
/// </summary>
intframeRateRange();
/// <summary>
/// Sets current index of frame rate range. Call after a successful open.
/// </summary>
boolsetFrameRateRange(intindex);
/// <summary>
/// Sets flash torch mode to on. Call after a successful open.
/// </summary>
boolsetFlashTorchMode(boolon);
/// <summary>
/// Sets focus mode to focusMode. Call after a successful open.
/// </summary>
boolsetFocusMode(CameraDeviceFocusModefocusMode);
/// <summary>
/// Does auto focus once. Call after start. It is only available when FocusMode is Normal or Macro.
/// </summary>
boolautoFocus();
};
/// <summary>
/// It is used for selecting camera API (camera1 or camera2) on Android. camera1 is better for compatibility, but lacks some necessary information such as timestamp. camera2 has compatibility issues on some devices.
/// Different preferences will choose camera1 or camera2 based on usage.
/// </summary>
classCameraDeviceSelector
{
public:
/// <summary>
/// Gets recommended Android Camera API type by a specified preference.
staticvoidFunctorOfVoidFromPermissionStatusAndString_func(void*_state,easyar_PermissionStatusarg0,easyar_String*arg1,/* OUT */easyar_String**_exception)
/// CameraDevice implements a camera device, which outputs `InputFrame`_ (including image, camera paramters, and timestamp). It is available on Windows, Mac, Android and iOS.
/// After open, start/stop can be invoked to start or stop data collection. start/stop will not change previous set camera parameters.
/// When the component is not needed anymore, call close function to close it. It shall not be used after calling close.
/// CameraDevice outputs `InputFrame`_ from inputFrameSource. inputFrameSource shall be connected to `InputFrameSink`_ for use. Refer to `Overview <Overview.html>`__ .
/// bufferCapacity is the capacity of `InputFrame`_ buffer. If the count of `InputFrame`_ which has been output from the device and have not been released is more than this number, the device will not output new `InputFrame`_ , until previous `InputFrame`_ have been released. This may cause screen stuck. Refer to `Overview <Overview.html>`__ .
/// On Android, it is required to add android.permission.CAMERA to AndroidManifest.xml for use.
/// On iOS, it is required to add NSCameraUsageDescription to Info.plist for use.
/// </summary>
@interfaceeasyar_CameraDevice:easyar_RefBase
+(instancetype)newNS_UNAVAILABLE;
-(instancetype)initNS_UNAVAILABLE;
+(easyar_CameraDevice*)create;
/// <summary>
/// Checks if the component is available. It returns true only on Windows, Mac, Android or iOS.
/// </summary>
+(bool)isAvailable;
/// <summary>
/// Gets current camera API (camera1 or camera2) on Android. camera1 is better for compatibility, but lacks some necessary information such as timestamp. camera2 has compatibility issues on some devices.
/// Sets current camera API (camera1 or camera2) on Android. It must be called before calling openWithIndex, openWithSpecificType or openWithPreferredType, or it will not take effect.
/// It is recommended to use `CameraDeviceSelector`_ to create camera with camera API set to recommended based on primary algorithm to run.
/// Requests camera permission from operating system. You can call this function or request permission directly from operating system. It is only available on Android and iOS. On other platforms, it will call the callback directly with status being granted. This function need to be called from the UI thread.
/// Gets count of cameras recognized by the operating system.
/// </summary>
+(int)cameraCount;
/// <summary>
/// Opens a camera by index.
/// </summary>
-(bool)openWithIndex:(int)cameraIndex;
/// <summary>
/// Opens a camera by specific camera device type. If no camera is matched, false will be returned. On Mac, camera device types can not be distinguished.
/// Stops video stream capture. It will only stop capture and will not change previous set camera parameters and connection.
/// </summary>
-(void)stop;
/// <summary>
/// Close. The component shall not be used after calling close.
/// </summary>
-(void)close;
/// <summary>
/// Camera index.
/// </summary>
-(int)index;
/// <summary>
/// Camera type.
/// </summary>
-(easyar_CameraDeviceType)type;
/// <summary>
/// Camera parameters, including image size, focal length, principal point, camera type and camera rotation against natural orientation. Call after a successful open.
/// </summary>
-(easyar_CameraParameters*)cameraParameters;
/// <summary>
/// Sets camera parameters. Call after a successful open.
/// Gets the current preview size. Call after a successful open.
/// </summary>
-(easyar_Vec2I*)size;
/// <summary>
/// Gets the number of supported preview sizes. Call after a successful open.
/// </summary>
-(int)supportedSizeCount;
/// <summary>
/// Gets the index-th supported preview size. It returns {0, 0} if index is out of range. Call after a successful open.
/// </summary>
-(easyar_Vec2I*)supportedSize:(int)index;
/// <summary>
/// Sets the preview size. The available nearest value will be selected. Call size to get the actual size. Call after a successful open. frameRateRange may change after calling setSize.
/// </summary>
-(bool)setSize:(easyar_Vec2I*)size;
/// <summary>
/// Gets the number of supported frame rate ranges. Call after a successful open.
/// </summary>
-(int)supportedFrameRateRangeCount;
/// <summary>
/// Gets range lower bound of the index-th supported frame rate range. Call after a successful open.
/// </summary>
-(float)supportedFrameRateRangeLower:(int)index;
/// <summary>
/// Gets range upper bound of the index-th supported frame rate range. Call after a successful open.
/// </summary>
-(float)supportedFrameRateRangeUpper:(int)index;
/// <summary>
/// Gets current index of frame rate range. Call after a successful open.
/// </summary>
-(int)frameRateRange;
/// <summary>
/// Sets current index of frame rate range. Call after a successful open.
/// </summary>
-(bool)setFrameRateRange:(int)index;
/// <summary>
/// Sets flash torch mode to on. Call after a successful open.
/// </summary>
-(bool)setFlashTorchMode:(bool)on;
/// <summary>
/// Sets focus mode to focusMode. Call after a successful open.
/// Does auto focus once. Call after start. It is only available when FocusMode is Normal or Macro.
/// </summary>
-(bool)autoFocus;
@end
/// <summary>
/// It is used for selecting camera API (camera1 or camera2) on Android. camera1 is better for compatibility, but lacks some necessary information such as timestamp. camera2 has compatibility issues on some devices.
/// Different preferences will choose camera1 or camera2 based on usage.
/// </summary>
@interfaceeasyar_CameraDeviceSelector:NSObject
+(instancetype)newNS_UNAVAILABLE;
-(instancetype)initNS_UNAVAILABLE;
/// <summary>
/// Gets recommended Android Camera API type by a specified preference.
voideasyar_CameraParameters__ctor(easyar_Vec2IimageSize,easyar_Vec2FfocalLength,easyar_Vec2FprincipalPoint,easyar_CameraDeviceTypecameraDeviceType,intcameraOrientation,/* OUT */easyar_CameraParameters**Return);
/// Focal length, the distance from effective optical center to CCD plane, divided by unit pixel density in width and height directions. The unit is pixel.
/// Camera device type. Default, back or front camera. On desktop devices, there are only default cameras. On mobile devices, there is a differentiation between back and front cameras.
/// Creates CameraParameters with default camera intrinsics. Default intrinsics are calculated by image size, which is not very precise.
/// </summary>
voideasyar_CameraParameters_createWithDefaultIntrinsics(easyar_Vec2IimageSize,easyar_CameraDeviceTypecameraDeviceType,intcameraOrientation,/* OUT */easyar_CameraParameters**Return);
/// <summary>
/// Get equivalent CameraParameters for a different camera image size.
/// </summary>
voideasyar_CameraParameters_getResized(easyar_CameraParameters*This,easyar_Vec2IimageSize,/* OUT */easyar_CameraParameters**Return);
/// <summary>
/// Calculates the angle required to rotate the camera image clockwise to align it with the screen.
/// screenRotation is the angle of rotation of displaying screen image against device natural orientation in clockwise in degrees.
/// For iOS(UIInterfaceOrientationPortrait as natural orientation):
/// Calculates whether the image needed to be flipped horizontally. The image is rotated, then flipped in rendering. When cameraDeviceType is front, a flip is automatically applied. Pass manualHorizontalFlip with true to add a manual flip.
/// Calculates the perspective projection matrix needed by virtual object rendering. The projection transforms points from camera coordinate system to clip coordinate system ([-1, 1]^4). The form of perspective projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.
/// Calculates the orthogonal projection matrix needed by camera background rendering. The projection transforms points from image quad coordinate system ([-1, 1]^2) to clip coordinate system ([-1, 1]^4), with the undefined two dimensions unchanged. The form of orthogonal projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.
/// Transforms points from image coordinate system ([0, 1]^2) to screen coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.
/// Transforms points from screen coordinate system ([0, 1]^2) to image coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.
/// Focal length, the distance from effective optical center to CCD plane, divided by unit pixel density in width and height directions. The unit is pixel.
/// </summary>
Vec2FfocalLength();
/// <summary>
/// Principal point, coordinates of the intersection point of principal axis on CCD plane against the left-top corner of the image. The unit is pixel.
/// </summary>
Vec2FprincipalPoint();
/// <summary>
/// Camera device type. Default, back or front camera. On desktop devices, there are only default cameras. On mobile devices, there is a differentiation between back and front cameras.
/// </summary>
CameraDeviceTypecameraDeviceType();
/// <summary>
/// Camera rotation against device natural orientation.
/// For Android phones and some Android tablets, this value is 90 degrees.
/// For Android eye-wear and some Android tablets, this value is 0 degrees.
/// For all current iOS devices, this value is 90 degrees.
/// </summary>
intcameraOrientation();
/// <summary>
/// Creates CameraParameters with default camera intrinsics. Default intrinsics are calculated by image size, which is not very precise.
/// </summary>
staticvoidcreateWithDefaultIntrinsics(Vec2IimageSize,CameraDeviceTypecameraDeviceType,intcameraOrientation,/* OUT */CameraParameters**Return);
/// <summary>
/// Get equivalent CameraParameters for a different camera image size.
/// </summary>
voidgetResized(Vec2IimageSize,/* OUT */CameraParameters**Return);
/// <summary>
/// Calculates the angle required to rotate the camera image clockwise to align it with the screen.
/// screenRotation is the angle of rotation of displaying screen image against device natural orientation in clockwise in degrees.
/// For iOS(UIInterfaceOrientationPortrait as natural orientation):
/// Calculates whether the image needed to be flipped horizontally. The image is rotated, then flipped in rendering. When cameraDeviceType is front, a flip is automatically applied. Pass manualHorizontalFlip with true to add a manual flip.
/// Calculates the perspective projection matrix needed by virtual object rendering. The projection transforms points from camera coordinate system to clip coordinate system ([-1, 1]^4). The form of perspective projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.
/// Calculates the orthogonal projection matrix needed by camera background rendering. The projection transforms points from image quad coordinate system ([-1, 1]^2) to clip coordinate system ([-1, 1]^4), with the undefined two dimensions unchanged. The form of orthogonal projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.
/// Transforms points from image coordinate system ([0, 1]^2) to screen coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.
/// Transforms points from screen coordinate system ([0, 1]^2) to image coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.
/// Focal length, the distance from effective optical center to CCD plane, divided by unit pixel density in width and height directions. The unit is pixel.
/// </summary>
-(easyar_Vec2F*)focalLength;
/// <summary>
/// Principal point, coordinates of the intersection point of principal axis on CCD plane against the left-top corner of the image. The unit is pixel.
/// </summary>
-(easyar_Vec2F*)principalPoint;
/// <summary>
/// Camera device type. Default, back or front camera. On desktop devices, there are only default cameras. On mobile devices, there is a differentiation between back and front cameras.
/// </summary>
-(easyar_CameraDeviceType)cameraDeviceType;
/// <summary>
/// Camera rotation against device natural orientation.
/// For Android phones and some Android tablets, this value is 90 degrees.
/// For Android eye-wear and some Android tablets, this value is 0 degrees.
/// For all current iOS devices, this value is 90 degrees.
/// </summary>
-(int)cameraOrientation;
/// <summary>
/// Creates CameraParameters with default camera intrinsics. Default intrinsics are calculated by image size, which is not very precise.
/// Calculates whether the image needed to be flipped horizontally. The image is rotated, then flipped in rendering. When cameraDeviceType is front, a flip is automatically applied. Pass manualHorizontalFlip with true to add a manual flip.
/// Calculates the perspective projection matrix needed by virtual object rendering. The projection transforms points from camera coordinate system to clip coordinate system ([-1, 1]^4). The form of perspective projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.
/// Calculates the orthogonal projection matrix needed by camera background rendering. The projection transforms points from image quad coordinate system ([-1, 1]^2) to clip coordinate system ([-1, 1]^4), with the undefined two dimensions unchanged. The form of orthogonal projection matrix is the same as OpenGL, that matrix multiply column vector of homogeneous coordinates of point on the right, ant not like Direct3D, that matrix multiply row vector of homogeneous coordinates of point on the left. But data arrangement is row-major, not like OpenGL's column-major. Clip coordinate system and normalized device coordinate system are defined as the same as OpenGL's default.
/// Transforms points from image coordinate system ([0, 1]^2) to screen coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.
/// Transforms points from screen coordinate system ([0, 1]^2) to image coordinate system ([0, 1]^2). Both coordinate system is x-left, y-down, with origin at left-top.
/// Creates an instance and connects to the server.
/// </summary>
voideasyar_CloudRecognizer_create(easyar_String*cloudRecognitionServiceServerAddress,easyar_String*apiKey,easyar_String*apiSecret,easyar_String*cloudRecognitionServiceAppId,/* OUT */easyar_CloudRecognizer**Return);
/// <summary>
/// Creates an instance and connects to the server with Cloud Secret.
/// </summary>
voideasyar_CloudRecognizer_createByCloudSecret(easyar_String*cloudRecognitionServiceServerAddress,easyar_String*cloudRecognitionServiceSecret,easyar_String*cloudRecognitionServiceAppId,/* OUT */easyar_CloudRecognizer**Return);
/// <summary>
/// Send recognition request. The lowest available request interval is 300ms.