Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CameraX

 CameraX

CameraX

Moyuru Aizawa

May 21, 2019
Tweet

More Decks by Moyuru Aizawa

Other Decks in Programming

Transcript

  1. 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
  2. ‣Automated CameraX test lab ‣Google tests hundreds of devices across

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

    ‣Photo capture latency ‣Startup/shutdown latency ‣…
  4. ‣Provide a use case based API ‣Displays up on screen

    ‣Gives high quality frames to analyze ‣Takes a picture or a video ‣Lifecycle aware
  5. ‣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
  6. val previewConfig = PreviewConfig.Builder().build() val preview = Preview(previewConfig) preview.setOnPreviewOutputUpdateListener {

    output -> textureView.surfaceTexture = output.surfaceTexture } CameraX.bindToLifecycle(this as LifecycleOwner, preview)
  7. 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)
  8. val file = File(...) imageCapture.takePicture(file, object: ImageCapture.OnImageSavedListener { override fun

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