- Home /
Emgu/OpenCV with Unity Free
Hi all,
I'm trying to do a project with OpenCV to find the shapes of objects.
I've been looking at Emgu and have tried out the examples in visual studio, these built fine and the .dlls built fine in the "bin" folder.
I was just wondering if there was a way of getting this into Unity Free, I am using Free and so don't have the ability to add plugins but can I add the dlls to the References folder in MonoDevelop and then access them this way?
If so, is there a nice simple tutorial/example I can try within Unity to test if this is working, for example putting webcam feed onto a plane or something as a texture?
Thank you for your time,
Carkey
Answer by chelnok · Apr 21, 2013 at 04:37 AM
I was playing around with pattern recognition and webcam, but couldnt get OpenCV to work with Mac.
What comes to DLLs, check this one: http://docs.unity3d.com/Documentation/Manual/UsingDLL.html
Also read docs about webcam: http://docs.unity3d.com/Documentation/ScriptReference/WebCamTexture.html
Script to get feed from webcam:
// Starts the default camera and assigns the texture to the current renderer
function Start () {
var webcamTexture : WebCamTexture = WebCamTexture();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
}
When you got the webcamtexture, you need to get pixels with GetPixels() : http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.html