rekognition

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrorInvalidImageEncoding added in v1.2.1

func IsErrorInvalidImageEncoding(err error) (ok bool)

IsErrorInvalidImageEncoding checks if gicen error is `Invalid image encoding`.

func IsErrorInvalidParameter added in v1.2.4

func IsErrorInvalidParameter(err error) (ok bool)

IsErrorInvalidParameter checks if gicen error is `InvalidParameterException`.

Types

type Celebrity

type Celebrity struct {
	Name            string
	MatchConfidence float64
	Urls            []string
}

Celebrity has celebrity data.

type CelebrityInfoResponse

type CelebrityInfoResponse struct {
	Name string
	URLs []string
}

CelebrityInfoResponse is response data for `GetCelebrityInfo` operation.

func NewCelebrityInfoResponseFromAWSOutput

func NewCelebrityInfoResponseFromAWSOutput(info *SDK.GetCelebrityInfoOutput) *CelebrityInfoResponse

NewCelebrityInfoResponseFromAWSOutput creates CelebrityInfoResponse from *SDK.GetCelebrityInfoOutput.

type CelebrityResponse

type CelebrityResponse struct {
	List []*Celebrity
}

CelebrityResponse is response data for `RecognizeCelebrities` operation.

type Collection

type Collection struct {
	// contains filtered or unexported fields
}

Collection has Collection client.

func NewCollection

func NewCollection(svc *Rekognition, name string) *Collection

NewCollection returns initialized *Collection.

func (*Collection) DeleteFaces

func (c *Collection) DeleteFaces(faceIDs []string) ([]string, error)

DeleteFaces executes `DeleteFaces` operation and delete faces in a collection.

func (*Collection) IndexFacesByBytes

func (c *Collection) IndexFacesByBytes(byt []byte) (*IndexFacesResponse, error)

IndexFacesByBytes saves image of bytes into a collection.

func (*Collection) IndexFacesByBytesWithExternalImageID

func (c *Collection) IndexFacesByBytesWithExternalImageID(externalID string, byt []byte) (*IndexFacesResponse, error)

IndexFacesByBytesWithExternalImageID saves image of bytes into a collection.

func (*Collection) IndexFacesByS3Object

func (c *Collection) IndexFacesByS3Object(bucket, name string, version ...string) (*IndexFacesResponse, error)

IndexFacesByS3Object saves image of S3 object into a collection.

func (*Collection) IndexFacesByS3ObjectWithExternalImageID

func (c *Collection) IndexFacesByS3ObjectWithExternalImageID(externalID string, bucket, name string, version ...string) (*IndexFacesResponse, error)

IndexFacesByS3ObjectWithExternalImageID saves image of S3 object into a collection.

func (*Collection) IndexFacesFromLocalFile

func (c *Collection) IndexFacesFromLocalFile(filepath string) (*IndexFacesResponse, error)

IndexFacesFromLocalFile saves image into a collection from local image file.

func (*Collection) IndexFacesFromLocalFileWithExternalImageID

func (c *Collection) IndexFacesFromLocalFileWithExternalImageID(externalID string, filepath string) (*IndexFacesResponse, error)

IndexFacesFromLocalFileWithExternalImageID saves image into a collection from local image file.

func (*Collection) IndexFacesFromURL

func (c *Collection) IndexFacesFromURL(url string) (*IndexFacesResponse, error)

IndexFacesFromURL saves image into a collection from URL.

func (*Collection) IndexFacesFromURLWithExternalImageID

func (c *Collection) IndexFacesFromURLWithExternalImageID(externalID string, url string) (*IndexFacesResponse, error)

IndexFacesFromURLWithExternalImageID saves image into a collection from URL.

func (*Collection) ListAllFaces

func (c *Collection) ListAllFaces() ([]*Face, error)

ListAllFaces returns all of faces in a collection.

func (*Collection) SearchFacesByBytes

func (c *Collection) SearchFacesByBytes(byt []byte) (*SearchFacesResponse, error)

SearchFacesByBytes searches similar faces by image of bytes in a collection.

func (*Collection) SearchFacesByBytesWithThreshold

func (c *Collection) SearchFacesByBytesWithThreshold(threshold float64, byt []byte) (*SearchFacesResponse, error)

SearchFacesByBytesWithThreshold searches similar faces by image of bytes in a collection.

func (*Collection) SearchFacesByFaceID

func (c *Collection) SearchFacesByFaceID(faceID string, threshold ...float64) (*SearchFacesResponse, error)

SearchFacesByFaceID searches similar faces by face id in a collection.

func (*Collection) SearchFacesByS3Object

func (c *Collection) SearchFacesByS3Object(bucket, name string, version ...string) (*SearchFacesResponse, error)

SearchFacesByS3Object searches similar faces by image of S3 object in a collection.

func (*Collection) SearchFacesByS3ObjectWithThreshold

func (c *Collection) SearchFacesByS3ObjectWithThreshold(threshold float64, bucket, name string, version ...string) (*SearchFacesResponse, error)

SearchFacesByS3ObjectWithThreshold searches similar faces by image of S3 object in a collection.

func (*Collection) SetLimit

func (c *Collection) SetLimit(limit int64)

SetLimit sets limit, which is used for getting result list.

(e.g. MaxResults, MaxFaces etc...)

type CompareFaceResponse

type CompareFaceResponse struct {
	MatchedList            []*FaceDetail
	UnmatchedList          []*FaceDetail
	SourceImage            *FaceDetail
	SourceImageOrientation string
	TargetImageOrientation string
}

CompareFaceResponse is response data for `CompareFaces` operation.

func NewCompareFaceResponseFromAWSOutput

func NewCompareFaceResponseFromAWSOutput(output *SDK.CompareFacesOutput) *CompareFaceResponse

NewCompareFaceResponseFromAWSOutput creates CompareFaceResponse from *SDK.CompareFacesOutput.

type CompareFacesMatch

type CompareFacesMatch struct {
	*FaceDetail
	Similarity float64
}

CompareFacesMatch has detailed face data and similarity. (wrapper struct for *SDK.ComparedFace)

type Emotion

type Emotion struct {
	Type       string
	Confidence float64
}

Emotion has emotion data.

type Face

type Face struct {
	HasFace        bool
	FaceConfidence float64
	BoundingHeight float64
	BoundingWidth  float64
	BoundingTop    float64
	BoundingLeft   float64

	ExternalImageID string
	FaceID          string
	ImageID         string
}

Face has face data in collection. (wrapper struct for *SDK.Face)

func NewFaceFromAWSFace

func NewFaceFromAWSFace(face *SDK.Face) *Face

NewFaceFromAWSFace creates Face from *SDK.Face.

type FaceDetail

type FaceDetail struct {
	// estimated age range.
	HasAgeRange  bool
	AgeRangeHigh int
	AgeRangeLow  int

	HasBeard        bool
	BeardConfidence float64

	HasMustache        bool
	MustacheConfidence float64

	HasEyeglasses        bool
	EyeglassesConfidence float64

	HasSunglasses        bool
	SunglassesConfidence float64

	HasEyesOpen        bool
	EyesOpenConfidence float64

	HasMouthOpen        bool
	MouthOpenConfidence float64

	HasSmile        bool
	SmileConfidence float64

	HasPose   bool
	PosePitch float64
	PoseRoll  float64
	PoseYaw   float64

	HasImageQuality        bool
	ImageQualityBrightness float64
	ImageQualitySharpness  float64

	HasGender        bool
	Gender           string
	GenderConfidence float64

	HasFace        bool
	FaceConfidence float64
	BoundingHeight float64
	BoundingWidth  float64
	BoundingTop    float64
	BoundingLeft   float64

	HasEmotion bool
	Emotions   []Emotion

	HasLandmark bool
	Landmarks   []Landmark
}

FaceDetail has detailed face data. (wrapper struct for *SDK.FaceDetail)

func NewFaceDetailFromAWSComparedFace

func NewFaceDetailFromAWSComparedFace(face *SDK.ComparedFace) *FaceDetail

NewFaceDetailFromAWSComparedFace creates FaceDetail from *SDK.ComparedFace.

func NewFaceDetailFromAWSFaceDetail

func NewFaceDetailFromAWSFaceDetail(face *SDK.FaceDetail) *FaceDetail

NewFaceDetailFromAWSFaceDetail creates FaceDetail from *SDK.FaceDetail.

type FaceDetailResponse

type FaceDetailResponse struct {
	List        []*FaceDetail
	Orientation string
}

FaceDetailResponse is response data for `DetectFaces` operation.

type FaceMatch

type FaceMatch struct {
	*Face
	Similarity float64
}

FaceMatch has face data and similarity. (wrapper struct for *SDK.FaceMatch)

type FaceRecord

type FaceRecord struct {
	*Face
	*FaceDetail
}

FaceRecord has face and detail data. (wrapper struct for *SDK.FaceRecord)

type HTTPClient

type HTTPClient interface {
	Get(url string) (*http.Response, error)
}

HTTPClient is used for fetching image data from URL.

type IndexFacesResponse

type IndexFacesResponse struct {
	List        []*FaceRecord
	Orientation string
}

IndexFacesResponse is response data for `IndexFaces` operation.

func NewIndexFacesResponseFromAWSOutput

func NewIndexFacesResponseFromAWSOutput(output *SDK.IndexFacesOutput) *IndexFacesResponse

NewIndexFacesResponseFromAWSOutput creates IndexFacesResponse from *SDK.IndexFacesOutput.

type Label

type Label struct {
	Name       string
	Confidence float64
}

Label has label data.

func NewLabelFromAWSLabel

func NewLabelFromAWSLabel(label *SDK.Label) *Label

NewLabelFromAWSLabel creates Label from *SDK.Label.

type LabelResponse

type LabelResponse struct {
	List        []*Label
	Orientation string
}

LabelResponse is response data for `DetectLabels` operation.

type Landmark

type Landmark struct {
	Type string
	X    float64
	Y    float64
}

Landmark has landmark data.

type ModerationLabel

type ModerationLabel struct {
	Name       string
	ParentName string
	Confidence float64
}

ModerationLabel has moderation label data.

func NewModerationLabelFromAWSModerationLabel

func NewModerationLabelFromAWSModerationLabel(label *SDK.ModerationLabel) *ModerationLabel

NewModerationLabelFromAWSModerationLabel creates ModerationLabel from *SDK.ModerationLabel.

type ModerationLabelResponse

type ModerationLabelResponse struct {
	List []*ModerationLabel
}

ModerationLabelResponse is response data for `DetectModerationLabels` operation.

type Rekognition

type Rekognition struct {
	// contains filtered or unexported fields
}

Rekognition has Rekognition client.

func New

func New(conf config.Config) (*Rekognition, error)

New returns initialized *Rekognition.

func (*Rekognition) CompareFaces

func (svc *Rekognition) CompareFaces(input *SDK.CompareFacesInput) (*CompareFaceResponse, error)

CompareFaces executes `CompareFaces` operation and gets celebrities info.

func (*Rekognition) CompareFacesByBytes

func (svc *Rekognition) CompareFacesByBytes(source, target []byte) (*CompareFaceResponse, error)

CompareFacesByBytes compares faces from image of bytes.

func (*Rekognition) CompareFacesFromLocalFile

func (svc *Rekognition) CompareFacesFromLocalFile(source, target string) (*CompareFaceResponse, error)

CompareFacesFromLocalFile compares faces from local image files.

func (*Rekognition) CompareFacesFromURL

func (svc *Rekognition) CompareFacesFromURL(source, target string) (*CompareFaceResponse, error)

CompareFacesFromURL compares faces from URL.

func (*Rekognition) CreateCollection

func (svc *Rekognition) CreateCollection(name string) error

CreateCollection creates new Rekognition collection.

func (*Rekognition) DetectFacesByBytes

func (svc *Rekognition) DetectFacesByBytes(byt []byte) (*FaceDetailResponse, error)

DetectFacesByBytes gets label info from image of bytes.

func (*Rekognition) DetectFacesByS3Object

func (svc *Rekognition) DetectFacesByS3Object(bucket, name string, version ...string) (*FaceDetailResponse, error)

DetectFacesByS3Object gets label info from image of S3 object.

func (*Rekognition) DetectFacesFromLocalFile

func (svc *Rekognition) DetectFacesFromLocalFile(filepath string) (*FaceDetailResponse, error)

DetectFacesFromLocalFile gets label info from local image file.

func (*Rekognition) DetectFacesFromURL

func (svc *Rekognition) DetectFacesFromURL(url string) (*FaceDetailResponse, error)

DetectFacesFromURL gets label info from URL.

func (*Rekognition) DetectLabelsByBytes

func (svc *Rekognition) DetectLabelsByBytes(byt []byte) (*LabelResponse, error)

DetectLabelsByBytes gets label info from image of bytes.

func (*Rekognition) DetectLabelsByS3Object

func (svc *Rekognition) DetectLabelsByS3Object(bucket, name string, version ...string) (*LabelResponse, error)

DetectLabelsByS3Object gets label info from image of S3 object.

func (*Rekognition) DetectLabelsFromLocalFile

func (svc *Rekognition) DetectLabelsFromLocalFile(filepath string) (*LabelResponse, error)

DetectLabelsFromLocalFile gets label info from local image file.

func (*Rekognition) DetectLabelsFromURL

func (svc *Rekognition) DetectLabelsFromURL(url string) (*LabelResponse, error)

DetectLabelsFromURL gets label info from URL.

func (*Rekognition) DetectModerationLabelsByBytes

func (svc *Rekognition) DetectModerationLabelsByBytes(byt []byte) (*ModerationLabelResponse, error)

DetectModerationLabelsByBytes gets moderation info from image of bytes.

func (*Rekognition) DetectModerationLabelsByS3Object

func (svc *Rekognition) DetectModerationLabelsByS3Object(bucket, name string, version ...string) (*ModerationLabelResponse, error)

DetectModerationLabelsByS3Object gets moderation info from image of S3 object.

func (*Rekognition) DetectModerationLabelsFromLocalFile

func (svc *Rekognition) DetectModerationLabelsFromLocalFile(filepath string) (*ModerationLabelResponse, error)

DetectModerationLabelsFromLocalFile gets moderation info from local image file.

func (*Rekognition) DetectModerationLabelsFromURL

func (svc *Rekognition) DetectModerationLabelsFromURL(url string) (*ModerationLabelResponse, error)

DetectModerationLabelsFromURL gets moderation info from URL.

func (*Rekognition) Errorf

func (svc *Rekognition) Errorf(format string, v ...interface{})

Errorf logging error information.

func (*Rekognition) ForceDeleteCollection

func (svc *Rekognition) ForceDeleteCollection(name string) error

ForceDeleteCollection deletes Rekognition collection by given name with prefix.

func (*Rekognition) GetCelebrityInfoByID

func (svc *Rekognition) GetCelebrityInfoByID(id string) (*CelebrityInfoResponse, error)

GetCelebrityInfoByID gets celebrities info by id.

func (*Rekognition) GetCollection

func (svc *Rekognition) GetCollection(name string) (*Collection, error)

GetCollection gets Rekognition collection.

func (*Rekognition) Infof

func (svc *Rekognition) Infof(format string, v ...interface{})

Infof logging information.

func (*Rekognition) IsExistCollection

func (svc *Rekognition) IsExistCollection(name string) (bool, error)

IsExistCollection checks if the Collection already exists or not.

func (*Rekognition) ListCollections

func (svc *Rekognition) ListCollections() ([]string, error)

ListCollections returns list of collections.

func (*Rekognition) RecognizeCelebritiesByBytes

func (svc *Rekognition) RecognizeCelebritiesByBytes(byt []byte) (*CelebrityResponse, error)

RecognizeCelebritiesByBytes gets celebrities info from image of bytes.

func (*Rekognition) RecognizeCelebritiesByS3Object

func (svc *Rekognition) RecognizeCelebritiesByS3Object(bucket, name string, version ...string) (*CelebrityResponse, error)

RecognizeCelebritiesByS3Object gets celebrities info from image of S3 object.

func (*Rekognition) RecognizeCelebritiesFromLocalFile

func (svc *Rekognition) RecognizeCelebritiesFromLocalFile(filepath string) (*CelebrityResponse, error)

RecognizeCelebritiesFromLocalFile gets celebrities info from local image file.

func (*Rekognition) RecognizeCelebritiesFromURL

func (svc *Rekognition) RecognizeCelebritiesFromURL(url string) (*CelebrityResponse, error)

RecognizeCelebritiesFromURL gets celebrities info from URL.

func (*Rekognition) SetHTTPClient

func (svc *Rekognition) SetHTTPClient(httpClient HTTPClient)

SetHTTPClient sets httpClient.

func (*Rekognition) SetLogger

func (svc *Rekognition) SetLogger(logger log.Logger)

SetLogger sets logger.

type SearchFacesResponse

type SearchFacesResponse struct {
	List []*FaceMatch

	// returned by `SearchFaces` operation
	FaceID string

	// returned by `SearchFacesByImage` operation
	HasFace        bool
	FaceConfidence float64
	BoundingHeight float64
	BoundingWidth  float64
	BoundingTop    float64
	BoundingLeft   float64
}

SearchFacesResponse is response data for `SearchFaces` operation.

func NewSearchFacesResponseFromAWSOutput

func NewSearchFacesResponseFromAWSOutput(output *SDK.SearchFacesOutput) *SearchFacesResponse

NewSearchFacesResponseFromAWSOutput creates SearchFacesResponse from *SDK.SearchFacesOutput.

func NewSearchFacesResponseFromAWSOutputByImage

func NewSearchFacesResponseFromAWSOutputByImage(output *SDK.SearchFacesByImageOutput) *SearchFacesResponse

NewSearchFacesResponseFromAWSOutputByImage creates SearchFacesResponse from *SDK.SearchFacesByImageOutput.

Jump to

Keyboard shortcuts

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