Skip to content

CandyTek/ThreadPoolWithCameraPreview

 
 

Repository files navigation

ThreadPool with Camera Preview


Update Gradle 8.0

Update use androidx

Update project dependencies

Camera preview is landscape


This project demonstrate how to use HandlerThreads and ThreadPools to burst capture images from Android's Camera API on a background thread. The images are then:

  • Converted from YUV byte[] to RGB int[].
  • Converted from RGB int[] to Bitmap.
  • Bitmap is rotated if needed to fix orientation.
  • A Thumbnail size Bitmap is made for displaying.
  • Full size bitmap is written to disk as a Jpeg.
  • Jpeg image is uploaded to a server.

The CameraPreview YUV byte[] is captured on a background HandlerThread and then ThreadPools are used to perform the operations above to improve speed and performance.

Performance Before TheadPool

Performance before ThreadPool

Performance After ThreadPool

Performance after ThreadPool

About

Demo of using threadpools to improve performance on Android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 90.9%
  • HTML 9.1%