CameraX小例子教程网址
官方教程
在你开始之前
在这个codelab中,您将学习如何创建一个相机应用程序,该应用程序使用CameraX显示取景器、拍摄照片和分析相机中的图像流。
为了实现这一点,我们将在CameraX中引入use cases的概念,您可以使用它进行各种相机操作,从显示取景器到实时分析帧。
先决条件
你要做什么
- 了解如何添加CameraX依赖项。
- 了解如何在活动中显示相机预览。(预览用例)
- 建立一个应用程序,可以拍摄照片并保存到存储。(ImageCapture用例)
- 学习如何实时分析相机中的帧。(图像分析用例)
你需要什么
- 安卓设备。Android Studio的模拟器也可以工作,我们建议使用R和更高版本。图像分析用例不适用于任何低于R的情况。
- 支持的最低API级别为21。
- Android Studio 3.6或更高版本。
Before you begin
In this codelab, you'll learn how to create a camera app that uses CameraX to show a viewfinder, take photos, and analyze an image stream from the camera.
To achieve this, we will introduce the concept of use cases in CameraX, which you can use for a variety of camera operations, from displaying a viewfinder to analyzing frames in real time.
Prerequisites
- Basic Android development experience.
What you'll do
- Learn how to add the CameraX dependencies.
- Learn how to display the camera preview in an activity. (Preview use case)
- Build an app that can take a photo and save it to storage. (ImageCapture use case)
- Learn how to analyze frames from the camera in real time. (ImageAnalysis use case)
What you'll need
- An Android device. Android Studio's emulator works too, we recommend using R and above. The image analysis use case does not work on anything lower than R.
- Minimum supported API level is 21.
- Android Studio 3.6 or above.