after pulling latest golang image and started container had to change original tutorial a little bit. It is based on https://gocv.io/getting-started/linux/ although not everything worked out as planned. Below how to build your own if you don't trust this one.
install opencv
go install gocv.io/x/gocv@latest
sudo is not installed
apt-get update && apt-get install sudo
need to verify that path
cd /go/pkg/mod/gocv.io/x/[email protected] make install make clean
test code:
package main
import (
"fmt"
"gocv.io/x/gocv"
)
func main() {
rtsp_string := "RTSP_STREAM_STRING"
camera, _ := gocv.OpenVideoCapture(rtsp_string)
img := gocv.NewMat()
for {
camera.Read(&img)
fmt.Println("frame ok")
gocv.IMWrite("test.jpg", img)
}
}
to pull out jpg file
docker cp opencvgolang:/opt/src/test.jpg ./
Content type
Image
Digest
sha256:1cdf0e8d3…
Size
594.4 MB
Last updated
over 3 years ago
docker pull dohtem81/opencv_go:0.1