Using Accord.NET with Unity


While looking for Harris Corner Detection examples, without using openCV, founded this framework:
“The Accord.NET Framework is a machine learning framework combined with audio and image processing libraries completely written in C#”


How to get it running with Unity
– Open new empty project in Unity (I Used 5.5.0b10)
– Edit/Project Settings/Player, set Api compatibility Level to .NET2.0 (instead of .NET2.0 Subset)
– Download framework from ( I took v3.3.0 )
– Copy DLL’s from that package (from “Release/net35/” folder) into your projects Assets/Plugins/ folder
– Also copy System.Drawing.dll from your c: drive into “Assets/Plugins/” folder (should be version 2.0, I founded mine from “C:\Windows\Microsoft.NET\Framework\v2.0.50727\”)
– Create c# script and use the code below (*This was just a quick test to get it running, testing Gaussian filter on texture)
– See my scene setup screenshot below the source

Image#1: Scene setup screenshot
– Add 2 Quads with different materials (use Unlit/Texture shader)
– Assign your source texture into QuadSource *Note: Texture importer settings must have [x] Read/Write enabled
– Assign those 2 quads into the script (which you have in some gameobject in scene) and hit Play!



*Main image: Using Gaussian filter from Accord.NET

Related Posts

About the Author:


8 Comments + Add Comment

  • Thanks for bringing this to my attention. I don’t need it for Unity but we do occasionally use OpenCV with at my job and it can be a struggle using it with .NET (even with the popular wrappers available). This looks like an interesting potential alternative.

  • […] 少し調べたら、Unity5.5でAccord.NETを動作させるチュートリアルがあった。↓ Using Accord.NET with UnityWhile looking for Harris Corner Detection examples, without using openCV, founded this framework: […]

  • Hello, When I followed the above steps install the, but it has one problem like the following:
    TypeLoadException: Could not load type ‘Accord.DirectSound.AudioDeviceInfo’ from assembly ‘Accord.Audio.DirectSound, Version=, Culture=neutral.

    So May I ask how to solve this problem? Thanks

    • seems to happen in 2017.x, but not in that 5.5.x.. would be interesting to know what changed.

      • But I tried 5.5.0f3 at first, it still has similar problem. I used accord. Net at version 3.3, and follow your above steps. So would you please help me what I should fix? Thank you so much!

        • in 5.5.3p4 it gives notification message (not error like in 2017) “SpritePacker failed to get types from Accord.Audio.DirectSound, Version=, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7. Error: The classes in the module cannot be loaded.

          but only if spritepacker is enabled.. could always delete that directsound dll for now

Leave a comment


Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.