Saturday, April 20, 2024
HomeAndroidCameraX1.2 Beta now available

CameraX1.2 Beta now available


Donovan McMurray is the CameraX Developer Relations Officer.

Part of Android The CameraX library, Jetpack, makes difficult camera functionality accessible in an API that is easy to use. It helps you create the best experience possible across devices. Android Versions and devices. CameraX is available as of today Version 1.2 has been officially released to Beta. Upgrading from version 1.1 will allow you to benefit the latest game-changing feature: Zero Shutter Lag which enables action shots that are faster than ever possible, as well as our new ML Kit integration. This can help reduce boilerplate code when using ML Kit within a CameraX app.

These two advanced features are simple to implement with CameraX 1.2, so let’s take a look at each of them in depth.

Integration of ML Kits

Google’s ML Kit provides several on-device vision APIs for detecting faces, barcodes, text, objects, and more. We’re making it easier to integrate these APIs with CameraX. Version 1.2: MlKitAnalyzerImplementation of ImageAnalysis.Analyzer This company handles most of your ML Kit setup.

Use MlKitAnalyzer With both CameraController And cameraProvider workflows. Use the cameraController.setImageAnalysisAnalyzer() CameraX also supports coordinates conversion between your ML Kit output, and CameraX. PreviewView.

Here’s a code snippet using setImageAnalysisAnalyzer() Set a BarcodeScanner The following is a CameraController to detect QR codes. CameraX automates coordinate transformations for you when passing COORDINATE_SYSTEM_VIEW_REFERENCED In the MlKitAnalyzer. (Use COORDINATE_SYSTEM_ORIGINAL CameraX cannot perform any coordinate transformations.


val options = BarcodeScannerOptions.Builder()

  .setBarcodeFormats(Barcode.FORMAT_QR_CODE)

  .build()

val barcodeScanner = BarcodeScanning.getClient(options)

cameraController.setImageAnalysisAnalyzer(

  executor,

  new MlKitAnalyzer(List.of(barcodeScanner),

    COORDINATE_SYSTEM_VIEW_REFERENCED,

    executor, result -> {

      // The value of result.getResult(barcodeScanner)

      // can be used directly for drawing UI overlay.

    }

  )

)

Zero-Shutter Lag

You know the feeling of missing the moment when the shutter clicks too fast? CameraX 1.2 solves this problem with Zero-Shutter Lag.

CameraX 1.2 did not allow you to optimise for quality (CAPTURE_MODE_MAXIMIZE_QUALITY) Or efficiency (CAPTURE_MODE_MINIMIZE_LATENCY) Calling ImageCapture.Builder.setCaptureMode(). CameraX 1.2 offers a brand new level of value (CAPTURE_MODE_ZERO_SHOT_LAG) This reduces latency further than CAPTURE_MODE_MINIMIZE_LATENCY. CameraX will be used to replace Zero-Shutter Lag devices. CAPTURE_MODE_MINIMIZE_LATENCY.

This is done by creating a circle buffer with photos. To get the closest frame to the shutter click, when we capture an image, we use the circular buffer. There is no DeLorean. Scott is a great guy!

Here’s an example of how this works in a CameraX app with Preview and ImageCapture use cases:

  1. CameraX is just like other apps with Preview use cases. It sends images directly from the camera to UI to enable the user to view them.
  2. CameraX can also transmit images via Zero-Shutter Lag to a circular buffer that holds several images from the past.
  3. There will be some delay when the shutter button is pressed. Zero shutter lag sends the image to your app via the circular buffer.
  4. CameraX locates the photograph in the buffer that is closest to the time the user clicked the shutter button and sends it back to you.

Zero-Shutter Lag has some limitations. This is an experimental feature. You cannot use this feature because keeping a buffer around images can be computationally expensive. CAPTURE_MODE_ZERO_SHOT_LAG While using VideoCapture Or extensions. The circular buffer increases the app’s memory footprint.

Next steps

For more information on CameraX 1.2 features, please refer to our complete release notes. If you’re ready to try out CameraX 1.2, update your project’s CameraX dependency to 1.2.0-beta01 (or the latest version at the time you’re reading this).

You can submit feedback to CameraX about these features and CameraX as a whole by creating a CameraX problem. You can reach us via our CameraX Discussion Group.

RELATED ARTICLES
Continue to the category
- Advertisment -spot_img

Most Popular

CATEGORIES

Verified by MonsterInsights