Common.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #include <string>
  3. #include <vector>
  4. /**
  5. * @enum image_format_t
  6. * @brief 图像格式枚举
  7. *
  8. * 该枚举定义了支持的图像格式,包括 YUV420SPNV21 和 YUV420SPNV12,后续可再添加。
  9. */
  10. enum image_format_t
  11. {
  12. YUV420SPNV21 = 1, ///< YYYY ... VUVUVUVU ... FOR EEASY
  13. YUV420SPNV12 = 2 ///< YYYY ... UVUVUVUV ... FOR AXURE
  14. };
  15. /**
  16. * @struct frame_t
  17. * @brief 图片帧结构体
  18. */
  19. typedef struct
  20. {
  21. void *pVir; ///< 虚拟指针
  22. void *pVir_UV; ///< UV虚拟指针
  23. unsigned int pPhy; ///< 物理地址
  24. unsigned int pPhy_UV; ///< UV物理地址
  25. int w; ///< 帧宽度
  26. int h; ///< 帧高度
  27. int fmt; ///< 帧格式
  28. } frame_t;
  29. /**
  30. * @struct BoundingBox
  31. * @brief FOR 芯片合作伙伴 边界框结构体
  32. */
  33. typedef struct
  34. {
  35. float x1; ///< x坐标
  36. float y1; ///< y坐标
  37. float x2; ///< 宽度
  38. float y2; ///< 高度
  39. float detect_confidence; ///< 置信度
  40. std::string category; ///< 类别信息
  41. } BoundingBox;
  42. // 算法内部使用结构构体
  43. struct Result
  44. {
  45. frame_t frame;
  46. std::vector<BoundingBox> bbox;
  47. };
  48. /**
  49. * @struct BoundingBox_Res
  50. * @brief FOR 嵌入式同事 用于给C代码的推理结果边界框结构体
  51. *
  52. * 该结构体用于表示推理模型输出的边界框信息,包括位置坐标、宽度、高度、检测置信度和类别信息。
  53. */
  54. typedef struct
  55. {
  56. int x1; /**< x坐标 */
  57. int y1; /**< y坐标 */
  58. int x2; /**< 宽度 */
  59. int y2; /**< 高度 */
  60. float detect_confidence; /**< 检测置信度 */
  61. char *category; /**< 类别信息 */
  62. } BoundingBox_C;