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

After I/O Istanbul Jetpack CameraX

After I/O Istanbul Jetpack CameraX

Hadi Tok

June 29, 2019
Tweet

More Decks by Hadi Tok

Other Decks in Technology

Transcript

  1. val imageAnalysisConfig = ImageAnalysisConfig.Builder() .setTargetResolution(Size(1280, 730)) .build() val imageAnalysis =

    ImageAnalysis(imageAnalysisConfig) imageAnalysis.setAnalyzer { imageProxy, rotationDegrees -> //do image analysis }
  2. val imageAnalysisConfig = ImageAnalysisConfig.Builder() .setTargetResolution(Size(1280, 730)) .build() val imageAnalysis =

    ImageAnalysis(imageAnalysisConfig) imageAnalysis.setAnalyzer { imageProxy, rotationDegrees -> //do image analysis } CameraX.bindToLifecycle(this, imageAnalysis, preview)
  3. val imageAnalysisConfig = ImageAnalysisConfig.Builder() .setTargetResolution(Size(1280, 730)) .build() val imageAnalysis =

    ImageAnalysis(imageAnalysisConfig) imageAnalysis.setAnalyzer { imageProxy, rotationDegrees -> //do image analysis } CameraX.bindToLifecycle(this, imageAnalysis, preview)
  4. val imageSaveListener = object : ImageCapture.OnImageSavedListener { override fun onImageSaved(file:

    File) { //use the image file } override fun onError(useCaseError: ImageCapture.UseCaseError, message: String, cause: Throwable?) { //handle error } }
  5. val imageSaveListener = object : ImageCapture.OnImageSavedListener { override fun onImageSaved(file:

    File) { //use the image file } override fun onError(useCaseError: ImageCapture.UseCaseError, message: String, cause: Throwable?) { //handle error } } val photoFile = createFile(outputDirectory, FILENAME, PHOTO_EXTENSION)
  6. val imageSaveListener = object : ImageCapture.OnImageSavedListener { override fun onImageSaved(file:

    File) { //use the image file } override fun onError(useCaseError: ImageCapture.UseCaseError, message: String, cause: Throwable?) { //handle error } } val photoFile = createFile(outputDirectory, FILENAME, PHOTO_EXTENSION) imageCapture.takePicture(photoFile, imageSaveListener)
  7. val imageSaveListener = object : ImageCapture.OnImageSavedListener { override fun onImageSaved(file:

    File) { //use the image file } override fun onError(useCaseError: ImageCapture.UseCaseError, message: String, cause: Throwable?) { //handle error } } val photoFile = createFile(outputDirectory, FILENAME, PHOTO_EXTENSION) imageCapture.takePicture(photoFile, imageSaveListener)