using System; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; namespace OS.Spin.SdkLayer { public class SdkLoad { private const string SdkDll = "TFD.dll"; /************************************************************************* * FUNCTION: TFD_Init * PURPOSE: 初始化 * PARAM: [in/out] handle - 句柄 [in] params - 参数 * RETURN: 成功(0)或者错误代码(<0) * NOTES: *************************************************************************/ [HandleProcessCorruptedStateExceptions] [DllImport(SdkDll, EntryPoint = "TFD_Init", CallingConvention = CallingConvention.Cdecl)] public static extern int TFD_Init(ref IntPtr handle, Modle.Sdk.StructInfos.TFD_PARAM param); [HandleProcessCorruptedStateExceptions] [DllImport(SdkDll, EntryPoint = "TFD_Init_5", CallingConvention = CallingConvention.Cdecl)] public static extern int TFD_Init_5(ref IntPtr handle, Modle.Sdk.StructInfos.TFD_PARAM param); [HandleProcessCorruptedStateExceptions] [DllImport(SdkDll, EntryPoint = "TFD_Init_37", CallingConvention = CallingConvention.Cdecl)] public static extern int TFD_Init_37(ref IntPtr handle, Modle.Sdk.StructInfos.TFD_PARAM param); /************************************************************************* * FUNCTION: TFD_ProcessBatch * PURPOSE: 检测 * PARAM: [in] handle - 处理句柄 [in] imgArray - 图片数据(3通道BGR数据 cv::Mat格式) [in] batchsize - 批量数 [in/out] result - 检测结果 * RETURN: 成功(0)或者错误代码(<0) * NOTES: *************************************************************************/ [HandleProcessCorruptedStateExceptions] [DllImport(SdkDll, EntryPoint = "TFD_ProcessBatch", CallingConvention = CallingConvention.Cdecl)] public static extern int TFD_ProcessBatch(IntPtr handle, Modle.Sdk.StructInfos.DATA_IMAGE[] imgArray, int batchsize, IntPtr result); // /************************************************************************* * FUNCTION: TFD_ProcessBatch * PURPOSE: 检测 * PARAM: [in] handle - 处理句柄 [in] imgArray - 图片数据(3通道BGR数据 cv::Mat格式) [in] batchsize - 批量数 [in/out] result - 检测结果 * RETURN: 成功(0)或者错误代码(<0) * NOTES: *************************************************************************/ [HandleProcessCorruptedStateExceptions] [DllImport(SdkDll, EntryPoint = "TFD_ProcessBatch_ex", CallingConvention = CallingConvention.Cdecl)] public static extern int TFD_ProcessBatch_ex(IntPtr handle, IntPtr imgArray,int w,int h, int batchsize, IntPtr result); } }