func averageFaces(numFaces int) image.Image {
	filePattern := "static/img/orl_faces/%v.png"
	filenames := make([]string, numFaces)
	for i := 0; i < numFaces; i++ {
		filenames[i] = fmt.Sprintf(filePattern, i+1)
	}
	avgFace := faceimage.AverageFaces(filenames)
	return faceimage.ToImage(avgFace)
}
Ejemplo n.º 2
0
func saveImage(face eigenface.FaceVector, path string) {
	img := faceimage.ToImage(face)
	out, err := os.Create(path)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	err = png.Encode(out, img)
}