fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. .............
  8. public static async Task<double[,]> GLCMall(Bitmap source)
  9. {
  10.  
  11. await Task.Run(() => FinishSorceAsync = CreatGlcmMatrix(source));
  12. await Task.Run(() => GreyMatrixAsync = Test1(FinishSorceAsync));
  13. await Task.Run(() => GlcmAsync = TestMatrix());
  14. .......
  15.  
  16.  
  17. return GlcmAsync;
  18. }
  19. public static byte[,] CreatGlcmMatrix(Bitmap source)
  20. {
  21. // dwuwymiarowa tablica z progami jasności
  22. Byte[,] FinishSorce = new Byte[source.Width, source.Height];
  23.  
  24. for (int i = 0; i < source.Width; i++)
  25. {
  26. for (int x = 0; x < source.Height; x++)
  27. {
  28. int bmc = source.GetPixel(i, x);
  29. var myCol = System.Drawing.Color.FromArgb(bmc);
  30. FinishSorce[i, x] = myCol.R;
  31. }
  32. }
  33.  
  34. return FinishSorce;
  35. }
  36. //public Task<byte[,]> CreatGlcmMatrixAsync2(Bitmap source)
  37. //{
  38. // return Task<byte[,]>.Factory.StartNew(() => CreatGlcmMatrix(source));
  39. //}
  40. //public Task<double[,]> Test1Async(byte[,] FinishSorce)
  41. //{
  42. // return Task<double[,]>.Factory.StartNew(() => Test1(FinishSorce));
  43. //}
  44. //public async void CreatGlcmMatrixAndTestAsync(Bitmap source)
  45. //{
  46. // byte[,] FinishSorce = await CreatGlcmMatrixAsync2(source);
  47. // double[,] matrix = await Test1Async(FinishSorce);
  48.  
  49.  
  50. //}
  51. public static int[,] Test1(byte[,] FinishSorce)
  52. {
  53. switch (MatrixSize)
  54. {
  55. case 4:
  56. byte[] I4 = { 63, 127, 191, 255 };
  57. int[,] GMatrix4 = new int[FinishSorce.GetLength(0), FinishSorce.GetLength(1)];
  58.  
  59. for (int i = 0; i < FinishSorce.GetLength(0); i++)
  60. {
  61. for (int j = 0; j < FinishSorce.GetLength(1); j++)
  62. {
  63.  
  64. if (Int32.Parse(FinishSorce.GetValue(i, j).ToString()) <= 63)
  65. {
  66. GMatrix4.SetValue(0, i, j);
  67. }
  68.  
  69. else if (Int32.Parse(FinishSorce.GetValue(i, j).ToString()) <= 127)
  70. {
  71. GMatrix4.SetValue(1, i, j);
  72. }
  73.  
  74. else if (Int32.Parse(FinishSorce.GetValue(i, j).ToString()) <= 191)
  75. {
  76. GMatrix4.SetValue(2, i, j);
  77. }
  78.  
  79. else if (Int32.Parse(FinishSorce.GetValue(i, j).ToString()) <= 255)
  80. {
  81. GMatrix4.SetValue(3, i, j);
  82. }
  83. else
  84. {
  85. System.Console.WriteLine("Błąd obliczenia pixela ");
  86. }
  87. }
  88. }
  89. GrayMatrix = GMatrix4;
  90. break;
  91. .............
  92. }
  93. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(7,2): error CS1525: Unexpected symbol `.'
prog.cs(8,27): error CS1525: Unexpected symbol `<'
prog.cs(8,36): error CS1525: Unexpected symbol `]'
prog.cs(12,13): error CS4033: The `await' operator can only be used when its containing method is marked with the `async' modifier
prog.cs(13,13): error CS4033: The `await' operator can only be used when its containing method is marked with the `async' modifier
prog.cs(14,12): error CS1525: Unexpected symbol `.'
prog.cs(91,20): error CS1525: Unexpected symbol `.'
prog.cs(93,1): error CS1519: Unexpected symbol `end-of-file' in class, struct, or interface member declaration
Compilation failed: 8 error(s), 0 warnings
stdout
Standard output is empty