MoldedImageMetas.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. 
  2. namespace YOLODetectProcessLib
  3. {
  4. /// <summary>
  5. /// 在规整图像(使其尺寸符合网络输入尺寸)时的一些元信息
  6. /// 在将网络输出结果坐标转换到原始图像坐标时,需要这些信息
  7. /// </summary>
  8. public struct MoldedImageMetas
  9. {
  10. /// <summary>
  11. /// 网络中输入图像层的高度
  12. /// </summary>
  13. public int NetImgInputHeight { get; set; }
  14. /// <summary>
  15. /// 网络中输入图像层的宽度
  16. /// </summary>
  17. public int NetImgInputWidth { get; set; }
  18. /// <summary>
  19. /// 网络中输入图像层的通道数
  20. /// </summary>
  21. public int NetImgInputChannels { get; set; }
  22. /// <summary>
  23. /// 原始图像的高度
  24. /// </summary>
  25. public int OrigImgHeight { get; set; }
  26. /// <summary>
  27. /// 原始图像的宽度
  28. /// </summary>
  29. public int OrigImgWidth { get; set; }
  30. /// <summary>
  31. /// 在原始图像上感兴趣区域的左上点纵坐标
  32. /// </summary>
  33. public int ROIRectTop { get; set; }
  34. /// <summary>
  35. /// 在原始图像上感兴趣区域的左上点横坐标
  36. /// </summary>
  37. public int ROIRectLeft { get; set; }
  38. /// <summary>
  39. /// 在原始图像上感兴趣区域的高度
  40. /// </summary>
  41. public int ROIRectHeight { get; set; }
  42. /// <summary>
  43. /// 在原始图像上感兴趣区域的宽度
  44. /// </summary>
  45. public int ROIRectWidth { get; set; }
  46. /// <summary>
  47. /// 在将ROI规整成网络所需的尺寸时,上面填充的像素个数
  48. /// </summary>
  49. public int MoldTop { get; set; }
  50. /// <summary>
  51. /// 在将ROI规整成网络所需的尺寸时,左边填充的像素个数
  52. /// </summary>
  53. public int MoldLeft { get; set; }
  54. /// <summary>
  55. /// 在将ROI规整成网络所需的尺寸时,ROI实际缩放的高度
  56. /// </summary>
  57. public int MoldHeight { get; set; }
  58. /// <summary>
  59. /// 在将ROI规整成网络所需的尺寸时,ROI实际缩放的宽度
  60. /// </summary>
  61. public int MoldWidth { get; set; }
  62. public MoldedImageMetas(int netHeight, int netWidth, int netChannel, int origHeight, int origWidth,
  63. int roiTop, int roiLeft, int roiHeight, int roiWidth, int moldTop, int moldLeft, int moldHeight, int moldWidth)
  64. {
  65. NetImgInputHeight = netHeight;
  66. NetImgInputWidth = netWidth;
  67. NetImgInputChannels = netChannel;
  68. OrigImgHeight = origHeight;
  69. OrigImgWidth = origWidth;
  70. ROIRectTop = roiTop;
  71. ROIRectLeft = roiLeft;
  72. ROIRectHeight = roiHeight;
  73. ROIRectWidth = roiWidth;
  74. MoldTop = moldTop;
  75. MoldLeft = moldLeft;
  76. MoldHeight = moldHeight;
  77. MoldWidth = moldWidth;
  78. }
  79. }
  80. }