| | |
| | | using Newtonsoft.Json; |
| | | using HalconDotNet; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using OpenCvSharp; |
| | | using OpenCvSharp.Extensions; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Diagnostics; |
| | | using System.Text; |
| | |
| | | |
| | | Mat src = Cv2.ImRead(SN); |
| | | if (src != null && !src.Empty()) |
| | | OutputImage = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src); |
| | | OutputImage = src.ToBitmap(); |
| | | } |
| | | } |
| | | } |
| | |
| | | Msg = ""; |
| | | if (OutputImage != null) |
| | | { |
| | | if (OutputImage is Bitmap) |
| | | { |
| | | if (OutputImage is HObject) |
| | | ((HObject)OutputImage).Dispose(); |
| | | else if (OutputImage is Mat) |
| | | ((Mat)OutputImage).Dispose(); |
| | | else if (OutputImage is Bitmap) |
| | | ((Bitmap)OutputImage).Dispose(); |
| | | } |
| | | |
| | | OutputImage = null; |
| | | } |
| | | if (Record != null) |
| | | { |
| | | Record.Dispose(); |
| | | Record = null; |
| | | } |
| | | } |
| | | |
| | | public override void Dispose() |
| | | { |
| | | if (InputImage != null) |
| | | { |
| | | if (InputImage is HObject) |
| | | ((HObject)InputImage).Dispose(); |
| | | else if (InputImage is Mat) |
| | | ((Mat)InputImage).Dispose(); |
| | | else if (InputImage is Bitmap) |
| | | ((Bitmap)InputImage).Dispose(); |
| | | |
| | | InputImage = null; |
| | | } |
| | | |
| | | if (OutputImage != null) |
| | | { |
| | | if (OutputImage is HObject) |
| | | ((HObject)OutputImage).Dispose(); |
| | | else if (OutputImage is Mat) |
| | | ((Mat)OutputImage).Dispose(); |
| | | else if (OutputImage is Bitmap) |
| | | ((Bitmap)OutputImage).Dispose(); |
| | | |
| | | OutputImage = null; |
| | | } |
| | | return; |
| | | } |
| | | |