opencvsharp icon indicating copy to clipboard operation
opencvsharp copied to clipboard

Problem with CreateCLAHE in Unity

Open ghost opened this issue 11 years ago • 5 comments

Hi

I am trying to use CLAHE in Unity (OpenCvSharp 3.0.0 in Unity 5.2.3 x86)

And I am getting the same error as in issue https://github.com/shimat/opencvsharp/issues/153

Hope there are some way to get around this, in advance Thanks

--- Error: ------

ArrayTypeMismatchException: Source array type cannot be assigned to destination array type. (wrapper stelemref) object:stelemref (object,intptr,object) System.Collections.Generic.Dictionary2[System.Type,OpenCvSharp.Ptr1+ReleaseFunc[OpenCvSharp.CLAHE]].Add (System.Type key, OpenCvSharp.ReleaseFunc value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:429) OpenCvSharp.Ptr1[OpenCvSharp.CLAHE]..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpenCvSharp.Ptr1 OpenCvSharp.CLAHE..ctor (IntPtr p) OpenCvSharp.CLAHE.Create (Double clipLimit, Nullable1 tileGridSize) OpenCvSharp.Cv2.CreateCLAHE (Double clipLimit, Nullable1 tileGridSize) BoxDetection.Start () (at Assets/BoxDetection.cs:18)

ghost avatar Nov 30 '15 14:11 ghost

I have tracked down the problem. You can see some of the details here. https://github.com/shimat/opencvsharp/issues/159#event-477078645

Unfortunately, anything that return this error in Unity will need a Unity specific method added to the NativeMethods to work around the problem.

If your comfortable with the process of method wrapping and would like to add it yourself let me know and I can provide some example code.

Tharyn avatar Dec 02 '15 01:12 Tharyn

Hi Tharyn.

Thanks for tracking down the problem. I am interested in trying your method, so some examples would be great. I am new to C#, but comfortable to method wrapping in other languages so I am ready to try.

ghost avatar Dec 02 '15 15:12 ghost

I'm making a basic implementation tutorial, NativeFunctions + Unity Workaround, over the next several days. When I have it done and posted I will reply to this thread :)

DrDecipher avatar Dec 04 '15 02:12 DrDecipher

HI DrDecipher, I'll make my final project at graduation with this, so this tutorial will be great =]

AugustMesavila avatar Jan 19 '16 12:01 AugustMesavila

@DrDecipher @shimat Im getting this error for MSER, OpenCvSharp.XFeatures2D.

Can You please provide this example ?

Sacristan avatar Mar 10 '17 15:03 Sacristan