OCRResult.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // Licensed under the Apache License, Version 2.0 (the "License");
  3. // you may not use this file except in compliance with the License.
  4. // You may obtain a copy of the License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. using Emgu.CV;
  14. using System.Collections.Generic;
  15. namespace IDCardRecognitionLibs.IDCardRecognitionCore
  16. {
  17. public enum EnumOCRProcessStatus
  18. {
  19. Failed = 0,
  20. Successed,
  21. GetEmptyTxtBoxes,
  22. GetEmptyPartImgs,
  23. GetEmptyTxtLines,
  24. }
  25. /// <summary>
  26. /// OCR识别结果
  27. /// </summary>
  28. public sealed class OCRResult
  29. {
  30. /// <summary>
  31. /// 文本处理状态
  32. /// </summary>
  33. public EnumOCRProcessStatus OCRProcessStatus { get; set; }
  34. /// <summary>
  35. /// 文本框
  36. /// </summary>
  37. public TextBlock[] TextBlocks { get; set; }
  38. /// <summary>
  39. /// 文本框检测耗时
  40. /// </summary>
  41. public float TimeDetectTextBox { get; set; }
  42. /// <summary>
  43. /// 文字提取耗时(处理完所有文本框)
  44. /// </summary>
  45. public float TimeRecogText { get; set; }
  46. /// <summary>
  47. /// 处理完一张图片的总耗时
  48. /// </summary>
  49. public float TimeAllProcessOneImage { get; set; }
  50. public OCRResult(TextBlock[] textBlocks, float timeDetectTextBox, float timeRecogText, float timeAllProcessOneImage)
  51. {
  52. TextBlocks = textBlocks;
  53. TimeDetectTextBox = timeDetectTextBox;
  54. TimeRecogText = timeRecogText;
  55. TimeAllProcessOneImage = timeAllProcessOneImage;
  56. }
  57. }
  58. }