搞了3天 就在调试海康的DLL,一个buffer的问题。终于搞定了
Reference:
http://www.csharphelp.com/archives/archive52.html
API:
int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, ULONG *Size)
C#
[DllImport("DS40xxSDK.dll")]
public static extern int GetOriginalImage(IntPtr hChannelHandle, [MarshalAs(UnmanagedType.LPArray)] byte[] ImageBuf, ref long Size);
调用:
byte[] byffer = new byte[1048576];
long size = 1048576;
DS40xxSDK.GetOriginalImage(handler1, byffer, ref size);
关键就是要初始化这个buffer