Commit 77cdfaaf LN

增加扫码日志

1 个父辈 91289240
...@@ -21,6 +21,8 @@ namespace CodeLibrary ...@@ -21,6 +21,8 @@ namespace CodeLibrary
{ {
if (!IsInit) if (!IsInit)
{ {
Init();
//string detectorConfigPath = Application.StartupPath + @"\\model\\" + "detect-tiny.cfg"; //string detectorConfigPath = Application.StartupPath + @"\\model\\" + "detect-tiny.cfg";
//string detectorModelPath = Application.StartupPath + @"\\model\\" + "detect-tiny.weights"; //string detectorModelPath = Application.StartupPath + @"\\model\\" + "detect-tiny.weights";
//string superResolutionConfigPath = Application.StartupPath + @"\\model\\" + "sr.caffemodel"; //string superResolutionConfigPath = Application.StartupPath + @"\\model\\" + "sr.caffemodel";
...@@ -237,6 +239,40 @@ namespace CodeLibrary ...@@ -237,6 +239,40 @@ namespace CodeLibrary
return eyemDetectAndDecodeFree(handle); return eyemDetectAndDecodeFree(handle);
} }
} }
#region 日志
public delegate void TCallBack(string msg);
public static TCallBack sld = new TCallBack(TLogCallback);
public static event TCallBack OnNewLogCallback;
public static void TLogCallback(string msg)
{
OnNewLogCallback?.Invoke(msg);
}
//程序启动时初始化一次
private static void Init()
{
setLogCallback(sld);
OnNewLogCallback += new TCallBack(EyemLib_OnNewLogCallback);
}
//程序结束时释放
public static void Free()
{
setLogCallback(null); sld = null;
}
//记录算法日志
private static void EyemLib_OnNewLogCallback(string msg)
{
//算法里输出的一切日志都会在这里
if (msg.Contains("__eyemDetectAndDecodeUseNN__"))
{
HDLogUtil.info(msg);
}
}
#endregion
//基于深度学习读码程序(仅支持QR、DataMatrix) //基于深度学习读码程序(仅支持QR、DataMatrix)
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemDetectAndDecodeUseNN(EyemImage tpImage, EyemRect tpRoi, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, out EyemImage tpDstImg); private static extern int eyemDetectAndDecodeUseNN(EyemImage tpImage, EyemRect tpRoi, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, out EyemImage tpDstImg);
...@@ -293,6 +329,10 @@ namespace CodeLibrary ...@@ -293,6 +329,10 @@ namespace CodeLibrary
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern bool eyemDetectAndDecodeFree(IntPtr hObject); private static extern bool eyemDetectAndDecodeFree(IntPtr hObject);
// 设定日志回调
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern void setLogCallback(TCallBack cb);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemImage public struct EyemImage
{ {
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!