NCMDetector.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using OTSAlgrithm.AI;
  2. using OpenCvSharp;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace OTSAlgrithm
  10. {
  11. /// <summary>
  12. /// 检测样品中的镍钴锰元素(NCM)区域
  13. /// </summary>
  14. public class NCMDetector
  15. {
  16. /// <summary>
  17. /// AI服务URL
  18. /// </summary>
  19. public virtual string AIServerURL { get; set; } = "http://192.168.1.107:9600";
  20. /// <summary>
  21. /// 模型类别
  22. /// </summary>
  23. public virtual string AICatagory { get; set; } = "5000";
  24. /// <summary>
  25. /// 模型Item
  26. /// </summary>
  27. public virtual string AIItem { get; set; } = "004";
  28. public List<AIShapeResult> Detect(Mat img)
  29. {
  30. var jsongResult = AIHttpClient.SegmentImageJson(AIServerURL, img, AICatagory, AIItem);
  31. if (jsongResult.shapes == null)
  32. {
  33. return new List<AIShapeResult>();
  34. }
  35. return jsongResult.shapes;
  36. }
  37. }
  38. }