MLKitVision 架構參考資料
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
VisionImage
用於視覺偵測的圖片或影像緩衝區。
-
聲明
Swift
var orientation: Int32 { get set }
-
使用指定圖片初始化 VisionImage
物件。
參數
image
|
用於視覺偵測的圖片。指定圖片必須旋轉,所以
imageOrientation 屬性已設為 .up 。UIImage 必須包含非空值的 CGImage
資源。
|
傳回值
具有指定映像檔的 VisionImage
執行個體。
-
使用指定圖片緩衝區初始化 VisionImage
物件。為了提升效能
使用 Cloud Build 初始化變數時,建議盡可能減少這個類別的生命週期和例項數量
CMSampleBufferRef
。
聲明
Swift
init(buffer sampleBuffer: CMSampleBuffer)
參數
sampleBuffer
|
用於視覺偵測的圖片緩衝區。緩衝區必須
像素緩衝區 (非壓縮資料),而且像素格式必須是下列其中一個:
- kCVPixelFormatType_32BGRA
- kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
- kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
實務上:僅使用手機鏡頭的視訊輸出裝置
CMSampleBufferRef 的任意來源。
|
傳回值
含有指定圖片緩衝區的 VisionImage
執行個體。
-
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-22 (世界標準時間)。
[[["容易理解","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"]],["上次更新時間:2024-08-22 (世界標準時間)。"],[[["`VisionImage` is an object used for vision detection tasks, accepting images or image buffers as input."],["It's crucial to set the `imageOrientation` property of input `UIImage` to `.up` before initialization to ensure proper orientation."],["When using `CMSampleBufferRef` for initialization, ensure it's a pixel buffer with a supported pixel format like `kCVPixelFormatType_32BGRA` for optimal performance."],["For `CMSampleBufferRef` inputs, compatibility is primarily with phone camera output, not arbitrary buffer sources."],["Direct initialization using `init()` is unavailable; utilize `init(image:)` or `init(buffer:)` instead."]]],[]]