TestDataSource.cs 1.2 KB

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