One Logo Pool Ball
Vision · IOS API REFERENCE

RecognizeTextRequest

struct · iOS 18.0+ · SDK 27.1

struct RecognizeTextRequest

An image-analysis request that recognizes text in an image. This request generates a collection of ``RecognizedTextObservation`` objects that each correspond to a line of text detected in the image. By default the request will detect English. To detect other languages, set `recognitionLanguages` to an array that contains the languages you want to recognize. To detect any supported language, set `automaticallyDetectsLanguage` to true. Enabling automatic language detection will cause the val To see the list of supported languages, call `supportedRecognitionLanguages`.

Members (21)

get · iOS 18.0+

minimumTextHeightFraction

TypeScript
get minimumTextHeightFraction(): number
Swift declaration
var minimumTextHeightFraction: Float

The minimum height, relative to the image height, of the text to recognize. Specify a floating-point number relative to the image height. For example, to limit recognition to text that’s half of the image height, use 0.5. Increasing the size reduces memory consumption and expedites recognition with the tradeoff of ignoring text smaller than the minimum height. The default value is 1/32, or 0.03125.

set · iOS 18.0+

minimumTextHeightFraction

TypeScript
set minimumTextHeightFraction(value: number)
Swift declaration
var minimumTextHeightFraction: Float

The minimum height, relative to the image height, of the text to recognize. Specify a floating-point number relative to the image height. For example, to limit recognition to text that’s half of the image height, use 0.5. Increasing the size reduces memory consumption and expedites recognition with the tradeoff of ignoring text smaller than the minimum height. The default value is 1/32, or 0.03125.

get · iOS 18.0+

descriptor

TypeScript
get descriptor(): RequestDescriptor
Swift declaration
var descriptor: RequestDescriptor { get }

An enum that identifies the request and request revision.

get · iOS 18.0+

customWords

TypeScript
get customWords(): Array<string>
Swift declaration
var customWords: [String]

An array of strings to supplement the recognized languages at the word-recognition stage. Custom words take precedence over the standard lexicon. The request ignores this value if `usesLanguageCorrection` is `false`.

set · iOS 18.0+

customWords

TypeScript
set customWords(value: Array<string>)
Swift declaration
var customWords: [String]

An array of strings to supplement the recognized languages at the word-recognition stage. Custom words take precedence over the standard lexicon. The request ignores this value if `usesLanguageCorrection` is `false`.

get · iOS 18.0+

recognitionLevel

TypeScript
get recognitionLevel(): RecognizeTextRequest_RecognitionLevel
Swift declaration
var recognitionLevel: RecognizeTextRequest.RecognitionLevel

A value that determines whether the request prioritizes accuracy or speed in text recognition.

set · iOS 18.0+

recognitionLevel

TypeScript
set recognitionLevel(value: RecognizeTextRequest_RecognitionLevel)
Swift declaration
var recognitionLevel: RecognizeTextRequest.RecognitionLevel

A value that determines whether the request prioritizes accuracy or speed in text recognition.

get · iOS 18.0+

regionOfInterest

TypeScript
get regionOfInterest(): NormalizedRect
Swift declaration
var regionOfInterest: NormalizedRect

The region of the image in which Vision will perform the request. The rectangle is normalized to the dimensions of the processed image. Its origin is specified relative to the image's lower-left corner. By default, the region of interest will be the full image.

set · iOS 18.0+

regionOfInterest

TypeScript
set regionOfInterest(value: NormalizedRect)
Swift declaration
var regionOfInterest: NormalizedRect

The region of the image in which Vision will perform the request. The rectangle is normalized to the dimensions of the processed image. Its origin is specified relative to the image's lower-left corner. By default, the region of interest will be the full image.

method · iOS 18.0+

setComputeDevice

TypeScript
setComputeDevice(computeDevice: (_CoreML_MLComputeDevice) | null, computeStage: ComputeStage): void
Swift declaration
mutating func setComputeDevice(_ computeDevice: MLComputeDevice?, for computeStage: ComputeStage)

Assigns a compute device for a compute stage. If the parameter `computeDevice` is `nil`, the framework removes any explicit compute device assignment and allows the framework to select the device. Configure any compute device for a given compute stage. When performing a request, the system makes a validity check. Use `supportedComputeStageDevices` to get valid compute devices for a request’s compute stages. - Parameters: - `computeDevice: `The compute device to assign to the compute stage. - `computeStage: `The compute stage.

get · iOS 18.0+

supportedRevisions

TypeScript
static get supportedRevisions(): Array<RecognizeTextRequest_Revision>
Swift declaration
static let supportedRevisions: [RecognizeTextRequest.Revision]

The collection of currently-supported revisions for `RecognizeTextRequest`.

get · iOS 18.0+

recognitionLanguages

TypeScript
get recognitionLanguages(): Array<_Foundation_Locale_Language>
Swift declaration
var recognitionLanguages: [Locale.Language]

An array of languages to detect, in priority order. The order of the languages in the array defines the order in which languages are used during language processing and text recognition.

set · iOS 18.0+

recognitionLanguages

TypeScript
set recognitionLanguages(value: Array<_Foundation_Locale_Language>)
Swift declaration
var recognitionLanguages: [Locale.Language]

An array of languages to detect, in priority order. The order of the languages in the array defines the order in which languages are used during language processing and text recognition.

get · iOS 18.0+

usesLanguageCorrection

TypeScript
get usesLanguageCorrection(): boolean
Swift declaration
var usesLanguageCorrection: Bool

A Boolean value that indicates whether the request applies language correction during the recognition process. When this value is `true`, Vision applies language correction during the recognition process. Disabling this property returns the raw recognition results, which provides performance benefits but less accurate results.

set · iOS 18.0+

usesLanguageCorrection

TypeScript
set usesLanguageCorrection(value: boolean)
Swift declaration
var usesLanguageCorrection: Bool

A Boolean value that indicates whether the request applies language correction during the recognition process. When this value is `true`, Vision applies language correction during the recognition process. Disabling this property returns the raw recognition results, which provides performance benefits but less accurate results.

get · iOS 18.0+

automaticallyDetectsLanguage

TypeScript
get automaticallyDetectsLanguage(): boolean
Swift declaration
var automaticallyDetectsLanguage: Bool

A Boolean value that indicates whether to attempt detecting the language to use the appropriate model for recognition and language correction.

set · iOS 18.0+

automaticallyDetectsLanguage

TypeScript
set automaticallyDetectsLanguage(value: boolean)
Swift declaration
var automaticallyDetectsLanguage: Bool

A Boolean value that indicates whether to attempt detecting the language to use the appropriate model for recognition and language correction.

get · iOS 18.0+

supportedComputeStageDevices

TypeScript
get supportedComputeStageDevices(): NativeMap<ComputeStage, Array<_CoreML_MLComputeDevice>>
Swift declaration
var supportedComputeStageDevices: [ComputeStage : [MLComputeDevice]] { get }
get · iOS 18.0+

supportedRecognitionLanguages

TypeScript
get supportedRecognitionLanguages(): Array<_Foundation_Locale_Language>
Swift declaration
var supportedRecognitionLanguages: [Locale.Language] { get }

The identifiers of the languages that the request supports.

get · iOS 18.0+

revision

TypeScript
get revision(): RecognizeTextRequest_Revision
Swift declaration
let revision: RecognizeTextRequest.Revision

The request's configured revision.

init · iOS 18.0+

init

TypeScript
static init(revision?: (RecognizeTextRequest_Revision) | null): RecognizeTextRequest
Swift declaration
init(_ revision: RecognizeTextRequest.Revision? = nil)

- Parameters: - revision: The specific algorithm or implementation revision that is to be used to perform the request.

Skipped declarations

No declarations were skipped in this snapshot.

All Vision types →