简体   繁体   English

为什么我应该或不应该在android中使用camera2 API?

[英]Why should or shouldn't I use camera2 API in android?

I have made an android application that uses standard android Camera API to take pictures, however i am having difficulty in implementing manual focus and some other features. 我已经制作了一个Android应用程序,它使用标准的Android Camera API拍照,但是我很难实现手动对焦和其他一些功能。 I have come across Camera2 API recently and just wanted to know if its worth trying or not? 我最近遇到过Camera2 API,只是想知道它是否值得尝试?

On the plus side, the camera2 API is much richer than the original Camera API. camera2方面来说, camera2 API比原始Camera API更丰富。 I suspect that it will tend to be more stable than the Camera API, as I think Google is taking it more seriously. 我怀疑它会比Camera API更稳定,因为我认为谷歌更认真对待它。 Conversely, over time, manufacturers are likely to invest less and less engineering and QA time on the old Camera API. 相反,随着时间的推移,制造商可能会在旧的Camera API上投入越来越少的工程和QA时间。 By 2018, when Android 5.0+ is 90% of the market, apps should be using the camera2 API exclusively, IMHO, unless the app specifically is aiming at legacy devices. 到2018年,当Android 5.0+占市场的90%时,应用应该专门使用camera2 API,恕我直言,除非该应用专门针对传统设备。

However: 然而:

  • The camera2 API only works on Android 5.0 and higher, so unless your minSdkVersion is 21 or higher, you still need the Camera API for older devices. camera2 API仅适用于Android 5.0及更高版本,因此除非您的minSdkVersion为21或更高版本,否则您仍需要旧版设备的Camera API。 That means either only using the Camera API or using both (and hence having additional engineering work). 这意味着要么只使用Camera API,要么使用两者(因此需要额外的工程工作)。

  • IMHO, the documentation for both is severely lacking, but the Camera API has been around longer, so there are more Stack Overflow answers, blog posts, and so on that cover it. 恕我直言,两者的文档严重缺乏,但Camera API已经存在更长时间,因此有更多的Stack Overflow答案,博客文章等等。

  • To really take advantage of the power of the camera2 API, you need to be a camera enthusiast, IMHO. 真正利用camera2 API的camera2功能,您需要成为相机爱好者,恕我直言。 Personally, I am not, and so a lot of what the camera2 API offers is beyond my comprehension, though I'm sure it's really cool. 就个人而言,我不是,所以camera2 API提供的很多东西都超出了我的理解,尽管我确信它真的很酷。

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

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