| class info |
| com.huawei.hms.mlsdk.common.LensEngine.Creator |
| Represents a LensEngine creator used to create an instance of LensEngine. |
| Constructor name |
| Creator(android.content.Context context, MLAnalyzer<?> analyzer) Creates an instance of LensEngine. |
| Creator(android.content.Context context, MLAnalyzer<?> analyzer, LensRequest lensRequest) Creates an instance of LensEngine. |
| Creator(android.content.Context context, MLAnalyzer<?> analyzer, LensRequest lensRequest, MLLensSelector lensSelector) Creates an instance of LensEngine. |
| Return type | Method name |
| LensEngine.Creator | applyDisplayDimension(int width, int height) |
| LensEngine.Creator | applyFps(float fps) |
| LensEngine | create() |
| LensEngine.Creator | enableAutomaticFocus(boolean autoFocusEnabled) |
| LensEngine.Creator | setFlashMode(String flashMode) |
| LensEngine.Creator | setFocusMode(String focusMode) |
| LensEngine.Creator | setLensType(int type) |
| Method |
| public Creator(android.content.Context context, MLAnalyzer<?> analyzer) |
| Creates an instance of LensEngine. |
Parameters
| Parameter name | Parameter desc |
| context | Context |
| analyzer | Analyzer, for example, MLCompositeAnalyzer, which extends the MLAnalyzerclass. |
| Method |
| public Creator(android.content.Context context, MLAnalyzer<?> analyzer, LensRequest lensRequest) |
| Creates an instance of LensEngine. |
Parameters
| Parameter name | Parameter desc |
| context | Context |
| analyzer | Analyzer, for example, MLCompositeAnalyzer, which extends the MLAnalyzerclass. |
| lensRequest | Instance of LensRequest, including camera selection parameters such as the camera type (front or rear) as well as the frame rate and preview image size that need to be supported by the camera. During startup, the LensEngine selects a camera based on the parameters and then initializes parameters (for example, whether to enable automatic focus and the flash mode) of the selected camera. |
| Method |
| public Creator(android.content.Context context, MLAnalyzer<?> analyzer, LensRequest lensRequest, MLLensSelector lensSelector) |
| Creates an instance of LensEngine. |
Parameters
| Parameter name | Parameter desc |
| context | Context |
| analyzer | Analyzer, for example, MLCompositeAnalyzer, which extends the MLAnalyzerclass. |
| lensRequest | Instance of LensRequest,including camera selection parameters such as the camera type (front or rear) as well as the frame rate and preview image size that need to be supported by the camera. During startup, the LensEngine selects a camera based on the parametersand then initializes parameters (for example, whether to enable automatic focus and the flash mode) of the selected camera. |
| lensSelector | Custom camera selection policy, for example, a frame rate, preview image size, or camera type matching policy. |
| Method |
| public LensEngine.Creator applyDisplayDimension(int width, int height) |
| Sets the size of the preview image of a camera. Different image sizes are recommended when different algorithms are used for image processing. In addition, processing large images consumes more memory and CPU resources. It is recommended that the size of the preview image be 1920 x 1920 or smaller. |
Parameters
| Parameter name | Parameter desc |
| width | Width of a preview image, in pixels. |
| height | Height of a preview image, in pixels. |
Return
| Type | desc |
| LensEngine.Creator | An instance of LensEngine.Creator. |
| Method |
| public LensEngine.Creator applyFps(float fps) |
| Sets the preview frame rate (fps) of a camera. The preview frame rate of a camera depends on the firmware capability of the camera. |
Parameters
| Parameter name | Parameter desc |
| fps | Preview frame rate. |
Return
| Type | desc |
| LensEngine.Creator | An instance of LensEngine.Creator. |
| Method |
| public LensEngine create() |
| Creates an instance of LensEngine. |
Return
| Type | desc |
| LensEngine | An instance of LensEngine. |
| Method |
| public LensEngine.Creator enableAutomaticFocus(boolean autoFocusEnabled) |
| Enables or disables the automatic focus function for a camera. |
Parameters
| Parameter name | Parameter desc |
| autoFocusEnabled | Indicates whether to enable the automatic focus function. The options are as follows: true: enables the automatic focus function false: disables the automatic focus function |
Return
| Type | desc |
| LensEngine.Creator | An instance of LensEngine.Creator. |
| Method |
| public LensEngine.Creator setFlashMode(String flashMode) |
| Sets the flash mode for a camera. |
Parameters
| Parameter name | Parameter desc |
| flashMode | Flash mode of a camera. The options are as follows: Camera.FLASH_MODE_AUTO(“auto”): automatically determines whether to turn on the flash Camera.FLASH_MODE_ON(“on”): turns on the flash Camera.FLASH_MODE_OFF(“off”): turns off the flash |
Return
| Type | desc |
| LensEngine.Creator | An instance of LensEngine.Creator. |
| Method |
| public LensEngine.Creator setFocusMode(String focusMode) |
| Sets the focus mode for a camera. |
Parameters
| Parameter name | Parameter desc |
| focusMode | Focus mode of a camera. The options are as follows: Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE(“continuous-picture”): continuous image focus mode Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO(“continuous-video”): continuous video focus mode |
Return
| Type | desc |
| LensEngine.Creator | An instance of LensEngine.Creator. |
| Method |
| public LensEngine.Creator setLensType(int type) |
| Sets the camera type. |
Parameters
| Parameter name | Parameter desc |
| type | Camera type. The options are as follows: BACK_LENS(0): rear camera FRONT_LENS(1): front camera |
Return
| Type | desc |
| LensEngine.Creator | An instance of LensEngine.Creator. |