我是一名统一开发人员,第一次尝试使用 opencv.我最初的目标是在 unity3d 中通过 opencv 运行相机并检测 blob.我是 OpenCV 的新手,正在尝试将它集成到 Unity3D 中(在 Windows 8 上使用 Unity 4.3.2 和在 Mac 上使用 Unity 4.2.1f).我关注了 this 线程.但是,一旦添加新的 C# 脚本,我就会收到以下错误.当我删除这个脚本时,错误就出现了(这个脚本是 Unity 生成的 C# 脚本).
I am a unity developer trying my hands on opencv for the first time. My initial goal is to run the camera and detect blobs via opencv in unity3d. I am new to OpenCV and am trying to integrate it in Unity3D (on Windows 8 with Unity 4.3.2 and on a mac with Unity 4.2.1f). I followed this thread. But I am getting the following error as soon as I add a new C# script. And the moment I delete this script, the error goes (this script is Unity generated C# script).
Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
我找不到太多关于 Unity 和 OpenCV 集成的信息.如果您能帮助我解决此错误并指出我最近的教程以了解更多信息,那就太好了.
I couldn't find much about Unity and OpenCV integration. It would be great if you could help me out with this error and point me to a recent tutorial to learn more.
提前致谢!
我们最近不得不处理同样的问题,我会发布一些通用信息来解决您的问题并帮助其他人.
We recently had to deal with the same problem, I'll post some generic information that would solve your problem and help other people.
要在 C# 脚本中使用您的 OpenCV 项目,请遵循以下代码示例:
To use your OpenCV project inside a C# script, follow this code example:
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.InteropServices;
public class PluginImport : MonoBehaviour {
//Lets make our calls from the Plugin
[DllImport ("OpenCVProject")]
private static extern int openCVFunction();
void Start () {
openCVFunction();
}
}
注意using
指令!
其他信息来源:
这篇关于OpenCV + Unity3D 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!