HSOCRResult
TypeThe result of a text recognition operation on an image.
An HSOCRResult is returned by hs.ocr.recognizeText() and bundles the
full recognized text together with an array of per-region observations,
each carrying its own confidence score and bounding box.
- Example:
const result = await hs.ocr.recognizeText('/tmp/image.png')
console.log('Full text: ' + result.text)
console.log('Regions found: ' + result.observations.length)
result.observations.forEach(obs => {
console.log(obs.text + ' (' + (obs.confidence * 100).toFixed(0) + '%)')
})
Properties
text
string
The full recognized text from the image, with each observation's text
joined by newlines in the order Vision returned them.
Use this when you only need the raw text and don't care about bounding
boxes or per-region confidence scores.
observations
HSOCRObservation[]
The individual text observations that make up this result.
Each entry in the array is an `HSOCRObservation` with its own `text`,
`confidence`, and `bounds` properties. Observations are returned in the
order Vision produced them (typically top-to-bottom, left-to-right, but
this is image-dependent).
Methods
This type has no methods.