You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
7.5 KiB

  1. //----------------------------------------------------------------------------
  2. // Copyright (C) 2004-2024 by EMGU Corporation. All rights reserved.
  3. //----------------------------------------------------------------------------
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. using System.Text;
  8. using Emgu.CV;
  9. using Emgu.CV.Cuda;
  10. using Emgu.CV.CvEnum;
  11. using Emgu.CV.Dnn;
  12. using Emgu.CV.ML;
  13. //using Backend = Emgu.CV.Dnn.Backend;
  14. namespace MauiDemoApp
  15. {
  16. public class AboutPage : ContentPage
  17. {
  18. public AboutPage()
  19. {
  20. #if DEBUG
  21. CvInvoke.LogLevel = LogLevel.Verbose; //LogLevel.Debug;
  22. #endif
  23. String lineBreak = "<br/>";
  24. String openclTxt = String.Format("Has OpenCL: {0}", CvInvoke.HaveOpenCL);
  25. if (CvInvoke.HaveOpenCL)
  26. {
  27. openclTxt = String.Format("{0}{1}Use OpenCL: {2}{1}<textarea rows=\"5\">{3}</textarea>{1}",
  28. openclTxt, lineBreak,
  29. CvInvoke.UseOpenCL,
  30. CvInvoke.OclGetPlatformsSummary());
  31. }
  32. String cudaTxt = String.Format("Has CUDA: {0}", CudaInvoke.HasCuda);
  33. if (CudaInvoke.HasCuda)
  34. {
  35. cudaTxt = String.Format("{0}{1}<textarea rows=\"5\">{2}</textarea>{1}",
  36. cudaTxt,
  37. lineBreak,
  38. CudaInvoke.GetCudaDevicesSummary());
  39. }
  40. var openCVConfigDict = CvInvoke.ConfigDict;
  41. bool haveDNN = (openCVConfigDict["HAVE_OPENCV_DNN"] != 0);
  42. String dnnText;
  43. if (haveDNN)
  44. {
  45. var dnnBackends = DnnInvoke.AvailableBackends;
  46. List<String> dnnBackendsText = new List<string>();
  47. foreach (var dnnBackend in dnnBackends)
  48. {
  49. dnnBackendsText.Add(String.Format("<p>{0} - {1}</p>", dnnBackend.Backend, dnnBackend.Target));
  50. }
  51. dnnText = String.Join("", dnnBackendsText.ToArray());
  52. }
  53. else
  54. {
  55. dnnText = "DNN is not available";
  56. }
  57. bool haveVideoio = (openCVConfigDict["HAVE_OPENCV_VIDEOIO"] != 0);
  58. String osDescription = Emgu.Util.Platform.OperationSystem.ToString();
  59. String parallelText;
  60. List<String> parallelBackendText = new List<string>();
  61. foreach (var parallelBackend in CvInvoke.AvailableParallelBackends)
  62. {
  63. parallelBackendText.Add(String.Format("<p>{0}</p>", parallelBackend));
  64. }
  65. parallelText = String.Join("", parallelBackendText.ToArray());
  66. String tesseractText;
  67. String tesseractVersion = String.Empty;
  68. bool haveTesseract = (openCVConfigDict["HAVE_EMGUCV_TESSERACT"] != 0);
  69. if (haveTesseract)
  70. {
  71. tesseractVersion = Emgu.CV.OCR.Tesseract.VersionString;
  72. if (tesseractVersion.Length == 0)
  73. haveTesseract = false;
  74. }
  75. if (haveTesseract)
  76. {
  77. tesseractText = String.Format("Version: {0}", tesseractVersion);
  78. }
  79. else
  80. {
  81. tesseractText = "Tesseract OCR is not available";
  82. }
  83. Content =
  84. new Microsoft.Maui.Controls.ScrollView()
  85. {
  86. Content =
  87. new WebView()
  88. {
  89. //WidthRequest = 1000,
  90. //HeightRequest = 1000,
  91. MinimumWidthRequest = 100,
  92. MinimumHeightRequest = 100,
  93. Source = new HtmlWebViewSource()
  94. {
  95. Html =
  96. @"<html>
  97. <head>
  98. <style>body { background-color: #EEEEEE; }</style>
  99. <style type=""text/css"">
  100. textarea { width: 100%; margin: 0; padding: 0; border - width: 0; }
  101. </style>
  102. </head>
  103. <body>
  104. <H2> Emgu CV for MAUI</H2>
  105. <a href=http://www.emgu.com>Visit our website</a> <br/><br/>
  106. <a href=mailto:support@emgu.com>Email Support</a> <br/><br/>
  107. <H4> OpenCL Info </H4>
  108. " + openclTxt + @"
  109. <H4> Cuda Info </H4>
  110. " + cudaTxt + @"
  111. <H4> OS: </H4>
  112. " + osDescription + @"
  113. <H4> Available Parallel Backends: </H4>
  114. " + parallelText + @"
  115. <H4> Dnn Backends: </H4>
  116. " + dnnText + @"
  117. <H4> Capture Backends (VideoCapture from device): </H4>
  118. " + (haveVideoio ? GetBackendInfo(CvInvoke.Backends) : "Videoio backend not supported.") + @"
  119. <H4> Stream Backends (VideoCapture from file/Stream): </H4>
  120. " + (haveVideoio ? GetBackendInfo(CvInvoke.StreamBackends) : "Videoio backend not supported.") + @"
  121. <H4> VideoWriter Backends: </H4>
  122. " + (haveVideoio ? GetBackendInfo(CvInvoke.WriterBackends) : "Videoio backend not supported.") + @"
  123. <H4> Tesseract OCR: </H4>
  124. " + tesseractText + @"
  125. <H4> Build Info </H4>
  126. <textarea rows=""30"">"
  127. + CvInvoke.BuildInformation + @"
  128. </textarea>
  129. <H4> RuntimeInformation.OSArchitecture: </H4>
  130. " + RuntimeInformation.OSArchitecture + @"
  131. <H4> RuntimeInformation.OSDescription: </H4>
  132. " + RuntimeInformation.OSDescription + @"
  133. <H4> RuntimeInformation.FrameworkDescription: </H4>
  134. " + RuntimeInformation.FrameworkDescription + @"
  135. <H4> RuntimeInformation.ProcessArchitecture: </H4>
  136. " + RuntimeInformation.ProcessArchitecture + @"
  137. <H4> RuntimeInformation.RuntimeIdentifier: </H4>
  138. " + RuntimeInformation.RuntimeIdentifier + @"
  139. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.Model: </H4>
  140. " + Microsoft.Maui.Devices.DeviceInfo.Current.Model + @"
  141. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.Manufacturer: </H4>
  142. " + Microsoft.Maui.Devices.DeviceInfo.Current.Manufacturer + @"
  143. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.Name: </H4>
  144. " + Microsoft.Maui.Devices.DeviceInfo.Current.Name + @"
  145. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.VersionString: </H4>
  146. " + Microsoft.Maui.Devices.DeviceInfo.Current.VersionString + @"
  147. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.Idiom: </H4>
  148. " + Microsoft.Maui.Devices.DeviceInfo.Current.Idiom + @"
  149. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.Platform: </H4>
  150. " + Microsoft.Maui.Devices.DeviceInfo.Current.Platform+ @"
  151. <H4> Microsoft.Maui.Devices.DeviceInfo.Current.DeviceType: </H4>
  152. " + Microsoft.Maui.Devices.DeviceInfo.Current.DeviceType+ @"
  153. </body>
  154. </html>"
  155. }
  156. }
  157. };
  158. Content.BackgroundColor = Color.FromRgb(1.0, 0.0, 0.0);
  159. }
  160. private static String GetBackendInfo(Emgu.CV.Backend[] backends)
  161. {
  162. List<String> backendsText = new List<string>();
  163. foreach (var backend in backends)
  164. {
  165. backendsText.Add(String.Format("<p>{0} - {1}</p>", backend.ID, backend.Name));
  166. }
  167. return String.Join("", backendsText.ToArray());
  168. }
  169. }
  170. }