DataFire integration for Computer Vision Client
npm install @datafire/microsoft_cognitiveservices_ocrClient library for Computer Vision Client
bash
npm install --save @datafire/microsoft_cognitiveservices_ocr
`
`js
let microsoft_cognitiveservices_ocr = require('@datafire/microsoft_cognitiveservices_ocr').create({
apim_key: ""
});.then(data => {
console.log(data);
});
`Description
The Computer Vision API provides state-of-the-art algorithms to process images and return information. For example, it can be used to determine if an image contains mature content, or it can be used to find all the faces in an image. It also has other features like estimating dominant and accent colors, categorizing the content of images, and describing an image with complete English sentences. Additionally, it can also intelligently generate images thumbnails for displaying large images effectively.
Actions
$3
Use this interface to get the result of a Read operation, employing the state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read File interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'GetReadOperationResult' operation to access OCR results.
`js
microsoft_cognitiveservices_ocr.BatchReadFile({
"body": {
"url": ""
}
}, context)
`#### Input
* input
object
* body required ImageUrl#### Output
Output schema unknown
$3
This interface is used for getting OCR results of Read operation. The URL to this interface should be retrieved from 'Operation-Location' field returned from Batch Read File interface.
`js
microsoft_cognitiveservices_ocr.GetReadOperationResult({
"operationId": ""
}, context)
`#### Input
* input
object
* operationId required string: Id of read operation returned in the response of the 'Batch Read File' interface.#### Output
* output ReadOperationResult
$3
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation.
`js
microsoft_cognitiveservices_ocr.RecognizeText({
"mode": "",
"body": {
"url": ""
}
}, context)
`#### Input
* input
object
* mode required string (values: Handwritten, Printed): Type of text to recognize.
* body required ImageUrl#### Output
Output schema unknown
$3
This interface is used for getting text operation result. The URL to this interface should be retrieved from 'Operation-Location' field returned from Recognize Text interface.
`js
microsoft_cognitiveservices_ocr.GetTextOperationResult({
"operationId": ""
}, context)
`#### Input
* input
object
* operationId required string: Id of the text operation returned in the response of the 'Recognize Text'#### Output
* output TextOperationResult
Definitions
$3
* BoundingBox array: Quadrangle bounding box, with coordinates in original image. The eight numbers represent the four points (x-coordinate, y-coordinate from the left-top corner of the image) of the detected rectangle from the left-top corner in the clockwise direction. For images, coordinates are in pixels. For PDF, coordinates are in inches.
* items number$3
* ComputerVisionError object: Details about the API request error.
* code required string (values: InvalidImageFormat, UnsupportedMediaType, InvalidImageUrl, NotSupportedFeature, NotSupportedImage, Timeout, InternalServerError, InvalidImageSize, BadArgument, DetectFaceError, NotSupportedLanguage, InvalidThumbnailSize, InvalidDetails, InvalidModel, CancelledRequest, NotSupportedVisualFeature, FailedToProcess, Unspecified, StorageException): The error code.
* message required string: A message explaining the error reported by the service.
* requestId string: A unique request identifier.$3
* ImageUrl object
* url required string: Publicly reachable URL of an image.$3
* Line object: An object representing a recognized text line.
* boundingBox BoundingBox
* text string: The text content of the line.
* words array: List of words in the text line.
* items Word$3
* OperationStatus string (values: NotStarted, Running, Failed, Succeeded): Status code of the text operation.$3
* ReadOperationResult object: OCR result of the read operation.
* recognitionResults array: An array of text recognition result of the read operation.
* items TextRecognitionResult
* status OperationStatus$3
* TextOperationResult object: Result of recognition text operation.
* recognitionResult TextRecognitionResult
* status OperationStatus$3
* TextRecognitionResult object: An object representing a recognized text region
* clockwiseOrientation number: The orientation of the image in degrees in the clockwise direction. Range between 0, 360).
* height number: The height of the image in pixels or the PDF in inches.
* lines required array: A list of recognized text lines.
* items [Line
* page integer: The 1-based page number of the recognition result.
* unit string (values: pixel, inch): The unit used in the Width, Height and BoundingBox. For images, the unit is 'pixel'. For PDF, the unit is 'inch'.
* width number: The width of the image in pixels or the PDF in inches.$3
* Word object: An object representing a recognized word.
* boundingBox required BoundingBox
* confidence string (values: High, Low): Qualitative confidence measure.
* text required string`: The text content of the word.