facebox

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 13 Imported by: 13

Documentation

Overview

Package facebox provides a client for accessing Facebox services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// HTTPClient is the http.Client that will be used to
	// make requests.
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is an HTTP client that can make requests to the box.

func New

func New(addr string) *Client

New creates a new Client.

func (*Client) Check

func (c *Client) Check(image io.Reader) ([]Face, error)

Check checks the image in the io.Reader for faces.

func (*Client) CheckBase64

func (c *Client) CheckBase64(data string) ([]Face, error)

CheckBase64 checks the Base64 encoded image for faces.

func (*Client) CheckBase64WithFaceprint added in v0.3.1

func (c *Client) CheckBase64WithFaceprint(data string) ([]Face, error)

CheckBase64WithFaceprint checks the Base64 encoded image for faces and the object returned including the faceprints

func (*Client) CheckFaceprints added in v0.3.1

func (c *Client) CheckFaceprints(faceprints []string) ([]Face, error)

CheckFaceprints checks the list of faceprints to see if they match any known faces.

func (*Client) CheckURL

func (c *Client) CheckURL(imageURL *url.URL) ([]Face, error)

CheckURL checks the image at the specified URL for faces.

func (*Client) CompareFaceprints added in v0.3.1

func (c *Client) CompareFaceprints(target string, faceprintCandidates []string) ([]float64, error)

CompareFaceprints returns the confidence of the comparsion between the target faceprint and each of faceprint of the slice of candidates and returns an array of confidence in the same order of the candidates

func (*Client) Info

func (c *Client) Info() (*boxutil.Info, error)

Info gets the details about the box.

func (*Client) OpenState

func (c *Client) OpenState() (io.ReadCloser, error)

OpenState opens the state file for reading. Clients must call Close.

func (*Client) PostState

func (c *Client) PostState(r io.Reader) error

PostState uploads new state data.

func (*Client) PostStateURL

func (c *Client) PostStateURL(stateURL *url.URL) error

PostStateURL tells facebox to download the state file specified by the URL.

func (*Client) Remove

func (c *Client) Remove(id string) error

Remove makes facebox to forget a face

func (*Client) Rename

func (c *Client) Rename(id, name string) error

Rename allows to change the name for a given face

func (*Client) RenameAll

func (c *Client) RenameAll(oldName, newName string) error

RenameAll changes the name for all the faces that match a given name

func (*Client) Similar

func (c *Client) Similar(image io.Reader) ([]Similar, error)

Similar checks the image in the io.Reader for similar faces. Deprecated: use Similars to support multiple faces.

func (*Client) SimilarBase64

func (c *Client) SimilarBase64(data string) ([]Similar, error)

SimilarBase64 checks the Base64 encoded image for similar faces. Deprecated: use SimilarsBase64 to support multiple faces.

func (*Client) SimilarID

func (c *Client) SimilarID(id string) ([]Similar, error)

SimilarID returns similar faces based on the ID provided.

func (*Client) SimilarURL

func (c *Client) SimilarURL(imageURL *url.URL) ([]Similar, error)

SimilarURL checks the image at the specified URL for similar faces. Deprecated: use SimilarsURL to support multiple faces.

func (*Client) Similars added in v0.3.1

func (c *Client) Similars(image io.Reader, limit int) ([]SimilarFace, error)

Similars checks the image in the io.Reader for similar faces. Will look for a maximum of limit similar faces for each face.

func (*Client) SimilarsBase64 added in v0.3.1

func (c *Client) SimilarsBase64(data string, limit int) ([]SimilarFace, error)

SimilarsBase64 checks the Base64 encoded image for similar faces. Will look for a maximum of limit similar faces for each face.

func (*Client) SimilarsURL added in v0.3.1

func (c *Client) SimilarsURL(imageURL *url.URL, limit int) ([]SimilarFace, error)

SimilarsURL checks the image at the specified URL for similar faces. Will look for a maximum of limit similar faces for each face.

func (*Client) Teach

func (c *Client) Teach(image io.Reader, id, name string) error

Teach teaches facebox the face in the io.Reader. The name should be the name of the person who owns the face. The id should be a unique identifier for the image, usually the filename.

func (*Client) TeachBase64

func (c *Client) TeachBase64(data, id, name string) error

TeachBase64 teaches facebox the face in the Base64 encoded image. See Teach for more information.

func (*Client) TeachFaceprint added in v0.3.1

func (c *Client) TeachFaceprint(faceprint, id, name string) error

TeachFaceprint teaches facebox the face that is represented by the faceprint as a parameter. See Teach for more information.

func (*Client) TeachURL

func (c *Client) TeachURL(imageURL *url.URL, id, name string) error

TeachURL teaches facebox the face in the image at the specified URL. See Teach for more information.

type Face

type Face struct {
	Rect       Rect
	ID         string
	Name       string
	Matched    bool
	Confidence float64
	Faceprint  string
}

Face represents a face in an image.

type Rect

type Rect struct {
	Top, Left     int
	Width, Height int
}

Rect represents the coordinates of a face within an image.

type Similar

type Similar struct {
	ID         string
	Name       string
	Confidence float64
}

Similar represents a similar face.

type SimilarFace added in v0.3.1

type SimilarFace struct {
	Rect         Rect      `json:"rect"`
	SimilarFaces []Similar `json:"similar_faces"`
}

SimilarFace describes a face with similatiries.

Jump to

Keyboard shortcuts

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