1
0

IImage.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace YOLODetectProcessLib
  5. {
  6. /// <summary>
  7. /// 图像
  8. /// </summary>
  9. public interface IImage : IDisposable
  10. {
  11. /// <summary>
  12. /// 图像数据
  13. /// </summary>
  14. byte[] DataBuffer { get; }
  15. /// <summary>
  16. /// 宽度
  17. /// </summary>
  18. int Width { get; set; }
  19. /// <summary>
  20. /// 高度
  21. /// </summary>
  22. int Height { get; set; }
  23. /// <summary>
  24. /// 通道数
  25. /// </summary>
  26. int Channel { get; set; }
  27. /// <summary>
  28. /// 步长
  29. /// </summary>
  30. int Stride { get; set; }
  31. /// <summary>
  32. /// 图像区的长度
  33. /// </summary>
  34. int DataBufferSize { get; set; }
  35. /// <summary>
  36. /// 从文件中加载
  37. /// </summary>
  38. /// <param name="filePath"></param>
  39. /// <returns></returns>
  40. void ReadFromFile(string filePath);
  41. /// <summary>
  42. /// 写入到文件
  43. /// </summary>
  44. /// <param name="filePath"></param>
  45. /// <returns></returns>
  46. void SaveIntoFile(string filePath);
  47. /// <summary>
  48. /// 复制
  49. /// </summary>
  50. /// <returns></returns>
  51. IImage Clone();
  52. /// <summary>
  53. /// 从外部数组复制到图像数据区
  54. /// </summary>
  55. /// <param name="data"></param>
  56. /// <param name="width"></param>
  57. /// <param name="height"></param>
  58. /// <param name="channel"></param>
  59. void CopyFrom(byte[] data, int width, int height, int channel);
  60. /// <summary>
  61. /// 设置DataBuffer的尺寸
  62. /// </summary>
  63. void SetDataBufferSize(int newSize);
  64. }
  65. }