Microsoft 智慧鏡頭使用 CameraX 有助開發人員提升工作效率
透過集合功能整理內容
你可以依據偏好儲存及分類內容。

Microsoft 智慧鏡頭產品可讓文件和白板的圖片更容易閱讀。Microsoft 智慧鏡頭團隊擔心 Camera1 API 支援相機和相機功能的 Android 架構 API,在新型 Android 裝置上的效能不一致。他們開始建構新事物,並判定最快的開發路線是使用 CameraX 來取得相機手機的現代化功能。
具體措施
Microsoft 決定採用 CameraX,打造採用 Microsoft 智慧鏡頭的效率提升應用程式套件。CameraX 是開放原始碼的 Android Jetpack 支援程式庫,可讓開發人員更輕鬆地在 Android 應用程式中建構相機功能。CameraX 已與所有 Microsoft 智慧鏡頭工具整合,確保特定應用程式能使用高畫質圖片。CameraX 也簡化了開發人員的 API,並適用於 94% 的 Android 裝置。Microsoft 智慧鏡頭團隊改用 CameraX 後,得以解決效能問題、提高開發人員的工作效率,並縮短上市時間。
成果

Microsoft 智慧鏡頭團隊發現,實作 CameraX 程式庫後,開發人員縮短了測試和最佳化週期,因此為開發人員省下了大量時間。他們估計 CameraX 的整合時間比 Camera2 花了 4 個月,需要約 6 次。
「與 Camera1 API 相比,CameraX 可以更輕鬆地設定解析度、顯示比例、圖片旋轉和拍攝品質等屬性,有助於整合工作和時間。Microsoft 的首席軟體工程師 Vishal Bhatnagar 表示,CameraX 會在內部處理狀態 (開啟/關閉相機),同時使用者切換不同應用程式,同時減少了程式碼進行整合,開發人員也更能專注於商業邏輯,而非應用程式重設狀態。

與 Camera1 相比,使用 CameraX 後,Microsoft 的啟動及擷取效能大幅提升。他們在新型 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 和/或其關係企業的商標或註冊商標。
上次更新時間:2022-01-31 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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."]]