Skip to content

Go bindings for OpenCV / 2.x (Support gomobile in android)

License

Notifications You must be signed in to change notification settings

poi5305/go-opencv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go OpenCV binding

Fork from https://github.com/lazywei/go-opencv

Support for gomobile android (arm and x86)

Install

go get github.com/poi5305/go-opencv

Build

  • If using gomobild plugin as module in android studio
buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "gradle.plugin.org.golang.mobile.bind:gobindPlugin:0.2.7"
    }
}
apply plugin: "org.golang.mobile.bind"
gobind {
    pkg = "github.com/your_name/your_repo"
    GOPATH = "/your/go/path"
    GOARCH = "arm 386" // important
}
  • Or using gomobile bind command (generate .aar)
gomobile bind -target android/arm,android/386

Runtime dependency

  • Don't forget copy opencv/opencv-libs/libs/* to /AndroidStudioProject/app/src/main/jniLibs/

If not, you may get error message that go library can not find the opencv_java.so

opencv/opencv-libs/libs/armeabi/libopencv_java.so
opencv/opencv-libs/libs/armeabi-v7a/libopencv_java.so
opencv/opencv-libs/libs/mips/libopencv_java.so
opencv/opencv-libs/libs/x86/libopencv_java.so
  • If still not found the opencv library, try this
System.loadLibrary("opencv_java");

About

Go bindings for OpenCV / 2.x (Support gomobile in android)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 82.6%
  • C 7.3%
  • CMake 5.5%
  • Go 4.1%
  • Other 0.5%