computervision

package
v45.1.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package computervision implements the Azure ARM Computervision service API version 3.0-preview.

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserAgent

func UserAgent() string

UserAgent returns the UserAgent string to use when sending http.Requests.

func Version

func Version() string

Version returns the semantic version (see http://semver.org) of the client.

Types

type AnalyzeResults

type AnalyzeResults struct {
	// Version - Version of schema used for this result.
	Version *string `json:"version,omitempty"`
	// ReadResults - Text extracted from the input.
	ReadResults *[]ReadResult `json:"readResults,omitempty"`
}

AnalyzeResults analyze batch operation result.

type BaseClient

type BaseClient struct {
	autorest.Client
	Endpoint string
}

BaseClient is the base client for Computervision.

func New

func New(endpoint string) BaseClient

New creates an instance of the BaseClient client.

func NewWithoutDefaults

func NewWithoutDefaults(endpoint string) BaseClient

NewWithoutDefaults creates an instance of the BaseClient client.

func (BaseClient) GetReadResult

func (client BaseClient) GetReadResult(ctx context.Context, operationID uuid.UUID) (result ReadOperationResult, err error)

GetReadResult 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 Read interface. Parameters: operationID - id of read operation returned in the response of the 'Read' interface.

func (BaseClient) GetReadResultPreparer

func (client BaseClient) GetReadResultPreparer(ctx context.Context, operationID uuid.UUID) (*http.Request, error)

GetReadResultPreparer prepares the GetReadResult request.

func (BaseClient) GetReadResultResponder

func (client BaseClient) GetReadResultResponder(resp *http.Response) (result ReadOperationResult, err error)

GetReadResultResponder handles the response to the GetReadResult request. The method always closes the http.Response Body.

func (BaseClient) GetReadResultSender

func (client BaseClient) GetReadResultSender(req *http.Request) (*http.Response, error)

GetReadResultSender sends the GetReadResult request. The method will close the http.Response Body if it receives an error.

func (BaseClient) Read

func (client BaseClient) Read(ctx context.Context, imageURL ImageURL, language OcrDetectionLanguage) (result autorest.Response, err error)

Read 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 interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'GetReadResult' operation to access OCR results.​ Parameters: imageURL - a JSON document with a URL pointing to the image that is to be analyzed. language - the BCP-47 language code of the text to be detected in the image. In future versions, when language parameter is not passed, language detection will be used to determine the language. However, in the current version, missing language parameter will cause English to be used. To ensure that your document is always parsed in English without the use of language detection in the future, pass “en” in the language parameter

func (BaseClient) ReadInStream

func (client BaseClient) ReadInStream(ctx context.Context, imageParameter io.ReadCloser, language OcrDetectionLanguage) (result autorest.Response, err error)

ReadInStream 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 interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'GetReadResult' operation to access OCR results.​ Parameters: imageParameter - an image stream. language - the BCP-47 language code of the text to be detected in the image. In future versions, when language parameter is not passed, language detection will be used to determine the language. However, in the current version, missing language parameter will cause English to be used. To ensure that your document is always parsed in English without the use of language detection in the future, pass “en” in the language parameter

func (BaseClient) ReadInStreamPreparer

func (client BaseClient) ReadInStreamPreparer(ctx context.Context, imageParameter io.ReadCloser, language OcrDetectionLanguage) (*http.Request, error)

ReadInStreamPreparer prepares the ReadInStream request.

func (BaseClient) ReadInStreamResponder

func (client BaseClient) ReadInStreamResponder(resp *http.Response) (result autorest.Response, err error)

ReadInStreamResponder handles the response to the ReadInStream request. The method always closes the http.Response Body.

func (BaseClient) ReadInStreamSender

func (client BaseClient) ReadInStreamSender(req *http.Request) (*http.Response, error)

ReadInStreamSender sends the ReadInStream request. The method will close the http.Response Body if it receives an error.

func (BaseClient) ReadPreparer

func (client BaseClient) ReadPreparer(ctx context.Context, imageURL ImageURL, language OcrDetectionLanguage) (*http.Request, error)

ReadPreparer prepares the Read request.

func (BaseClient) ReadResponder

func (client BaseClient) ReadResponder(resp *http.Response) (result autorest.Response, err error)

ReadResponder handles the response to the Read request. The method always closes the http.Response Body.

func (BaseClient) ReadSender

func (client BaseClient) ReadSender(req *http.Request) (*http.Response, error)

ReadSender sends the Read request. The method will close the http.Response Body if it receives an error.

type Error

type Error struct {
	// Code - The error code.
	Code interface{} `json:"code,omitempty"`
	// Message - A message explaining the error reported by the service.
	Message *string `json:"message,omitempty"`
	// RequestID - A unique request identifier.
	RequestID *string `json:"requestId,omitempty"`
}

Error details about the API request error.

type ImageURL

type ImageURL struct {
	// URL - Publicly reachable URL of an image.
	URL *string `json:"url,omitempty"`
}

ImageURL ...

type Line

type Line struct {
	// Language - The BCP-47 language code of the recognized text line. Only provided where the language of the line differs from the page's.
	Language *string `json:"language,omitempty"`
	// BoundingBox - Bounding box of a recognized line.
	BoundingBox *[]float64 `json:"boundingBox,omitempty"`
	// Text - The text content of the line.
	Text *string `json:"text,omitempty"`
	// Words - List of words in the text line.
	Words *[]Word `json:"words,omitempty"`
}

Line an object representing a recognized text line.

type OcrDetectionLanguage

type OcrDetectionLanguage string

OcrDetectionLanguage enumerates the values for ocr detection language.

const (
	// En ...
	En OcrDetectionLanguage = "en"
	// Es ...
	Es OcrDetectionLanguage = "es"
)

func PossibleOcrDetectionLanguageValues

func PossibleOcrDetectionLanguageValues() []OcrDetectionLanguage

PossibleOcrDetectionLanguageValues returns an array of possible values for the OcrDetectionLanguage const type.

type OperationStatusCodes

type OperationStatusCodes string

OperationStatusCodes enumerates the values for operation status codes.

const (
	// Failed ...
	Failed OperationStatusCodes = "failed"
	// NotStarted ...
	NotStarted OperationStatusCodes = "notStarted"
	// Running ...
	Running OperationStatusCodes = "running"
	// Succeeded ...
	Succeeded OperationStatusCodes = "succeeded"
)

func PossibleOperationStatusCodesValues

func PossibleOperationStatusCodesValues() []OperationStatusCodes

PossibleOperationStatusCodesValues returns an array of possible values for the OperationStatusCodes const type.

type ReadOperationResult

type ReadOperationResult struct {
	autorest.Response `json:"-"`
	// Status - Status of the read operation. Possible values include: 'NotStarted', 'Running', 'Failed', 'Succeeded'
	Status OperationStatusCodes `json:"status,omitempty"`
	// CreatedDateTime - Get UTC date time the batch operation was submitted.
	CreatedDateTime *date.Time `json:"createdDateTime,omitempty"`
	// LastUpdatedDateTime - Get last updated UTC date time of this batch operation.
	LastUpdatedDateTime *date.Time `json:"lastUpdatedDateTime,omitempty"`
	// AnalyzeResult - Analyze batch operation result.
	AnalyzeResult *AnalyzeResults `json:"analyzeResult,omitempty"`
}

ReadOperationResult OCR result of the read operation.

type ReadResult

type ReadResult struct {
	// Page - The 1-based page number of the recognition result.
	Page *int32 `json:"page,omitempty"`
	// Language - The BCP-47 language code of the recognized text page.
	Language *string `json:"language,omitempty"`
	// Angle - The orientation of the image in degrees in the clockwise direction. Range between [-180, 180).
	Angle *float64 `json:"angle,omitempty"`
	// Width - The width of the image in pixels or the PDF in inches.
	Width *float64 `json:"width,omitempty"`
	// Height - The height of the image in pixels or the PDF in inches.
	Height *float64 `json:"height,omitempty"`
	// Unit - The unit used in the Width, Height and BoundingBox. For images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible values include: 'Pixel', 'Inch'
	Unit TextRecognitionResultDimensionUnit `json:"unit,omitempty"`
	// Lines - A list of recognized text lines.
	Lines *[]Line `json:"lines,omitempty"`
}

ReadResult text extracted from a page in the input document.

type TextRecognitionResultDimensionUnit

type TextRecognitionResultDimensionUnit string

TextRecognitionResultDimensionUnit enumerates the values for text recognition result dimension unit.

const (
	// Inch ...
	Inch TextRecognitionResultDimensionUnit = "inch"
	// Pixel ...
	Pixel TextRecognitionResultDimensionUnit = "pixel"
)

func PossibleTextRecognitionResultDimensionUnitValues

func PossibleTextRecognitionResultDimensionUnitValues() []TextRecognitionResultDimensionUnit

PossibleTextRecognitionResultDimensionUnitValues returns an array of possible values for the TextRecognitionResultDimensionUnit const type.

type Word

type Word struct {
	// BoundingBox - Bounding box of a recognized word.
	BoundingBox *[]float64 `json:"boundingBox,omitempty"`
	// Text - The text content of the word.
	Text *string `json:"text,omitempty"`
	// Confidence - Qualitative confidence measure.
	Confidence *float64 `json:"confidence,omitempty"`
}

Word an object representing a recognized word.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL