-
Notifications
You must be signed in to change notification settings - Fork 1
/
ultralight.go
50 lines (41 loc) · 999 Bytes
/
ultralight.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
47
48
49
50
package detecter
/*
#include <stdlib.h>
#include <stdbool.h>
#include "openvision/pose/detecter.h"
*/
import "C"
import (
"unsafe"
"github.com/bububa/openvision/go/common"
)
// Ultralight represents utralight detecter
type Ultralight struct {
d C.IPoseDetecter
}
// NewUltralight returns a new Utralight
func NewUltralight() *Ultralight {
return &Ultralight{
d: C.new_ultralight(),
}
}
// Destroy free detecter
func (d *Ultralight) Destroy() {
common.DestroyEstimator(d)
}
// Pointer implement Estimator interface
func (d *Ultralight) Pointer() unsafe.Pointer {
return unsafe.Pointer(d.d)
}
// HasKeypoints implement Detecter interface
func (d *Ultralight) HasKeypoints() bool {
return false
}
// LoadModel load model for detecter
func (d *Ultralight) LoadModel(modelPath string) error {
return common.EstimatorLoadModel(d, modelPath)
}
// Detect implement Detecter interface
func (d *Ultralight) Detect(img *common.Image) ([]common.ObjectInfo, error) {
return Detect(d, img)
}