diff options
Diffstat (limited to 'Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs')
| -rw-r--r-- | Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs index c0f827e1b..50bcceeba 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs @@ -17,6 +17,7 @@ namespace Tango.TCC.BL private ColorDetector _colorDetector; private static byte[] _defaultTemplate; private static List<DetectionBenchmark> _defaultBenchmarks; + private byte[] _sourceBitmapBytes; private bool _canDetect; public bool CanDetect @@ -54,14 +55,22 @@ namespace Tango.TCC.BL CardDetectionResult detectionResult = new CardDetectionResult(); detectionResult.Source = cloned; + _sourceBitmapBytes = cloned.ToBytes(PixelFormats.Rgb24); + Tango.TCC.CardDetector.CardDetection detector = new TCC.CardDetector.CardDetection(); - var result = detector.Detect(cloned.ToBytes(PixelFormats.Rgb24), new TCC.CardDetector.CardDetectionConfig() + var result = detector.Detect(_sourceBitmapBytes, new TCC.CardDetector.CardDetectionConfig() { DesiredBitmapWidth = config.DesiredBitmapWidth, DesiredBitmapHeight = config.DesiredBitmapHeight, - TemplateBitmap = config.TemplateBitmapBytes != null ? config.TemplateBitmapBytes : _defaultTemplate.ToArray(), + TemplateBitmap = config.TemplateBitmapBytes != null ? config.TemplateBitmapBytes : _defaultTemplate, + SimilarityTolerance = config.SimilarityTolerance, + HistogramMethod = (int)config.HistogramMethod, + EnableDoubleChecking = config.EnableDoubleChecking, }); + detectionResult.Similarity = result.Similarity; + detectionResult.Barcode = result.Barcode; + if (result.IsDetected) { detectionResult.IsDetected = true; |
