As you know OpenCV is very useful library that let you do amazing and powerful things in Computer vision. So I passed a good time to figure out how to use it in Unity3d, I had many problems, and searching in the Net, I have found several suggestions but not one worked for me.
- I’m using a Unity Pro 4.0
- This version of Emgu CV (emgucv-windows-universal-gpu 2.4.9.1847)
- My target for unity project is: windows and not web player
This is what I did for everyone who want to use it:
This is how to test it:
Create a small script, that takes a “picture1.jpg” and change the color of the first 200 diagonal pixels color to white color (255,255,255) and then save the new “picture2.jpg” This is what you have to put in the script:
By adding the different dlls in the Plugins folder they will be referenced automatically in the Mono Editor, but probably you will have a problem with “System.Drawing” library, so don’t forget
using System.Drawing
; and also you have to reference it by going to your script editor.If MonoDevelop-Unity, go the solution explorer in the left, right click on Refrences->Edit references-> and search for system.drawing in the left column and check it to see it in the right column, then press ok
Also don’t forget to change the build settings in Unity->file->build settings in this way:
For now you’re free to test your script and do awesome work using OpenCV
PS: I’m not sure why exactly the “npp32_50_35” and “cudart32_50_35” have to be in the Editor folder, but it’s the only situation that worked for me.