我安装了unity3D。我在上面创建了一个基本的AR样本。我想在unity3d上使用opencv。要做,有一些方法。我想使用opencvsharp。我安装opencvsharp2.4.10因为我已经安装了opencv2.4.10。
我不知道下一步?我如何将opencv与unity3d集成?我没有找到健全的教程。我使用64位和windows8。
编辑
我了解到我们可以在unity3d中使用c ++代码(包括opencv函数)。我使用visual stuio 2013创建了dll。指南链接是here。现在我尝试统一调用substract
函数。
[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);
}
}
当我运行此代码时,我得到EntryPointNotFoundException:Substract
。我把MathFuncDll
放在C://Program Fİles(x86)/Unity/Editor
和Unity目录下的Assets-Library目录下。
检查此链接:OpenCV + Unity3D integration
在Unity Store还有付费插件:(它支持移动平台)
http://forum.unity3d.com/threads/released-opencv-for-unity.277080/
链接在商店