Dokumentacja wspólnej platformy MLKitSegmentation
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Segmentator
class Segmenter : NSObject
Detektor, który segmentuje obrazy wejściowe.
-
Zwraca segmenter z podanymi opcjami.
Deklaracja
Swift
class func segmenter(options: MLKCommonSegmenterOptions) -> Self
Parametry
options
|
Opcje konfigurowania segmentacji.
|
Zwracana wartość
Segmenter skonfigurowany z użyciem podanych opcji.
-
Niedostępne. Używaj metod klasy.
-
Przetwarza dany obraz na segmenty.
Parametry
image
|
|
completion
|
Moduł obsługi wywołujący w wątku głównym z maską podziału na segmenty lub błędem.
|
-
Zwraca maskę podziału na segmenty w przypadku danego obrazu lub nil
, jeśli wystąpił błąd. Podział na segmenty jest wykonywany synchronicznie w wątku wywołania.
Aby uniknąć blokowania interfejsu, zalecamy wywołanie tej metody z wątku głównego. Jako
wynik, jeśli ta metoda zostanie wywołana w wątku głównym, zostanie podniesiony NSException
.
Parametry
image
|
Obraz, do którego chcesz uzyskać wyniki.
|
error
|
Opcjonalny parametr błędu jest wypełniany w przypadku wystąpienia błędu podczas pobierania wyników.
|
Zwracana wartość
Maska podziału na segmenty na danym obrazie lub nil
, jeśli wystąpił błąd.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-10-15 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2024-10-15 UTC."],[[["The `Segmenter` class performs segmentation on input images to identify different regions or objects."],["It provides methods for asynchronous and synchronous processing of images for segmentation."],["You can configure the segmenter using `MLKCommonSegmenterOptions` when initializing."],["Results are provided as an `MLKSegmentationMask` object which can be used to understand the identified segments."],["Direct instantiation with `init` is unavailable; use the provided class methods like `segmenter(options:)` instead."]]],["The `Segmenter` class performs image segmentation. It's initialized using `segmenter(options:)` with `MLKCommonSegmenterOptions`. Segmentation is achieved via `process(_:)`, which asynchronously processes an image and returns an `MLKSegmentationMask`. Alternatively, `results(in:)` synchronously returns the segmentation mask, but it must be called off the main thread to prevent UI blocking; it also takes an image as an input and return a `MLKSegmentationMask`. Direct initialization via `init` is unavailable.\n"]]