Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( // FacePrefix 脸前缀 FacePrefix byte = 'F' )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Classifier ¶
type Classifier struct {
Named map[string][]Face // 命名的人脸
Waiting [][]Face // 待命名的
Rec *face.Recognizer // 人脸识别
}
Classifier 人脸分类器
func (*Classifier) Classify ¶
func (c *Classifier) Classify(faces []*Face)
Classify 分类
Example ¶
db, _ := NewDB("db")
defer db.Close()
faces := []*Face{}
db.Get([]byte("faces"), &faces)
rec, _ := face.NewRecognizer("data")
defer rec.Close()
c := Classifier{
Rec: rec,
Named: map[string][]Face{},
Waiting: [][]Face{},
}
c.Classify(faces)
Output: false <nil>
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB 数据库对象
func NewDB ¶
NewDB 新建数据库对象
Example ¶
tmpDir := fmt.Sprintf("/tmp/%s", utils.NewID('D'))
db, _ := NewDB(tmpDir)
defer db.Close()
key := []byte{'1'}
fmt.Println(db.Has(key))
db.Put(key, "txt")
fmt.Println(db.Has(key))
var str string
db.Get(key, &str)
fmt.Println(str)
Output: false <nil> true <nil> txt
type Photo ¶
type Photo struct {
Size int64 // 尺寸
Ca time.Time // 创建时间
Faces []face.Face // 人脸识别
Make string // 相机
Model string // 型号
}
Photo 照片处理
func NewPhoto ¶
func NewPhoto(file string, rec *face.Recognizer) (photo *Photo, err error)
NewPhoto 照片信息
Example ¶
rec, _ := face.NewRecognizer("data")
defer rec.Close()
b, err := NewPhoto("lareina.jpg", rec)
fmt.Println(err)
fmt.Printf("%d\n", len(b.Faces))
p, err := NewPhoto("has-lens-info.jpg", rec)
fmt.Println(err)
fmt.Println(p.Ca)
fmt.Println(p.Make, p.Model, p.Size)
Output: <nil> 1 <nil> 2014-09-01 15:03:47 +0800 CST Apple iPhone 4S 22493
Click to show internal directories.
Click to hide internal directories.