vision

package
v0.0.0-...-52824e0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

vision project vision.go license MIT powered by github.com/ahmdrz full api reference on https://dev.projectoxford.ai/docs/services/56f91f2d778daf23d8ec6739/

Index

Constants

View Source
const (
	URL                     string = "https://api.projectoxford.ai/vision/v1.0"
	LANG_AutoDetect         string = "unk"
	LANG_ChineseSimplified  string = "zh-Hans"
	LANG_ChineseTraditional string = "zh-Hant"
	LANG_Czech              string = "cs"
	LANG_Danish             string = "da"
	LANG_Dutch              string = "nl"
	LANG_English            string = "en"
	LANG_Finnish            string = "fi"
	LANG_French             string = "fr"
	LANG_German             string = "de"
	LANG_Greek              string = "el"
	LANG_Hungarian          string = "hu"
	LANG_Italian            string = "it"
	LANG_Japanese           string = "Ja"
	LANG_Korean             string = "ko"
	LANG_Norwegian          string = "nb"
	LANG_Polish             string = "pl"
	LANG_Portuguese         string = "pt"
	LANG_Russian            string = "ru"
	LANG_Spanish            string = "es"
	LANG_Swedish            string = "sv"
	LANG_Turkish            string = "tr"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adult

type Adult struct {
	IsAdultContent bool    `json:"isAdultContent"`
	IsRacyContent  bool    `json:"isRacyContent"`
	AdultScore     float64 `json:"adultScore"`
	RacyScore      float64 `json:"racyScore"`
}

type Caption

type Caption struct {
	Text       string  `json:"text"`
	Confidence float64 `json:"confidence"`
}

type Category

type Category struct {
	Name  string  `json:"name"`
	Score float32 `json:"score"`
}

type Color

type Color struct {
	DominantColorForeground string   `json:"dominantColorForeground"`
	DominantColorBackground string   `json:"dominantColorBackground"`
	AccentColor             string   `json:"accentColor"`
	IsBWImg                 bool     `json:"isBWImg"`
	DominantColors          []string `json:"dominantColors"`
}

type Description

type Description struct {
	Tags     []string  `json:"tags"`
	Captions []Caption `json:"captions"`
}

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Face

type Face struct {
	Age           int       `json:"age"`
	Gender        string    `json:"gender"`
	FaceRectangle Rectangle `json:"faceRectangle"`
}

type Image

type Image struct {
	Image []byte
}

func (Image) Save

func (image Image) Save(path string) error

type ImageType

type ImageType struct {
	ClipArtType     int `json:"clipArtType"`
	LineDrawingType int `json:"lineDrawingType"`
}

type Line

type Line struct {
	BoundingBox string `json:"boundingBox"`
	Words       []Word `json:"words"`
}

type MetaData

type MetaData struct {
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Format string `json:"format"`
}

type Model

type Model struct {
	Name       string   `json:"name"`
	Categories []string `json:"categories"`
}

type OCROption

type OCROption struct {
	Language          string
	DetectOrientation bool
}

func (OCROption) String

func (order OCROption) String() string

type Rectangle

type Rectangle struct {
	Top    int `json:"top"`
	Left   int `json:"left"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

type Region

type Region struct {
	BoundingBox string `json:"boundingBox"`
	Lines       []Line `json:"lines"`
}

type Tag

type Tag struct {
	Name       string  `json:"name"`
	Confidence float64 `json:"confidence"`
}

type ThumbnailOrder

type ThumbnailOrder struct {
	Width         int
	Height        int
	SmartCropping bool
}

type Vision

type Vision struct {
	BingKey       string
	LastRequestID string
}

Main struct of library , contains BingKey for saving token and LastRequestID for determine the request id of last method.

func New

func New(key string) (*Vision, error)

func (*Vision) Analyze

func (vision *Vision) Analyze(url string, order VisualFeatures) (VisionResult, error)

func (*Vision) AnalyzeFile

func (vision *Vision) AnalyzeFile(path string, order VisualFeatures) (VisionResult, error)

func (*Vision) Describe

func (vision *Vision) Describe(url string, max int) (VisionResult, error)

func (*Vision) DescribeFile

func (vision *Vision) DescribeFile(path string, max int) (VisionResult, error)

func (*Vision) GetModels

func (vision *Vision) GetModels() ([]Model, error)

func (*Vision) OCR

func (vision *Vision) OCR(url string, order OCROption) (VisionOCRResult, error)

func (*Vision) OCRFile

func (vision *Vision) OCRFile(path string, order OCROption) (VisionOCRResult, error)

func (*Vision) Tag

func (vision *Vision) Tag(url string) (VisionResult, error)

func (*Vision) TagFile

func (vision *Vision) TagFile(path string) (VisionResult, error)

func (*Vision) Thumbnail

func (vision *Vision) Thumbnail(url string, order ThumbnailOrder) (Image, error)

type VisionOCRResult

type VisionOCRResult struct {
	Language    string   `json:"language"`
	TextAngle   float64  `json:"textAngle"`
	Orientation string   `json:"orientation"`
	Regions     []Region `json:"regions"`
}

func (VisionOCRResult) String

func (order VisionOCRResult) String() (result string)

this method can make a full sentence from OCR result

type VisionResult

type VisionResult struct {
	RequestID   string      `json:"requestId"`
	Categories  []Category  `json:"categories"`
	Adult       Adult       `json:"adult"`
	Faces       []Face      `json:"faces"`
	ImageType   ImageType   `json:"imageType"`
	Color       Color       `json:"color"`
	MetaData    MetaData    `json:"metadata"`
	Description Description `json:"description"`
	Tags        []Tag       `json:"tags"`
}

type VisualFeatures

type VisualFeatures struct {
	Categories  bool
	Tags        bool
	Description bool
	Faces       bool
	ImageType   bool
	Color       bool
	Adult       bool
}

func (VisualFeatures) String

func (order VisualFeatures) String() (string, error)

type Word

type Word struct {
	BoundingBox string `json:"boundingBox"`
	Text        string `json:"text"`
}

Jump to

Keyboard shortcuts

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