Microsoft 智能镜头使用 CameraX 提高开发者的工作效率
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。

Microsoft 智能镜头是一款让文档和白板的图片更清晰易读的产品。Microsoft 智能镜头团队担心 Camera1 API(一种支持相机和相机功能的 Android 框架 API)在新型 Android 设备上的表现不一致。他们确定开发新事物,并确定最快的开发方法是使用 CameraX 来获得带有相机的手机所具备的现代功能。
策略
Microsoft 决定将 CameraX 用于其使用 Microsoft 智能镜头的办公应用套件。CameraX 是一个开源 Android Jetpack 支持库,可让开发者更轻松地在 Android 应用中构建相机功能。CameraX 可与 Microsoft 智能镜头的所有工具集成,确保在特定应用中使用高画质图像。CameraX 还通过提供更简单的 API 改善了开发者体验,可在 94% 的 Android 设备上使用。改用 CameraX 后,Microsoft Lens 团队能够解决性能问题、提高开发者的工作效率并缩短产品上市期。
成果

Microsoft 智能镜头团队发现,实现 CameraX 库可以为其开发者节省大量时间,因为测试和优化周期更短。据他们估计,CameraX 的工程团队需要大约 4 个月的集成时间,而 Camera2 大约需要 6 个月的时间。
“与 Camera1 API 相比,使用 CameraX 时,可以更轻松地配置分辨率、宽高比、图片旋转角度、拍摄质量等属性,这有助于完成集成方面的工作和时间。CameraX 会在内部处理状态(打开/关闭摄像头),而用户在应用之间切换时,减少了要集成的代码行数,还帮助开发者的工作效率能够专注于业务逻辑,而不是应用重置状态。”Microsoft 首席软件工程师经理 Vishal Bhatnagar 说道。

使用 CameraX 后,Microsoft 比 Camera1 提升了发布性能和拍摄性能。他们在现代 Android 设备上的启动和拍摄性能提高到了原来的 2 倍,有些设备甚至还实现了 3 倍的性能提升(尽管具体情况因设备而异)。此外,与 Camera2 的估算功能相比,启用核心扫描功能更容易。在设备碎片方面,CameraX 在许多 OEM 设备上的实现中可有效隐藏许多设备的 Camera2 变体。
Microsoft 团队目前正在将 CameraX 集成到他们的一些其他 Android 应用,例如 Office、Teams、OneDrive、Word、Excel、PowerPoint、Microsoft 智能镜头和 My Hub。所有这些应用都使用 CameraX 实现图片拍摄功能,例如文档扫描和从图像到实体提取等场景(例如从图像到表格、从图像到文本)。Microsoft 团队还计划尽快在 Outlook 中实现 CameraX,并研究其在 Kaizala 等其他应用中的潜力。
开始使用
如需详细了解如何在应用中实现 CameraX,请参阅我们的文档。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-01-31。
[null,null,["最后更新时间 (UTC):2022-01-31。"],[],[],null,["# Microsoft Lens increases developer productivity using CameraX\n\n[Microsoft Lens](https://play.google.com/store/apps/details?id=com.microsoft.office.officelens) is a product that makes images of documents and whiteboards easier to read. The Microsoft Lens team was concerned that the [Camera1](https://developer.android.com/guide/topics/media/camera) API, an Android framework API that includes support for cameras and camera features, was performing inconsistently for them on modern Android devices. They scoped out building something new and determined that the fastest development route was to use CameraX to get the modern features of a camera phone.\n\nWhat they did\n-------------\n\nMicrosoft decided to use [CameraX](https://developer.android.com/training/camerax) for their suite of productivity apps that use Microsoft Lens. CameraX is an open source [Android Jetpack](https://developer.android.com/jetpack) support library that makes it simpler for developers to build camera functionality in Android apps. CameraX integrates with all of Microsoft Lens' tools to ensure use of high-quality images across select apps. CameraX also improves the developer experience by providing a simpler API and works across 94 percent of Android devices. By switching to CameraX, the Microsoft Lens team was able to solve their performance issues, increase developer productivity, and reduce the time to go to market.\n\nResults\n-------\n\nThe Microsoft Lens team found that implementing the CameraX library saved their developers a significant amount of time, as a result of fewer testing and optimization cycles. They estimate that CameraX took their engineering team about four months of effort for integration time, compared to Camera2, which would have taken about six.\n\n\"With CameraX it is easier to configure attributes like resolution, aspect ratio, image rotation, capture quality, etc., when compared to Camera1 APIs, which helped integration effort and time. CameraX internally handling the state (to open/close camera) while users switch between the applications had reduced lines of code to integrate and also helped developer productivity to focus on business logic instead of app resetting state,\" said Vishal Bhatnagar, Principal Software Engineer Manager at Microsoft.\n\nUsing CameraX led Microsoft to better launch and capture performance compared to Camera1. Their performance on modern Android devices increased by 2X in launch and capture, and some devices even saw performance gains of 3X (although this varies by device). In addition, enabling core scan functionality was easier compared to estimates for Camera2. In terms of device fragmentation, CameraX effectively hides many devices' Camera2 variations in implementation on many OEM devices.\n\nThe Microsoft team is currently integrating CameraX into some of their other Android apps, such as Office, Teams, OneDrive, Word, Excel, PowerPoint, Microsoft Lens, and My Hub. All of these apps use CameraX for image capture functionality in scenarios such as document scan and image to entity extraction (such as image to table, image to text). The Microsoft team is also planning to implement CameraX in Outlook soon and looking into its potential for other apps, such as Kaizala.\n\nGet started\n-----------\n\nVisit our documentation to learn more about how to implement CameraX in your app."]]