make build 报错如下:
../../gocv.io/x/gocv/dnn_ext.go:9:28: undefined: Mat
../../gocv.io/x/gocv/dnn_ext.go:16:12: undefined: NewMatWithSize
../../gocv.io/x/gocv/dnn_ext.go:43:2: undefined: Resize
../../gocv.io/x/gocv/dnn_ext.go:43:38: undefined: InterpolationDefault
../../gocv.io/x/gocv/dnn_ext.go:46:3: undefined: CvtColor
../../gocv.io/x/gocv/dnn_ext.go:49:15: undefined: NewMat
../../gocv.io/x/gocv/dnn_ext.go:52:31: undefined: MatTypeCV32F
GoCV 用的人不多,资料难找,最终解决方法:
报错代码前有
CGO_ENABLED=0
因为GoCV 需要 CGO的支持
所以在 Makefile 文件中应该对 CGO 进行支持,具体设置如下
GO=CGO_ENABLED=0 GO111MODULE=on go
CGO=CGO_ENABLED=1 GO111MODULE=on go
make build 顺利通过,搞定
更多内容:https://github.com/hybridgroup/gocv/issues/381
更多内容:https://github.com/hybridgroup/gocv/issues/340