wrapper - OpenCV in Go without SWIG and third-parties lib -
main goal: make opencv
work in go
without swig
, third party lib (an application compare image in linux using go)
i new in kits (opencv go , linux)
can image detection (feature2d etc) can done c-api only? there no convenient way call c++ code , c-api not updated(?)
i have followed how use c++ in go? failed. when make, got following errors
makefile:5: /usr/local/go/bin/src/make.amd64: no such file or directory
makefile:6: /usr/local/go/bin/src/make.pkg: no such file or directory
makefile:8: * missing separator. stop.
the makefile followed
goroot=/usr/local/go/bin goarch=amd64 targ=foo cgofiles=foo.go include $(goroot)/src/make.$(goarch) include $(goroot)/src/make.pkg foo.o:foo.cpp g++ $(_cgo_cflags_$(goarch)) -fpic -o2 -o $@ -c $(cgo_cflags) $< cfoo.o:cfoo.cpp g++ $(_cgo_cflags_$(goarch)) -fpic -o2 -o $@ -c $(cgo_cflags) $< cgo_ldflags+=-lstdc++ $(elem)_foo.so: foo.cgo4.o foo.o cfoo.o gcc $(_cgo_cflags_$(goarch)) $(_cgo_ldflags_$(goos)) -o $@ $^ $(cgo_ldflags)
thanks lot
you can't call c++ code without either writing c wrappers (+ cgo) or using swig, that's way sadly.
that post linked extremely outdated , can't used anymore.
on other hand, can start rewriting opencv in pure go, speed differences won't massive, specially if learn how use unsafe speed-critical parts.
disclaimer using unsafe not advised since, well, it's unsafe.
Comments
Post a Comment