recognizer

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

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

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID         string
	Descriptor goFace.Descriptor
}

Data descriptor of the human face.

type Face

type Face struct {
	Data
	Rectangle image.Rectangle
}

Face holds coordinates and descriptor of the human face.

type Recognizer

type Recognizer struct {
	Tolerance float32

	UseCNN  bool
	UseGray bool
	Dataset []Data
	// contains filtered or unexported fields
}

A Recognizer creates face descriptors for provided images and classifies them into categories.

func (*Recognizer) AddImageToDataset

func (r *Recognizer) AddImageToDataset(path, id string) error

AddImageToDataset add a sample image to the dataset

func (*Recognizer) Classify

func (r *Recognizer) Classify(path string) ([]Face, error)

Classify returns all faces identified in the image. Empty list is returned if no match.

func (*Recognizer) ClassifyMultiples

func (r *Recognizer) ClassifyMultiples(path string) ([]Face, error)

ClassifyMultiples returns all faces identified in the image. Empty list is returned if no match.

func (*Recognizer) Close

func (r *Recognizer) Close()

Close frees resources taken by the Recognizer. Safe to call multiple times. Don't use Recognizer after close call.

func (*Recognizer) DrawFaces

func (r *Recognizer) DrawFaces(path string, faces []Face) (image.Image, error)

DrawFaces draws the faces identified in the original image

func (*Recognizer) DrawFaces2

func (r *Recognizer) DrawFaces2(path string, faces []goFace.Face) (image.Image, error)

DrawFaces2 draws the faces in the original image

func (*Recognizer) GrayScale

func (r *Recognizer) GrayScale(imgSrc image.Image) image.Image

GrayScale Convert an image to grayscale

func (*Recognizer) Init

func (r *Recognizer) Init(path string) error

Init initialise a recognizer interface.

func (*Recognizer) LoadData

func (r *Recognizer) LoadData(path string) error

LoadData loads the data from the JSON file into the Data

func (*Recognizer) LoadImage

func (r *Recognizer) LoadImage(path string) (image.Image, error)

LoadImage load an image from file

func (*Recognizer) RecognizeMultiples

func (r *Recognizer) RecognizeMultiples(path string) ([]goFace.Face, error)

RecognizeMultiples returns all faces found on the provided image, sorted from left to right. Empty list is returned if there are no faces, error is returned if there was some error while decoding/processing image. Only JPEG format is currently supported.

func (*Recognizer) RecognizeSingle

func (r *Recognizer) RecognizeSingle(path string) (goFace.Face, error)

RecognizeSingle returns face if it's the only face on the image or nil otherwise. Only JPEG format is currently supported.

func (*Recognizer) SaveData

func (r *Recognizer) SaveData(path string) error

SaveData saves data to JSON formatted file

func (*Recognizer) SaveImage

func (r *Recognizer) SaveImage(path string, Img image.Image) error

SaveImage save an image to jpeg file

func (*Recognizer) SetSamples

func (r *Recognizer) SetSamples()

SetSamples sets known descriptors so you can classify the new ones.

Jump to

Keyboard shortcuts

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