TestDataSource.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Drawing;
  3. namespace bbiwarg
  4. {
  5. class TestDataSource
  6. {
  7. static void Main(string[] args)
  8. {
  9. IVideoDataSource source = new IIsuDataSource("..\\..\\videos\\1.skv");
  10. source.init();
  11. source.start();
  12. int i = 0;
  13. int j = 0;
  14. while (source.isActive())
  15. {
  16. source.updateFrame();
  17. if ((i % 30) == 0)
  18. {
  19. DepthImage image = source.getDepthImage();
  20. Bitmap bm = new Bitmap(image.getWidth(), image.getHeight());
  21. for (int x = 0; x < image.getWidth(); ++x)
  22. {
  23. for (int y = 0; y < image.getHeight(); ++y)
  24. {
  25. int value = (image.getDepth(x, y) / 4) % 256; // / 4 because most values are small (< 1024)
  26. bm.SetPixel(x, y, Color.FromArgb(255, value, value, value));
  27. }
  28. }
  29. bm.Save("test." + j + ".png");
  30. j++;
  31. }
  32. source.releaseFrame();
  33. ++i;
  34. }
  35. source.stop();
  36. }
  37. }
  38. }