CameraX

 CameraX

CameraX

5f533179da1c82722252cbcb93e7356f?s=128

Moyuru Aizawa

May 21, 2019
Tweet

Transcript

  1. CameraX

  2. MoyuruAizawa Moyuru Aizawa A Software House Pairs Div. Eureka Inc.

    FRESH LIVE Div CyberAgent Inc. CATS Div. CyberAgent Inc. https://moyuru.io https://cinematic.fm
  3. CameraX uses Camera2 API

  4. API 21+

  5. Consistent across devices

  6. ‣Automated CameraX test lab ‣Google tests hundreds of devices across

    all OS layers. ‣Tests run 24 hours a day, seven days a week.
  7. ‣This test suite is open sourced. ‣You can benchmark …

    ‣Photo capture latency ‣Startup/shutdown latency ‣…
  8. Easy to use

  9. ‣Provide a use case based API ‣Displays up on screen

    ‣Gives high quality frames to analyze ‣Takes a picture or a video ‣Lifecycle aware
  10. ‣Reduced device specific testing ‣75% reduction in lines of code

    ‣Easier to read code ‣Smaller apk size In case of Camera360 https://play.google.com/store/apps/details?id=vStudio.Android.Camera360
  11. val previewConfig = PreviewConfig.Builder().build() val preview = Preview(previewConfig) preview.setOnPreviewOutputUpdateListener {

    output -> textureView.surfaceTexture = output.surfaceTexture } CameraX.bindToLifecycle(this as LifecycleOwner, preview)
  12. val imageAnalysisConfig = ImageAnalysisConfig.Builder() .setTargetResolution(Size(1280, 720)) .build val imageAnalysis =

    ImageAnalysis(imageAnalysisConfig) imageAnalysis.setAnalyzer { image, rotationDegrees -> // analyze } CameraX.bindToLifecycle(this as LifecycleOwner, imageAnalysis, preview)
  13. val imageCaptureConfig = ImageCaptureConfig.Builder() .setTargetRotation(windowManager.defaultDisplay.rotation) .build() val imageCapture = ImageCapture(imageCaptureConfig)

    CameraX.bindToLifecycle(this as LifecycleOwner, imageCapture, imageAnalysis, preview)
  14. val file = File(...) imageCapture.takePicture(file, object: ImageCapture.OnImageSavedListener { override fun

    onError( error: ImageCapture.UseCaseError, message: String, e: Throwable?) { } override fun onImageSaved(file: File) { } } )
  15. CameraX Extensions

  16. Portrait

  17. Portrait Night

  18. Portrait Night HDR

  19. Portrait Night HDR Beauty

  20. None
  21. Thank you https://www.youtube.com/watch?v=kuv8uK-5CLY