Closed DRybochkin closed 10 years ago
@DRybochkin I am looking into this issue right now, although I am currently struggling with a parsing problem... (I can workaround the parsing problem for now, but I want to flag this separate issue as well.)
@cesarsouza Have you noticed that the Haar Cascade XML files in Open CV has recently changed their format? Please see this commit.
I have now debugged the code, and the GCHandle
is successfully allocated with type Pinned
, but then the AddrOfPinnedObject
method still interprets the handle as not Pinned
?
I need to investigate further whether this is a bug in the PCL/Phone adaptation of Accord, or whether it is an issue with Windows Phone's own class libraries. Stay tuned :-)
@cureos this code works on pure WP8, but don't work in PCL lib
this.nSumImage = new int[nHeight, nWidth];
this.nSumHandle = GCHandle.Alloc(nSumImage, GCHandleType.Pinned);
IntPtr ip = nSumHandle.AddrOfPinnedObject();
I think it somehow connected with redefining System.Runtime.InteropService
Yes, this is most likely the issue. I am currently searching the PCL version for inconsistencies, I'll get back as soon as I know more.
Change GCHandleType.cs in Portable.System on next
public enum GCHandleType
{
Weak = 0,
WeakTrackResurrection = 1,
Normal = 2,
Pinned = 3,
}
and it will work
That was exactly what I was testing when I saw your latest post :-)
I will provide the update and new binaries as soon as possible. Thanks for all your help with reporting and investigating this.
Best regards, Anders
You are welcome! Did you know the library in C# automatic generation haarcascade.xml from positive & negative images?
Now I have added the correction to the GCHandleType
enum in the aforge repository, and I have also replaced the Accord binaries for version 2.12.0.1 with binaries built with the Pinned
correction in place (I hope this should be enough).
Again, a big thank you for pointing out the issue and helping me solve it! Anders
PS. I was not aware of the XML generation functionality. I have not yet explored Accord in all the details. But it's good to know. Thanks!
Hi Anders,
I have the exception "Handle is not pinned" at last row of the next code
Exception
Code:
Thanks in advance Dmitry