-
Notifications
You must be signed in to change notification settings - Fork 1
/
mtcnn.go
46 lines (38 loc) · 872 Bytes
/
mtcnn.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package detecter
/*
#include <stdlib.h>
#include <stdbool.h>
#include "openvision/face/detecter.h"
*/
import "C"
import (
"unsafe"
"github.com/bububa/openvision/go/common"
"github.com/bububa/openvision/go/face"
)
// Mtcnn represents mtcnn detecter
type Mtcnn struct {
d C.IFaceDetecter
}
// NewMtcnn returns a new Mtcnn
func NewMtcnn() *Mtcnn {
return &Mtcnn{
d: C.new_mtcnn(),
}
}
// Destroy free detecter
func (d *Mtcnn) Destroy() {
common.DestroyEstimator(d)
}
// Pointer implement Estimator interface
func (d *Mtcnn) Pointer() unsafe.Pointer {
return unsafe.Pointer(d.d)
}
// LoadModel implement Detecter interface
func (d *Mtcnn) LoadModel(modelPath string) error {
return common.EstimatorLoadModel(d, modelPath)
}
// Detect implement Detecter interface
func (d *Mtcnn) Detect(img *common.Image) ([]face.FaceInfo, error) {
return Detect(d, img)
}