Commit f77a0c5a 刘韬

1

1 个父辈 340d848c
正在显示 1 个修改的文件 包含 9 行增加10 行删除
...@@ -15,6 +15,7 @@ using System.Text; ...@@ -15,6 +15,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Runtime.ExceptionServices;
namespace AOI namespace AOI
{ {
...@@ -233,6 +234,7 @@ namespace AOI ...@@ -233,6 +234,7 @@ namespace AOI
return (Bitmap)BaseImg; return (Bitmap)BaseImg;
} }
} }
[HandleProcessCorruptedStateExceptions]
public Bitmap ProcessTestImage(Bitmap targetimage, string name) public Bitmap ProcessTestImage(Bitmap targetimage, string name)
{ {
var markroi = BaseROI; var markroi = BaseROI;
...@@ -256,6 +258,7 @@ namespace AOI ...@@ -256,6 +258,7 @@ namespace AOI
return matchBitmap; return matchBitmap;
} }
} }
[HandleProcessCorruptedStateExceptions]
public static bool SURF_MatchTemplate(Bitmap basebmp, Bitmap targetbmp, RectangleF rectangleF, out Bitmap matchBitmap) public static bool SURF_MatchTemplate(Bitmap basebmp, Bitmap targetbmp, RectangleF rectangleF, out Bitmap matchBitmap)
{ {
//return Star_MatchTemplate(basebmp, targetbmp, rectangleF, out matchBitmap); //return Star_MatchTemplate(basebmp, targetbmp, rectangleF, out matchBitmap);
...@@ -392,20 +395,16 @@ namespace AOI ...@@ -392,20 +395,16 @@ namespace AOI
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.ToString());
return false; return false;
} }
finally finally
{ {
if (imgTemplate != null) imgTemplate?.Dispose();
imgTemplate.Dispose(); imgTarget?.Dispose();
if (imgTarget != null) tempDesc?.Dispose();
imgTarget.Dispose(); imgMatches?.Dispose();
if (tempDesc != null) resultmat?.Dispose();
tempDesc.Dispose();
if (imgMatches != null)
imgMatches.Dispose();
if (resultmat != null)
resultmat.Dispose();
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!