pigo

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: MIT Imports: 11 Imported by: 53

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImage

func GetImage(input string) (*image.NRGBA, error)

GetImage retrieves and decodes the image file to *image.NRGBA type.

func ImgToNRGBA

func ImgToNRGBA(img image.Image) *image.NRGBA

ImgToNRGBA converts any image type to *image.NRGBA with min-point at (0, 0).

func RgbToGrayscale

func RgbToGrayscale(src *image.NRGBA) []uint8

RgbToGrayscale converts the image to grayscale mode.

Types

type CascadeParams

type CascadeParams struct {
	MinSize     int
	MaxSize     int
	ShiftFactor float64
	ScaleFactor float64
	ImageParams
}

CascadeParams contains the basic parameters to run the analyzer function over the defined image. MinSize: represents the minimum size of the face. MaxSize: represents the maximum size of the face. ShiftFactor: determines to what percentage to move the detection window over its size. ScaleFactor: defines in percentage the resize value of the detection window when moving to a higher scale.

type Detection

type Detection struct {
	Row   int
	Col   int
	Scale int
	Q     float32
}

Detection struct contains the detection results composed of the row, column, scale factor and the detection score.

type ImageParams

type ImageParams struct {
	Pixels []uint8
	Rows   int
	Cols   int
	Dim    int
}

ImageParams is a struct for image related settings. Pixels: contains the grayscale converted image pixel data. Rows: the number of image rows. Cols: the number of image columns. Dim: the image dimension.

type Pigo

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

Pigo struct defines the basic binary tree components.

func NewPigo

func NewPigo() *Pigo

NewPigo instantiate a new pigo struct.

func (*Pigo) ClusterDetections

func (pg *Pigo) ClusterDetections(detections []Detection, iouThreshold float64) []Detection

ClusterDetections returns the intersection over union of multiple clusters. We need to make this comparison to filter out multiple face detection regions.

func (*Pigo) RunCascade

func (pg *Pigo) RunCascade(cp CascadeParams, angle float64) []Detection

RunCascade analyze the grayscale converted image pixel data and run the classification function over the detection window. It will return a slice containing the detection row, column, it's center and the detection score (in case this is greater than 0.0).

func (*Pigo) Unpack

func (pg *Pigo) Unpack(packet []byte) (*Pigo, error)

Unpack unpack the binary face classification file.

type Puploc added in v1.2.0

type Puploc struct {
	Row      int
	Col      int
	Scale    float32
	Perturbs int
}

Puploc contains all the information resulted from the pupil detection needed for accessing from a global scope.

type PuplocCascade added in v1.2.0

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

PuplocCascade is a general struct for storing the cascade tree values encoded into the binary file.

func (*PuplocCascade) RunDetector added in v1.2.0

func (plc *PuplocCascade) RunDetector(pl Puploc, img ImageParams) *Puploc

RunDetector runs the pupil localization function.

func (*PuplocCascade) UnpackCascade added in v1.2.0

func (plc *PuplocCascade) UnpackCascade(packet []byte) (*PuplocCascade, error)

UnpackCascade unpacks the pupil localization cascade file.

Jump to

Keyboard shortcuts

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