TouchImage.cs 828 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Emgu.CV;
  7. using Emgu.CV.Structure;
  8. namespace bbiwarg.Images
  9. {
  10. public enum TouchImageState {
  11. none = 0,
  12. touchArea = 1,
  13. touchAreaMatched = 2,
  14. touchAreaStatusBar = 3,
  15. touchDetected = 4,
  16. touchTracked = 5
  17. }
  18. class TouchImage
  19. {
  20. private Image<Gray, Int16> image;
  21. public TouchImage(DepthImage depthImage) {
  22. image = depthImage.getImage().CopyBlank();
  23. }
  24. public void setTouchAt(int x, int y, TouchImageState tis) {
  25. image.Data[y, x, 0] = (Int16) tis;
  26. }
  27. public TouchImageState getStateAt(int x, int y) {
  28. return (TouchImageState)image.Data[y, x, 0];
  29. }
  30. }
  31. }