How to use opencv in Unity3d?

I have installed unit3D. I created a basic AR sample on it. I want to use opencv on unity3d. There are several ways to do this. I want to use opencvsharp. I am installing opencvsharp2.4.10 because I installed opencv2.4.10.

I donโ€™t know the next step? How can I integrate opencv with union3d? I don't find a stubborn tutorial. I am using 64bit and windows8.

EDIT

I found out that we can use C ++ code (including opencv function) in unit3d. I created a dll using visual stuio 2013. Link to link here . Now I am trying to call a function substract

in unity.

[DllImport ("MatFuncsDll")]
private static extern double Subtract(double a, double b);

 void Update () {
    if (Input.GetMouseButtonDown (0)) {
        /*Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        float dist;
        plane.Raycast (ray, out dist);
        v3OrgMouse = ray.GetPoint (dist);
        v3OrgMouse.y = 0;*/

        mTrackableBehaviour.gameObject.transform.position = new Vector3 (
            mTrackableBehaviour.gameObject.transform.position.x + (float)Subtract (1, 0.5),
            mTrackableBehaviour.gameObject.transform.position.y,
            mTrackableBehaviour.gameObject.transform.position.z);
    } 
 }

      

When I run this code, I get EntryPointNotFoundException:Substract

. I put MathFuncDll

under C://Program Fฤฐles(x86)/Unity/Editor

the same Assets-Library directory in the unity project.

+3


source to share


1 answer


Check this link: OpenCV + Unity3D Integration

There is also a paid plugin in Unity Store: (it supports mobile platforms)

http://forum.unity3d.com/threads/released-opencv-for-unity.277080/



Link in the store

https://www.assetstore.unity3d.com/en/#!/content/21088

0


source







All Articles