faces

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package faces contains autogenerated REST client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL string
	Timeout time.Duration
	// InstrumentCtxFunc allows adding operation info to context.
	// A pointer to request structure passed into the function.
	// Nil value is ignored.
	InstrumentCtxFunc func(ctx context.Context, method, pattern string, reqStruct interface{}) context.Context
	// contains filtered or unexported fields
}

Client is a REST service HTTP client. Faces Detector. REST API to detect faces in images.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates client instance with default transport.

func (*Client) SetTransport

func (c *Client) SetTransport(transport http.RoundTripper)

SetTransport sets client transport.

func (*Client) UploadImage

func (c *Client) UploadImage(ctx context.Context, request UploadImageRequest) (result UploadImageResponse, err error)

UploadImage performs REST operation.

type GoFaceFace

type GoFaceFace struct {
	Descriptor *[]float64      `json:"Descriptor,omitempty"`
	Rectangle  *ImageRectangle `json:"Rectangle,omitempty"`
	Shapes     *[]ImagePoint   `json:"Shapes,omitempty"`
}

GoFaceFace structure is generated from "#/components/schemas/GoFaceFace".

type ImagePoint

type ImagePoint struct {
	X int64 `json:"X,omitempty"`
	Y int64 `json:"Y,omitempty"`
}

ImagePoint structure is generated from "#/components/schemas/ImagePoint".

type ImageRectangle

type ImageRectangle struct {
	Max *ImagePoint `json:"Max,omitempty"`
	Min *ImagePoint `json:"Min,omitempty"`
}

ImageRectangle structure is generated from "#/components/schemas/ImageRectangle".

type Output

type Output struct {
	ElapsedSec float64      `json:"elapsedSec,omitempty"`
	Faces      []GoFaceFace `json:"faces,omitempty"`
	Found      int64        `json:"found,omitempty"`
}

Output structure is generated from "#/components/schemas/Output".

type Recognizer

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

func NewRecognizer

func NewRecognizer(logger ctxd.Logger, cfg RecognizerConfig) *Recognizer

func (*Recognizer) Recognize

func (r *Recognizer) Recognize(ctx context.Context, jpg io.ReadCloser) (_ []GoFaceFace, err error)

func (*Recognizer) RecognizeFile

func (r *Recognizer) RecognizeFile(ctx context.Context, fileName string) ([]GoFaceFace, error)

type RecognizerConfig

type RecognizerConfig struct {
	URL              string        `json:"url" example:"http://localhost:8011/"`
	Delay            time.Duration `json:"delay" description:"Cooldown delay between requests."` // Default tag is broken for time.Duration.
	ConcurrencyLimit int           `json:"concurrencyLimit" default:"1" description:"Max simultaneous requests."`
}

type UploadFile

type UploadFile struct {
	Name        string
	ContentType string
	Content     io.ReadCloser
}

UploadFile describes file to upload.

type UploadImageRequest

type UploadImageRequest struct {
	Image UploadFile // Image is an optional `image` parameter in formData.
	// contains filtered or unexported fields
}

UploadImageRequest is operation request value.

func (*UploadImageRequest) Cancel

func (pr *UploadImageRequest) Cancel(err error)

type UploadImageResponse

type UploadImageResponse struct {
	StatusCode int
	RawBody    []byte  // RawBody contains read bytes of response body.
	ValueOK    *Output // ValueOK is a value of 200 OK response.
}

UploadImageResponse is operation response value.

Jump to

Keyboard shortcuts

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