Riferimento framework MLKitVision
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
VisionImage
Un'immagine o un buffer di immagine utilizzato per il rilevamento visivo.
-
L'orientamento di visualizzazione dell'immagine. Il valore predefinito è .up
.
Dichiarazione
Swift
var orientation: Int32 { get set }
-
Inizializza un oggetto VisionImage
con l'immagine specificata.
Parametri
image
|
Immagine da utilizzare per il rilevamento visivo. L'immagine fornita deve essere ruotata, in modo che
La proprietà imageOrientation è impostata su .up . UIImage deve avere CGImage non NULL
proprietà.
|
Valore restituito
Un'istanza VisionImage
con l'immagine specificata.
-
Inizializza un oggetto VisionImage
con il buffer di immagine specificato. Per migliorare le prestazioni,
Si consiglia di minimizzare la durata e il numero di istanze di questa classe durante l'inizializzazione con
CMSampleBufferRef
.
Dichiarazione
Swift
init(buffer sampleBuffer: CMSampleBuffer)
Parametri
sampleBuffer
|
Buffer immagine da usare per il rilevamento visivo. Il buffer deve essere basato su
un buffer di pixel (non dati compressi) e il formato dei pixel deve essere uno dei seguenti:
- kCVPixelFormatType_32BGRA
- kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
- kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
In pratica: funziona con l'output video della fotocamera dello smartphone, ma non con altri
sorgenti arbitrarie di CMSampleBufferRef .
|
Valore restituito
Un'istanza VisionImage
con il buffer di immagine specificato.
-
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2024-08-22 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2024-08-22 UTC."],[[["`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."]]],["`VisionImage` is a class for vision detection using images or image buffers. It has a settable `orientation` property, defaulting to `.up`. It initializes with either an `image`, requiring a rotated image with an `.up` orientation and a non-NULL `CGImage`, or a `CMSampleBuffer` image buffer with specified pixel formats. When using `CMSampleBufferRef`, minimize instance lifespan. Direct initialization using `init()` is unavailable.\n"]]