Documentation ¶
Index ¶
- Constants
- type Block
- type Break
- type CropEntity
- type CropHint
- type DocumentEntity
- type Entity
- type FeatureType
- type Language
- type Likelihood
- type Page
- type Paragraph
- type Resource
- type Response
- func (r *Response) CropResult() []CropEntity
- func (r *Response) DocumentResult() []DocumentEntity
- func (r *Response) FaceResult() []float64
- func (r *Response) LabelResult() []Entity
- func (r *Response) LandmarkResult() []Entity
- func (r *Response) Len() int
- func (r *Response) LogoResult() []Entity
- func (r *Response) SafeResult() []SafeEntity
- func (r *Response) TextResult() []string
- func (r *Response) WebResult() []WebEntity
- type SafeEntity
- type Symbol
- type TextProperty
- type Vertex
- type Vision
- func (v *Vision) Crop(image []byte) (*Response, error)
- func (v *Vision) Document(image []byte) (*Response, error)
- func (v *Vision) Errorf(format string, vv ...interface{})
- func (v *Vision) Face(image []byte) (*Response, error)
- func (v *Vision) Get(r *Resource) (*Response, error)
- func (v *Vision) GetFromByte(image []byte) (*Response, error)
- func (v *Vision) Label(image []byte) (*Response, error)
- func (v *Vision) Landmark(image []byte) (*Response, error)
- func (v *Vision) Logo(image []byte) (*Response, error)
- func (v *Vision) Properties(image []byte) (*Response, error)
- func (v *Vision) Safe(image []byte) (*Response, error)
- func (v *Vision) SetLogger(logger log.Logger)
- func (v *Vision) Text(image []byte) (*Response, error)
- func (v *Vision) Web(image []byte) (*Response, error)
- type WebEntity
- type WebLabel
- type WebPage
- type Word
Constants ¶
const ( LikelihoodTextUnknown = "UNKNOWN" LikelihoodTextVeryUnlikely = "VERY_UNLIKELY" LikelihoodTextUnlikely = "UNLIKELY" LikelihoodTextPossible = "POSSIBLE" LikelihoodTextLikely = "LIKELY" LikelihoodTextVeryLikely = "VERY_LIKELY" )
Likelihood list of string result.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶ added in v0.3.3
type Block struct { TextProperty BlockType string Confidence float64 Paragraphs []Paragraph Vertices []Vertex }
Block is wrapper struct for SDK.Block.
type Break ¶ added in v0.3.3
Break is wrapper struct for SDK.DetectedBreak.
func NewBreak ¶ added in v0.3.3
func NewBreak(b *SDK.DetectedBreak) Break
NewBreak creates Break from SDK.DetectedBreak.
type CropEntity ¶ added in v0.3.3
type CropEntity struct {
Hints []CropHint
}
CropEntity contains result of Crop Hints.
func NewCropEntity ¶ added in v0.3.3
func NewCropEntity(anno *SDK.CropHintsAnnotation) CropEntity
NewCropEntity creates CropEntity from result of Web Detection.
type CropHint ¶ added in v0.3.3
CropHint is wrapper struct for SDK.CropHint.
func NewCropHint ¶ added in v0.3.3
NewCropHint creates CropHint from SDK.CropHint.
type DocumentEntity ¶ added in v0.3.3
DocumentEntity contains result of Crop Hints.
func NewDocumentEntity ¶ added in v0.3.3
func NewDocumentEntity(anno *SDK.TextAnnotation) DocumentEntity
NewDocumentEntity creates DocumentEntity from result of Web Detection.
type FeatureType ¶
type FeatureType string
FeatureType is type for feature.
const ( FeatureUnspecified FeatureType = "TYPE_UNSPECIFIED" FeatureFace FeatureType = "FACE_DETECTION" FeatureLandmark FeatureType = "LANDMARK_DETECTION" FeatureLogo FeatureType = "LOGO_DETECTION" FeatureLabel FeatureType = "LABEL_DETECTION" FeatureText FeatureType = "TEXT_DETECTION" FeatureDocument FeatureType = "DOCUMENT_TEXT_DETECTION" FeatureSafe FeatureType = "SAFE_SEARCH_DETECTION" FeatureProperties FeatureType = "IMAGE_PROPERTIES" FeatureCrop FeatureType = "CROP_HINTS" FeatureWeb FeatureType = "WEB_DETECTION" )
FeatureType list
func (FeatureType) Feature ¶
func (f FeatureType) Feature(max int64) *SDK.Feature
Feature creates *SDK.Feature.
func (FeatureType) String ¶
func (f FeatureType) String() string
type Language ¶ added in v0.3.3
Language is wrapper struct for SDK.Language.
func NewLanguage ¶ added in v0.3.3
func NewLanguage(l *SDK.DetectedLanguage) Language
NewLanguage creates Language from SDK.Language.
type Likelihood ¶
type Likelihood int
Likelihood is likelihood of detection result.
const ( LikelihoodError Likelihood = iota LikelihoodUnknown LikelihoodVeryUnlikely LikelihoodUnlikely LikelihoodPossible LikelihoodLikely LikelihoodVeryLikely )
Likelihood list.
func (Likelihood) IsError ¶
func (l Likelihood) IsError() bool
IsError checks if Likelifood is error.
func (Likelihood) Likely ¶
func (l Likelihood) Likely() bool
Likely checks if Likelifood is more than Likely.
func (Likelihood) Possible ¶
func (l Likelihood) Possible() bool
Possible checks if Likelifood is more than Possible.
func (Likelihood) String ¶
func (l Likelihood) String() string
func (Likelihood) Unknown ¶
func (l Likelihood) Unknown() bool
Unknown checks if Likelifood is more than Unknown.
func (Likelihood) Unlikely ¶
func (l Likelihood) Unlikely() bool
Unlikely checks if Likelifood is more than Unlikely.
func (Likelihood) VeryLikely ¶
func (l Likelihood) VeryLikely() bool
VeryLikely checks if Likelifood is more than VeryLikely.
func (Likelihood) VeryUnlikely ¶
func (l Likelihood) VeryUnlikely() bool
VeryUnlikely checks if Likelifood is more than VeryUnlikely.
type Page ¶ added in v0.3.3
type Page struct { TextProperty Blocks []Block Confidence float64 Height int64 Width int64 }
Page is wrapper struct for SDK.Page.
type Paragraph ¶ added in v0.3.3
type Paragraph struct { TextProperty Confidence float64 Vertices []Vertex Words []Word }
Paragraph is wrapper struct for SDK.Paragraph.
func NewParagraph ¶ added in v0.3.3
NewParagraph creates Paragraph from SDK.Paragraph.
type Resource ¶
type Resource struct { Image []byte ImageList [][]byte ImageURL string ImageURLList []string IsBase64 bool Type FeatureType TypeList []FeatureType MaxResults int64 // options LanguageHints []string }
Resource is parameter struct for Annotate.
type Response ¶
type Response struct {
*SDK.BatchAnnotateImagesResponse
}
Response contains response from Annotate API.
func (*Response) CropResult ¶ added in v0.3.3
func (r *Response) CropResult() []CropEntity
CropResult returns all of data from crop hints results.
func (*Response) DocumentResult ¶ added in v0.3.3
func (r *Response) DocumentResult() []DocumentEntity
DocumentResult returns all of full text from OCR results.
func (*Response) FaceResult ¶
FaceResult returns all of detection score(0-1) from face detection results.
func (*Response) LabelResult ¶
LabelResult returns all of scores from label detection results.
func (*Response) LandmarkResult ¶
LandmarkResult returns all of scores from landmark detection results.
func (*Response) Len ¶
Len returns size of response. This coinsides the number of images in request.
func (*Response) LogoResult ¶
LogoResult returns all of scores from logo detection results.
func (*Response) SafeResult ¶
func (r *Response) SafeResult() []SafeEntity
SafeResult returns all of text from safe-search results.
func (*Response) TextResult ¶
TextResult returns all of text from OCR results.
type SafeEntity ¶
type SafeEntity struct { Adult Likelihood Spoof Likelihood Medical Likelihood Violence Likelihood }
SafeEntity contains result of SafeSearch.
func NewSafeEntity ¶
func NewSafeEntity(anno *SDK.SafeSearchAnnotation) SafeEntity
NewSafeEntity creates SafeEntity from result of SafeSearchAnnotation.
type Symbol ¶ added in v0.3.3
type Symbol struct { TextProperty Text string Confidence float64 Vertices []Vertex }
Symbol is wrapper struct for SDK.Symbol.
type TextProperty ¶ added in v0.3.3
TextProperty is wrapper struct for SDK.TextProperty.
func NewTextProperty ¶ added in v0.3.3
func NewTextProperty(p *SDK.TextProperty) TextProperty
NewTextProperty creates TextProperty from SDK.TextProperty.
type Vertex ¶ added in v0.3.3
Vertex has a 2D point in the image.
func NewVertices ¶ added in v0.3.3
func NewVertices(p *SDK.BoundingPoly) []Vertex
NewVertices creates []Vertex from *SDK.BoundingPoly.
type Vision ¶
type Vision struct {
// contains filtered or unexported fields
}
Vision repesents Cloud Vision API client.
func (*Vision) Document ¶ added in v0.3.3
Document sends image to API and detects document OCR feature type.
func (*Vision) GetFromByte ¶
GetFromByte sends image to API and detects all of feature types.
func (*Vision) Properties ¶
Properties sends image to API and detects propaties of images.
type WebEntity ¶ added in v0.3.3
type WebEntity struct { Labels []WebLabel FullMatchingImages []string // URL PartialMatchingImages []string VisuallySimilarImages []string Entities []Entity Pages []WebPage }
WebEntity contains result of Web Detection.
func NewWebEntity ¶ added in v0.3.3
func NewWebEntity(anno *SDK.WebDetection) WebEntity
NewWebEntity creates WebEntity from result of Web Detection.
func (WebEntity) GetMatchingURL ¶ added in v0.3.3
GetMatchingURL returns all of matching image url.
type WebLabel ¶ added in v0.3.3
WebLabel is wrapper strcut for SDK.WebLabel.
func NewWebLabels ¶ added in v0.3.3
NewWebLabels creates []WebLabel from []SDK.WebLabel.