mirror of
https://github.com/bububa/openvision.git
synced 2025-09-26 17:51:13 +08:00
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package segmentor
|
|
|
|
/*
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include "openvision/pose/segmentor.h"
|
|
*/
|
|
import "C"
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/bububa/openvision/go/common"
|
|
)
|
|
|
|
// Deeplabv3plus represents deeplabv3plus segmentor
|
|
type Deeplabv3plus struct {
|
|
d C.IPoseSegmentor
|
|
}
|
|
|
|
// NewDeeplabv3plus returns a new Deeplabv3plus
|
|
func NewDeeplabv3plus() *Deeplabv3plus {
|
|
return &Deeplabv3plus{
|
|
d: C.new_deeplabv3plus_pose_segmentor(),
|
|
}
|
|
}
|
|
|
|
// Destroy free segmentor
|
|
func (d *Deeplabv3plus) Destroy() {
|
|
common.DestroyEstimator(d)
|
|
}
|
|
|
|
// Pointer implement Estimator interface
|
|
func (d *Deeplabv3plus) Pointer() unsafe.Pointer {
|
|
return unsafe.Pointer(d.d)
|
|
}
|
|
|
|
// LoadModel load model for detecter
|
|
func (d *Deeplabv3plus) LoadModel(modelPath string) error {
|
|
return common.EstimatorLoadModel(d, modelPath)
|
|
}
|
|
|
|
// Matting implement Segmentor interface
|
|
func (d *Deeplabv3plus) Matting(img *common.Image, out *common.Image) error {
|
|
return Matting(d, img, out)
|
|
}
|
|
|
|
// Merge implement Segmentor interface
|
|
func (d *Deeplabv3plus) Merge(img *common.Image, bg *common.Image, out *common.Image) error {
|
|
return Merge(d, img, bg, out)
|
|
}
|