MLKitTextRecognitionCommon フレームワーク リファレンス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
TextRecognizer
class TextRecognizer : NSObject
画像内のテキストを認識するテキスト認識ツール。
-
指定されたオプションを使用してテキスト認識ツールを返します。
言語の異なる複数の TextRecognizer
インスタンスの同時使用
パフォーマンスの低下につながる可能性があるため、おすすめしません。
宣言
Swift
class func textRecognizer(options: MLKCommonTextRecognizerOptions) -> Self
戻り値
指定されたオプションで構成されたテキスト認識ツール。
-
パラメータ
image
|
|
completion
|
テキスト認識完了時にメインキューでコールバックするハンドラ。
|
-
指定された画像のテキスト認識結果を返します。エラーが発生した場合は nil
を返します。テキスト
呼び出しのスレッドで同期的に実行されます。
UI をブロックしないよう、このメソッドはメインスレッドの外部で呼び出すことをおすすめします。たとえば、
このメソッドがメインスレッドで呼び出されると、NSException
が発生します。
パラメータ
image
|
|
error
|
結果の取得中にエラーが発生した場合に入力されるエラー パラメータ(省略可)。
|
戻り値
指定された画像でのテキスト認識の結果。エラーが発生した場合は nil
。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[[["わかりやすい","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"]],["最終更新日 2025-07-25 UTC。"],[[["`TextRecognizer` identifies and extracts text within images."],["It offers both synchronous and asynchronous processing options."],["Concurrent use with varying language settings may impact performance."],["Direct use on the main thread is discouraged due to potential UI blocking."]]],["The `TextRecognizer` class recognizes text in images. It can be initialized with specific options via `textRecognizer(options:)`. The `process(_:)` method performs text recognition on an image asynchronously, while `results(in:)` performs it synchronously, returning the recognized text or `nil` if an error occurs. Concurrent usage of multiple `TextRecognizer` instances with different language options may reduce performance. `results(in:)` should not be called on the main thread.\n"]]