- libtensorfow 1.x Follow the instruction Install TensorFlow for C
- download tenorflow model graph
- CMU model Google Drive
- mobilenet large model Google Drive
- mobilenet small model Google Drive
- mobilenet thin model Google Drive
go get -u github.com/bububa/openpose
- libjpeg-turbo (use
-tags jpeg
to build withoutCGo
) - On Linux/RPi native Go V4L implementation is used to capture images.
make cvcamera
# use native Go V4L implementation is used to capture images
make linux_camera
use jpeg build tag to build with native Go image/jpeg
instead of libjpeg-turbo
go build -o=./bin/cvcamera -tags=cv4,jpeg ./cmd/camera
Usage of camera:
-bind string
Bind address (default ":56000")
-delay int
Delay between frames, in milliseconds (default 10)
-width float
Frame width (default 640)
-height float
Frame height (default 480)
-index int
Camera index
-model string
mode path
import (
"github.com/bububa/openpose"
)
func main() {
t := openpose.NewPoseEstimator(modelPath, openpose.MobileNet)
wd, _ := os.Getwd()
img, err := loadImage("./golf.jpg")
if err != nil {
log.Fatalln(err)
}
modelSize := openpose.ModelSizeFaster
sharpenSigma := 0.0
t.SetSharpenSigma(sharpenSigma)
humans, err := t.Estimate(img, modelSize)
if err != nil {
log.Fatalln(err)
}
outImg := openpose.DrawHumans(img, humans, 2)
saveImage(outImg, "./out/jpg")
}