SdkImport.cs 3.85 KB
using System;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;

namespace OS.Spin.SdkLayer
{
    public class SdkImport
    {
        private const string SdkDll = "FLAW.dll";

        /*************************************************************************
       * FUNCTION: Flaw_Detection_Init
       * PURPOSE: 初始化
       * PARAM:
       [in/out] handle		- 句柄
       [in] params		- 参数
       * RETURN:	成功(0)或者错误代码(<0)
       * NOTES:
       *************************************************************************/
        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "Flaw_Detection_Init", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Flaw_Detection_Init(ref IntPtr handle);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="image_in"></param>
        /// <param name="image_disp"></param>
        /// <param name="cloths_kind"></param>
        /// <param name="dict_h"></param>
        /// <param name="dict_v"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "Flaw_Detection", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Flaw_Detection(IntPtr handle, IntPtr imgData, int width, int height, Modle.Sdk.StructInfos.D_PARAM param, ref IntPtr rect);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="image_in"></param>
        /// <param name="image_disp"></param>
        /// <param name="cloths_kind"></param>
        /// <param name="dict_h"></param>
        /// <param name="dict_v"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "Flaw_Detection1", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Flaw_Detection1(IntPtr handle, IntPtr imgData, int width, int height, Modle.Sdk.StructInfos.D_PARAM param, ref IntPtr rect);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="image_in"></param>
        /// <param name="image_disp"></param>
        /// <param name="cloths_kind"></param>
        /// <param name="dict_h"></param>
        /// <param name="dict_v"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "Flaw_Detection2", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Flaw_Detection2(IntPtr handle, IntPtr imgData, int width, int height, Modle.Sdk.StructInfos.D_PARAM param, ref IntPtr rect);




        /*************************************************************************
        * FUNCTION: Detc_Init
        * PURPOSE: 初始化
        [in/out] handle		- 句柄
        * RETURN:	成功(0)或者错误代码(<0)
        * NOTES:
        *************************************************************************/
        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "Detc_Post_Init", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Detc_Post_Init(ref IntPtr handle,int camera);

        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "Detc_Postprocess", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Detc_Postprocess(IntPtr handle, Modle.Sdk.StructInfos.Fore_Result[] fores, int count,ref IntPtr foresall,ref int foreCount,ref IntPtr finalresult,int currentMeter, ref byte stop);

        [HandleProcessCorruptedStateExceptions]
        [DllImport(SdkDll, EntryPoint = "DP_Clear", CallingConvention = CallingConvention.Cdecl)]
        public static extern int DP_Clear(IntPtr handle);
    }
}