简体   繁体   English

带 Surfaceview 的 Android 相机

[英]Android Camera with Surfaceview

I want to built my own camera app in android including the following options pinch to zoom and autofocus without using camera intent.我想在 android 中构建我自己的相机应用程序,包括以下选项,在不使用相机意图的情况下进行缩放和自动对焦。 I already gone through some samples from Git hub but I couldn't make use of them.So, I decided to start learning Camera API from Google developers.我已经从 Git hub 浏览了一些示例,但我无法使用它们。所以,我决定开始向 Google 开发人员学习 Camera API。 Here I need a complete steps to develop my app and what to learn like camera, surface view and anything else.在这里,我需要一个完整的步骤来开发我的应用程序以及要学习的内容,例如相机、表面视图和其他任何东西。

Thanks in advance提前致谢

I have done what you want to be done recently.我最近做了你想做的事。

For android, there are 2 camera APIs对于 android,有 2 个相机 API

camera api is deprecated on android api 21. starting from android api 21, you have to use camera2 api.相机 api 在 android api 21 上已弃用。从 android api 21 开始,您必须使用 camera2 api。 so you have to learn both of them.所以你必须学习它们。

  • Camera api brother with SurfaceView.带SurfaceView的相机api兄弟。
  • Camera2 api brother with TextureView.带TextureView的Camera2 api兄弟。

Camera2 api is quit alot different from Camera api, and also is much more complicated than Camera api. Camera2 api与Camera api有很大不同,也比Camera api复杂得多。

You may want to take a look at my project SimpleCameraView , it is much clear than other projects.你可能想看看我的项目SimpleCameraView ,它比其他项目清楚得多。 I just created this repository yesterday.我昨天刚刚创建了这个存储库。

Things to Need to Learn to Build Custom Camera APP构建自定义相机应用程序需要学习的东西

  • Setting Camera,FlashLight and FILE_STORAGE Permissions in Manifest在 Manifest 中设置 Camera、FlashLight 和 FILE_STORAGE 权限

  • SurfaceView and How to Use it. SurfaceView 和如何使用它。

  • Manual Control of Flash Light.手动控制闪光灯。

  • Lazy Loader for Displaying Images Taken without Memory Leaking. Lazy Loader,用于显示在没有内存泄漏的情况下拍摄的图像。

And you can go through this for Sample : Build Custom Camera你可以通过这个示例: 构建自定义相机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM