Camera demo for android things, current support capture still picture, camera preview as well as capture still picture while preview is on-going.
Key process of setup camera preview extract from example Android Camera2 Example.
In order to support camera preview, you should enable hardware acceleration for your Activity or Application. More information about hardware acceleration, please refer to Android Things Realse Notes and Android Hardware Acceleration.
Take still picture while preview is on-going will close the preview capture session first and renew a preview capture session after picture is taken. This is because V4L2 only supports 1 stream configuration at a time, so we can not pass more than one Surface like ImageReader.getSurface() when we call CameraDevice.createCaptureSession(...).
Key process of capture still picture extract from example Doorbell.
We have two buttons for difference purpose.
In MainActivity:
- Button A: start
TakePictureActivity - Button B: start
CameraPreviewActivity
In TakePictureActivity:
- Button A: trigger take still picture
- Button B: return to
MainActivity
In CameraPreviewActivity:
- Button A: trigger take still picture while preview is on-going
- Button B: return to
MainActivity
