Android camera2 API video app - Part 17 capturing still image in preview mode

preview_player
Показать описание
Part 17 describes how to capture a still image in the camera capture session preview mode.

Github details:
You can get it from here

or you can run this command

In this tutorial we will cover:
- Creating the folder & unique file names for the still images
- Setting up a camera capture request for still capture
- Resolving any camera sensor orientation issues
- Creating the still image file name when the capture session callback has started
- Creating a runnable to save the ImageReader's surface to storage
- Calling the runnable once the ImageReader's latest image is available

API's covered
- ImageReader.OnImageAvailableListener
- ImageReader.OnImageAvailable
- CaptureRequestBuilder
- CaptureRequest.JPEG_ORIENTATION
- CameraDevice
- CameraDevice.TEMPLATE_STILL_CAPTURE
- CameraCaptureSession.CaptureCallback
- Image
- ByteBuffer
- FileOutputStream

For much more information checkout

The previous tutorials were aimed at beginners to android but over time have been getting more complex as the original camera_intent app has developed.
This tutorial series is more aimed towards the intermediate developers thought for those who have been following the previous tutorial series, feel free to watch this android performance series.

Android studio (1.5) is the editor of choice (IDE) for this tutorial series.

This tutorial series is the start of what I expect to be many so I encourage comments and feedback to improve the quality and viewing experience.
Рекомендации по теме
Комментарии
Автор

Hi Nige, I really much appreciate your video, I really have no idea of Camera2 API and it's flow before, but after watching this, it really clears me out of Camera2 confusion.
I am currently having a college project of making an app based on Face Recognition, and I would like to validate / recognize the face in the back-end instead of FE, my biggest obstacles in this time is to implement the image stream to API, by using Camera2 guided by your tutorial, it's just become far more clear now. Thanks a lot Nige! I wish you all the best. I send my honor to you from Indonesia

gilangprambudi
Автор

your tutorial is awesome can you tell me how can enable flash and zoom inside texture view. thanks a lot for these tutorials please reply

ankitrajdwivedi
Автор

could you please tell me how to take many pictures ???? because when i try to take 5 pictures for exemple i can't find them in my folder ??

youcef
Автор

Hey great video really well structured, I was able to do most of the tutorial and was able to locate the saved file in file manager however the file would say cannot display image resolution is 0*0. Any help would be appreciated.

anshumankomawar
Автор

Hello. Thank you for your videos. I have problem with this lesson. I got IllegalArgumentException: createDefaultRequest - invalid templateId specified
in this place:
What am I doing wrong?

albertk
Автор

what is the variable mPreviewCaptureSession? I could not see it even in your GitHub code?

workaholicrhythm
Автор

Thank you for your help video. may I ask you about capturing image and display it on image view?? i'm confused because of so many callback function.

복도리-cb
Автор

can you show in future tutorial how to make burst capture?

derekpoon
Автор

Hi, your tutorials have helped me learn a lot. When I capture a still image from the camera preview, I rather than save the Image am trying to send the byte array to a new activity and then create a bitmap and display it on screen. the image is rotated incorrectly. Have I done something wrong or is there an issue with the camera 2 api that I have not dealt with?

deadbirdgamesdeveloper
Автор

Hi. nice to meet you. I live in South Korea. I'm developing Communications System. I have a question. I want to use the Android Camera2 API. So, I want to control the SmartPhone Camera 'Focal Length' for optical zoom using Android development. I have a Samsung Galaxy S6 OS 6.1. Is this possible focal length control for optical zoom?
I request answer for this question, Please. Thank you.

boyking
Автор

I am unable to click images in front camera but the video is recording in front camera help needed

invincibleengineer
welcome to shbcf.ru