recognizer

package module
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 20 Imported by: 0

README

Forked from https://github.com/leandroveronezi/go-recognizer

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
	UseFastJPEGEncoding bool
	Dataset             []Data
	// contains filtered or unexported fields
}

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

func (*Recognizer) AddImageBytesToDataset

func (_this *Recognizer) AddImageBytesToDataset(imgBytes []byte, id string) (*Data, error)

AddImageBytesToDataset addd a sample golang image to the dataset

func (*Recognizer) AddImageToDataset

func (_this *Recognizer) AddImageToDataset(path string, Id string) error

AddImageToDataset add a sample image to the dataset

func (*Recognizer) AddMultipleData

func (_this *Recognizer) AddMultipleData(datas []Data)

AddMultipleData adds a single data to the dataset

func (*Recognizer) AddRawImageToDataset

func (_this *Recognizer) AddRawImageToDataset(img image.Image, id string) (*Data, error)

AddRawImageToDataset addd a sample golang image to the dataset

func (*Recognizer) AddSingleData

func (_this *Recognizer) AddSingleData(d Data)

AddSingleData adds a single data to the dataset

func (*Recognizer) Classify

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

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

func (*Recognizer) ClassifyFaces

func (_this *Recognizer) ClassifyFaces(faces []goFace.Face) ([]Face, error)

Classify from a list of recognized faces.

func (*Recognizer) ClassifyMultiples

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

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

func (*Recognizer) ClassifyMultiplesWithBytes

func (_this *Recognizer) ClassifyMultiplesWithBytes(imgBytes []byte) ([]Face, error)

func (*Recognizer) ClassifyMultiplesWithImage

func (_this *Recognizer) ClassifyMultiplesWithImage(img image.Image) ([]Face, error)

func (*Recognizer) ClassifyWithBytes

func (_this *Recognizer) ClassifyWithBytes(imgBytes []byte) ([]Face, error)

func (*Recognizer) ClassifyWithImage

func (_this *Recognizer) ClassifyWithImage(img image.Image) ([]Face, error)

func (*Recognizer) CleanDataset

func (_this *Recognizer) CleanDataset()

CleanDataset cleans dataset

func (*Recognizer) Close

func (_this *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 (_this *Recognizer) DrawFaces(Path string, F []Face) (image.Image, error)

DrawFaces draws the faces identified in the original image

func (*Recognizer) DrawFaces2

func (_this *Recognizer) DrawFaces2(Path string, F []goFace.Face) (image.Image, error)

DrawFaces2 draws the faces in the original image

func (*Recognizer) GrayScale

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

GrayScale Convert an image to grayscale

func (*Recognizer) Init

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

Init initialise a recognizer interface.

func (*Recognizer) LoadDataset

func (_this *Recognizer) LoadDataset(Path string) error

LoadDataset loads the data from the json file into the Dataset

func (*Recognizer) LoadImage

func (_this *Recognizer) LoadImage(Path string) (image.Image, error)

LoadImage Load an image from file

func (*Recognizer) RecognizeMultiples

func (_this *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) RecognizeMultiplesFromBytes

func (_this *Recognizer) RecognizeMultiplesFromBytes(imgBytes []byte) ([]goFace.Face, error)

func (*Recognizer) RecognizeMultiplesFromImage

func (_this *Recognizer) RecognizeMultiplesFromImage(img image.Image) ([]goFace.Face, error)

func (*Recognizer) RecognizeSingle

func (_this *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) RemoveFromDataset

func (_this *Recognizer) RemoveFromDataset(id string)

func (*Recognizer) SaveDataset

func (_this *Recognizer) SaveDataset(Path string) error

SaveDataset saves Dataset data to a json file

func (*Recognizer) SaveImage

func (_this *Recognizer) SaveImage(Path string, Img image.Image) error

SaveImage Save an image to jpeg file

func (*Recognizer) SetSamples

func (_this *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