facest

package module
v0.0.0-...-da3aeff Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 9 Imported by: 0

README

Build Status Go Report Card Godoc

facest-go

Facest.io Go client.

Install

go get -u github.com/facest/facest-go

Usage

import "github.com/facest/facest-go"

// Replace API_KEY with your real key
client := facest.NewClient("API_KEY")

Testing

Run integration tests with real API Key.

export FACEST_INTEGRATION_API_KEY=
go test -v -tags=integration

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client .

func NewClient

func NewClient(apiKey string) *Client

NewClient creates new Facest.io client with given API key

func (*Client) Detect

func (c *Client) Detect(image io.Reader) (*DetectRes, error)

Detect faces within a given image.

func (*Client) GetFace

func (c *Client) GetFace(faceToken string) (*Face, error)

GetFace returns face object and its images by face_token

func (*Client) GetFaces

func (c *Client) GetFaces(options *FacesListOptions) (*FacesList, error)

GetFaces returns trained faces and their images

func (*Client) Recognize

func (c *Client) Recognize(image io.Reader) (*RecognizeRes, error)

Recognize faces within a givin image

func (*Client) Train

func (c *Client) Train(image io.Reader, faceID string) (*TrainRes, error)

Train the model by uploading face image and tagging it with something unique to your app (face_id)

type DetectRes

type DetectRes struct {
	Count int            `json:"count"`
	Faces []DetectedFace `json:"faces"`
}

DetectRes .

type DetectedFace

type DetectedFace struct {
	Rectangle Rectangle `json:"rectangle"`
}

DetectedFace .

type Face

type Face struct {
	FaceToken  string      `json:"face_token"`
	FaceID     string      `json:"face_id"`
	FaceImages []FaceImage `json:"face_images"`
	CreatedAt  time.Time   `json:"created_at"`
}

Face .

type FaceImage

type FaceImage struct {
	ImageToken string    `json:"image_token"`
	ImageURL   string    `json:"image_url"`
	CreatedAt  time.Time `json:"created_at"`
}

FaceImage .

type FacesList

type FacesList struct {
	Count      int    `json:"count"`
	PagesCount int    `json:"pages_count"`
	Faces      []Face `json:"faces"`
}

FacesList .

type FacesListOptions

type FacesListOptions struct {
	Limit int `json:"limit"`
	Page  int `json:"page"`
}

FacesListOptions .

type RecognizeRes

type RecognizeRes struct {
	Count int              `json:"count"`
	Faces []RecognizedFace `json:"faces"`
}

RecognizeRes .

type RecognizedFace

type RecognizedFace struct {
	Rectangle  Rectangle `json:"rectangle"`
	FaceHash   string    `json:"face_hash"`
	FaceID     string    `json:"face_id"`
	Confidence float64   `json:"confidence"`
	URL        string    `json:"image_url"`
}

RecognizedFace .

type Rectangle

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

Rectangle .

type TrainRes

type TrainRes struct {
	FaceToken  string `json:"face_token"`
	ImageToken string `json:"image_token"`
	ImageURL   string `json:"image_url"`
}

TrainRes .

Jump to

Keyboard shortcuts

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