CameraX Release for October 2019

252 views
Skip to first unread message

Eric Ng

unread,
Sep 30, 2019, 3:41:25 PM9/30/19
to
Hello Everyone,

The CameraX team is excited to share with you some of the things we're currently working on. Please find the release notes for the upcoming Jetpack/AndroidX release notes for Camera [Camera2, Core, Extension, and View]. Libraries should be live on Google Maven later this week. Thank you!

-Eric on behalf of the CameraX Team

Camera Core & Camera2 Version 1.0.0-alpha06


**New features**


Changes to setting aspect ratios


  • setTargetAspectRatioMode() is added and accepts an enum argument. AspectRatioMode with options RATIO_4_3 or RATIO_16_9 instead of an arbitrary aspect ratio.  This closer reflects the fact that only certain aspect ratios are provided from the camera, rather than any arbitrary ratio.

    • Currently 16:9 and 4:3 are available.  In the case of 1:1, only certain devices have this available from the camera, and then only at limited resolutions.  Applications designing a 1:1 interface or processing should use the more flexible 16:9 or 4:3 choices and crop at the display or process a subregion.

    • These aspect ratios are oriented to use the maximum sensor area

  • For each use case, applications should call only one of setTargetResolution() or setTargetAspectRatio().  Calling both on the same builder will return an error.   

    • In general it’s recommended to use setTargetAspectRatio() based on the application’s UI design.  Specific resolutions will be based on the use case (see table). For example preview will be near screen resolutions and image capture will provide high resolution stills.  See table in the developer documentation. 

    • setTargetResolution() can be used in more specific cases such as when minimum (to save computation)  or maximum resolutions (for processing details) are required.

  • getTargetAspectRatio() added to use case config APIs returning aspect ratio the use case output is targeted for.

  • Previous setTargetAspectRatio(Rational aspectRatio) is now available for ImageCapture as setTargetAspectRatioCustom(Rational aspectRatio) and when set the ImageCapture output will be cropped accordingly.

Executor APIs

  • Removed the setCallbackHandler() call from use case configuration APIs.  Instead, applications can set executors parameters added to various API functions.

 

  • The following functions accept an executor parameter that allows the app to control which executor the function runs on.   

    • Preview.setOnPreviewOutputUpdateListener() API.  If the executor is not present for that function, it executes on the main thread.

    • Preview.setOnPreviewOutputUpdateListener

    • FocusMeteringAction.Builder.setAutoFocusCallback

    • ImageAnalysis.setAnalyzer

    • ImageCapture.takePicture

    • CameraView.takePicture

    • CameraView.startRecording

    • VideoCapture.startRecording


CameraInfo added with check Flash Available and Sensor Rotation APIs

  • Added a CameraInfo and getCameraInfo method, which allow app to check if a lens facing CameraInfo is available, and if a flash is available on that camera, e.g.:

try {

    CameraInfo cameraInfo = CameraX.getCameraInfo(mCurrentCameraLensFacing);

    LiveData<Boolean> isFlashAvailable = cameraInfo.isFlashAvailable();

    flashToggle.setVisibility(

            isFlashAvailable.getValue() ? View.VISIBLE : View.INVISIBLE);

} catch (CameraInfoUnavailableException e) {

    Log.w(TAG, "Cannot get flash available information", e);

    flashToggle.setVisibility(View.VISIBLE);

}


  • CameraInfo.getSensorRotationDegrees() added providing the camera sensor orientation relative to the device’s natural orientation, or for convenience relative to an orientation described by a Surface rotation (which describes an orientation relative to natural orientation).



**API changes & Bug fixes**


  • Updated null annotations for various functions
  • Fix “java.lang.IllegalStateException at Camera$StateCallback.onError” occurring when opening the camera.
  • Fixed issue where resolutions would be selected that were too small (less than 640x480) when app is requesting larger or by default resulting in a blocky or “blurry” preview image.  Applications that specifically need smaller resolutions can explicitly request them
  • Fix issue where camera would show black screen (failure to start camera) after returning from intent that launched another camera application.
  • Fix for bug that was causing “java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!” occurring when apps are repeatedly started/stopped.
  • Fix for “java.lang.IllegalStateException: maxImages (4) has already been acquired, call #close before acquiring more.” when disabling ImageAnalysis
  • Added additional tests for camera disconnect flow
  • Improved test system robustness when running back-to-back camera tests.

Camera Extensions & View Version 1.0.0-alpha03


Camera Extensions commits - 1.0.0-alpha03

Camera View commits - 1.0.0-alpha03


**New Features**

  • Added Context initializer for extensions, extensions version incremented to 1.1.0

Reply all
Reply to author
Forward
0 new messages