Documentation
¶
Index ¶
- Variables
- type Face
- type Option
- type Recognizer
- func (r *Recognizer) AddImageToSamples(filePath string, Id string) error
- func (r *Recognizer) Classify(Path string) ([]*Face, error)
- func (r *Recognizer) ClassifyMultiples(Path string) ([]Face, error)
- func (r *Recognizer) Close()
- func (r *Recognizer) DrawFaces(Path string, F []Face) (image.Image, error)
- func (r *Recognizer) DrawFaces2(Path string, F []goFace.Face) (image.Image, error)
- func (r *Recognizer) GrayScale(imgSrc image.Image) image.Image
- func (r *Recognizer) LoadImage(Path string) (image.Image, error)
- func (r *Recognizer) LoadSamples(samplesPath ...string) error
- func (r *Recognizer) RecognizeMultiples(Path string) ([]goFace.Face, error)
- func (r *Recognizer) RecognizeSingle(Path string) (*goFace.Face, error)
- func (r *Recognizer) SaveSamples(samplesPath ...string) error
- func (r *Recognizer) SaveToJpeg(Path string, img image.Image) error
- type SampleBaseData
- type SamplesLoader
- type SamplesSaver
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Face ¶
type Face struct { *SampleBaseData Rectangle image.Rectangle }
Face holds coordinates and descriptor of the human face.
type Option ¶
type Option func(recognizer *Recognizer)
func WithModelPath ¶
WithModelPath sets the path to the model directory.
func WithSamplesLoader ¶
func WithSamplesLoader(loader SamplesLoader) Option
WithSamplesLoader sets the samples loader.
func WithSamplesSaver ¶
func WithSamplesSaver(saver SamplesSaver) Option
WithSamplesSaver sets the dataSet store method
func WithTolerance ¶
WithTolerance sets the tolerance for the recognition.
type Recognizer ¶
type Recognizer struct {
// contains filtered or unexported fields
}
func NewRecognizer ¶
func NewRecognizer(opts ...Option) (*Recognizer, error)
func (*Recognizer) AddImageToSamples ¶
func (r *Recognizer) AddImageToSamples(filePath string, Id string) error
AddImageToSamples add a sample image to the samples
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) DrawFaces2 ¶
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) LoadImage ¶
func (r *Recognizer) LoadImage(Path string) (image.Image, error)
LoadImage Load an image from file
func (*Recognizer) LoadSamples ¶
func (r *Recognizer) LoadSamples(samplesPath ...string) error
LoadSamples load samples using config loader
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) SaveSamples ¶
func (r *Recognizer) SaveSamples(samplesPath ...string) error
SaveSamples save samples using config saver
func (*Recognizer) SaveToJpeg ¶
func (r *Recognizer) SaveToJpeg(Path string, img image.Image) error
SaveToJpeg Save an image to jpeg file
type SampleBaseData ¶
type SampleBaseData struct { Id string Descriptor goFace.Descriptor }
SampleBaseData descriptor of the human face.
type SamplesLoader ¶
type SamplesLoader interface {
LoadSamples(dataSetPath ...string) ([]*SampleBaseData, error)
}
SamplesLoader is the interface for loading a dataset.
type SamplesSaver ¶
type SamplesSaver interface {
SaveSamples(dataSet []*SampleBaseData, dataSetPath ...string) error
}
SamplesSaver is the interface for storing a dataset.