DepthImage.cs 809 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace bbiwarg.DataSource
  7. {
  8. /**
  9. * Represents an depth image where the depth is given in distance to the camera in millimeters.
  10. */
  11. class DepthImage
  12. {
  13. private int width, height;
  14. private short[] data;
  15. public DepthImage(int width, int height, short[] data)
  16. {
  17. this.width = width;
  18. this.height = height;
  19. this.data = data;
  20. }
  21. public int getWidth()
  22. {
  23. return width;
  24. }
  25. public int getHeight()
  26. {
  27. return height;
  28. }
  29. public short getDepth(int x, int y)
  30. {
  31. return data[y * width + x];
  32. }
  33. }
  34. }