Ask Your Question
0

Native Android OpenCV + Unity3D 5

asked 2015-09-27 10:41:06 -0600

javinair gravatar image

Hello,

I am trying to develop an Unity3D game using the OpenCV Android implementation. Using the ColorBlobDetectorexample (http://opencv.org/platforms/android/o...) I try to obtain some coordinates and give it to Unity to place some objects in these points.

Before this, I have made a simpler example from 0 to test the communication between an Android library (made in Eclipse) and Unity, and I know how to develop an Android plugin for Unity.

In the case of ColorBlobDetector, when I try to call any method (and even some created by myself) I get the following error:

09-27 17:16:19.160: I/Unity(16572): AndroidJavaException: java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.core.Mat.n_Mat() (tried Java_org_opencv_core_Mat_n_1Mat and Java_org_opencv_core_Mat_n_1Mat__)
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown="">:0
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.AndroidJNISafe.NewObject (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown="">:0
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) [0x00000] in <filename unknown="">:0
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.AndroidJavaObject..ctor (System.String className, System.Object[] args) [0x00000] in <filename unknown="">:0
09-27 17:16:19.160: I/Unity(16572): at ShareApp.getArea () [0x00000] in C:\OpenCV\Unity\AndroidTest\Assets\Scripts\ShareApp.cs:73
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) [0x00000] in <filename unknown="">:0
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) [0x00000] in <filename unknown="">:0
09-27 17:16:19.160: I/Unity(16572): at UnityEngine.Events.UnityEventB

I have exported even the OpenCVLibrary3.0.0 as .jar into Unity but still the same.

Could anyone give me some help about this case? If some screenshot or code is needed, I can give it.

Thanks in advance.

edit retag flag offensive close merge delete

Comments

"I have exported even the OpenCVLibrary3.0.0 as .jar into Unity" - that's not relevant here, it either does not find the native(c++) so's, or they are not loaded yet.

if you're using the OpencvManager to load them, you have to wait , until that finishes, before you can execute any opencv code. (e.g. not in onCreate())

berak gravatar imageberak ( 2015-09-29 05:17:58 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2017-05-29 09:23:58 -0600

ユウ gravatar image

With Unity it's better to get complete cross-platform solution. For example, OpenCV plus Unity is great one.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-09-27 10:41:06 -0600

Seen: 1,902 times

Last updated: Sep 27 '15