Commit 63305355 LN

代码优化

1 个父辈 e20c1059
......@@ -143,6 +143,13 @@ namespace CodeLibrary
}
}
HDLogUtil.debug(" DecodeCode[" + symbolType + "][" + hv_model_path + "][" + codeCount + "] 结束,返回数量:"+codeList.Count);
if (ho_SymbolXLDs != null)
{
ho_SymbolXLDs.Dispose();
ho_SymbolXLDs = null;
}
return codeList;
}
catch (Exception ex)
......
......@@ -219,7 +219,7 @@ namespace CodeLibrary
CodeResultAdd(hv_DecodedDataStrings, codeType, "学习");
}
ShowImage(hv_ExpDefaultWinHandle, ho_Image, ho_SymbolXLDs);
ho_Image.Dispose();
}
if (findCode.Count >= codeCount || stopWatch.ElapsedMilliseconds > timeOutMs)
{
......
......@@ -351,6 +351,7 @@ namespace CodeLibrary
Open(name);
}
MyCamera.MV_FRAME_OUT FrameInfo = new MyCamera.MV_FRAME_OUT();
try
{
int rtn = cameraCurr[index].MV_CC_StartGrabbing_NET();
......@@ -359,12 +360,12 @@ namespace CodeLibrary
_errInfo = "Can not grab one : " + rtn;
return null;
}
MyCamera.MV_FRAME_OUT FrameInfo = new MyCamera.MV_FRAME_OUT();
int nRet = cameraCurr[index].MV_CC_GetImageBuffer_NET(ref FrameInfo, 1000);
// ch:获取一帧图像 | en:Get one image
if (MyCamera.MV_OK == nRet)
{
Console.WriteLine("Get Image Buffer:" + "Width[" + Convert.ToString(FrameInfo.stFrameInfo.nWidth) + "] , Height[" + Convert.ToString(FrameInfo.stFrameInfo.nHeight)
HDLogUtil.debug("Get Image Buffer:" + "Width[" + Convert.ToString(FrameInfo.stFrameInfo.nWidth) + "] , Height[" + Convert.ToString(FrameInfo.stFrameInfo.nHeight)
+ "] , FrameNum[" + Convert.ToString(FrameInfo.stFrameInfo.nFrameNum) + "]");
HObject ho_Imagetemp;
......@@ -375,14 +376,14 @@ namespace CodeLibrary
nRet = cameraCurr[index].MV_CC_FreeImageBuffer_NET(ref FrameInfo);
if (nRet != MyCamera.MV_OK)
{
Console.WriteLine("Free Image Buffer fail:{0:x8}", nRet);
HDLogUtil.error(" [" + name + "] Free Image Buffer fail:" + nRet);
}
}
return ho_Imagetemp;
}
else
{
Console.WriteLine("No data:{0:x8}", nRet);
HDLogUtil.error(" [" + name + "] MV_CC_GetImageBuffer_NET No data: " + nRet);
}
}
catch (Exception ex)
......@@ -393,6 +394,14 @@ namespace CodeLibrary
finally
{
cameraCurr[index].MV_CC_StopGrabbing_NET();
try
{
cameraCurr[index].MV_CC_FreeImageBuffer_NET(ref FrameInfo);
}
catch (Exception ex)
{
HDLogUtil.error(" [" + name + "] MV_CC_FreeImageBuffer_NET 出错:" + ex.ToString());
}
}
return null;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!