Text.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. #if !UNITY_WSA_10_0
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.TextModule
  8. {
  9. // C++: class Text
  10. //javadoc: Text
  11. public class Text
  12. {
  13. // C++: enum decoder_mode
  14. public const int OCR_DECODER_VITERBI = 0;
  15. // C++: enum <unnamed>
  16. public const int ERFILTER_NM_RGBLGrad = 0;
  17. public const int ERFILTER_NM_IHSGrad = 1;
  18. public const int OCR_LEVEL_WORD = 0;
  19. public const int OCR_LEVEL_TEXTLINE = 1;
  20. // C++: enum ocr_engine_mode
  21. public const int OEM_TESSERACT_ONLY = 0;
  22. public const int OEM_CUBE_ONLY = 1;
  23. public const int OEM_TESSERACT_CUBE_COMBINED = 2;
  24. public const int OEM_DEFAULT = 3;
  25. // C++: enum page_seg_mode
  26. public const int PSM_OSD_ONLY = 0;
  27. public const int PSM_AUTO_OSD = 1;
  28. public const int PSM_AUTO_ONLY = 2;
  29. public const int PSM_AUTO = 3;
  30. public const int PSM_SINGLE_COLUMN = 4;
  31. public const int PSM_SINGLE_BLOCK_VERT_TEXT = 5;
  32. public const int PSM_SINGLE_BLOCK = 6;
  33. public const int PSM_SINGLE_LINE = 7;
  34. public const int PSM_SINGLE_WORD = 8;
  35. public const int PSM_CIRCLE_WORD = 9;
  36. public const int PSM_SINGLE_CHAR = 10;
  37. // C++: enum classifier_type
  38. public const int OCR_KNN_CLASSIFIER = 0;
  39. public const int OCR_CNN_CLASSIFIER = 1;
  40. // C++: enum erGrouping_Modes
  41. public const int ERGROUPING_ORIENTATION_HORIZ = 0;
  42. public const int ERGROUPING_ORIENTATION_ANY = 1;
  43. //
  44. // C++: Mat cv::text::createOCRHMMTransitionsTable(String vocabulary, vector_String lexicon)
  45. //
  46. //javadoc: createOCRHMMTransitionsTable(vocabulary, lexicon)
  47. public static Mat createOCRHMMTransitionsTable (string vocabulary, List<string> lexicon)
  48. {
  49. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  50. Mat lexicon_mat = Converters.vector_String_to_Mat (lexicon);
  51. Mat retVal = new Mat (text_Text_createOCRHMMTransitionsTable_10 (vocabulary, lexicon_mat.nativeObj));
  52. return retVal;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //
  58. // C++: Ptr_ERFilter cv::text::createERFilterNM1(Ptr_ERFilter_Callback cb, int thresholdDelta = 1, float minArea = (float)0.00025, float maxArea = (float)0.13, float minProbability = (float)0.4, bool nonMaxSuppression = true, float minProbabilityDiff = (float)0.1)
  59. //
  60. // Unknown type 'Ptr_ERFilter_Callback' (I), skipping the function
  61. //
  62. // C++: Ptr_ERFilter cv::text::createERFilterNM1(String filename, int thresholdDelta = 1, float minArea = (float)0.00025, float maxArea = (float)0.13, float minProbability = (float)0.4, bool nonMaxSuppression = true, float minProbabilityDiff = (float)0.1)
  63. //
  64. //javadoc: createERFilterNM1(filename, thresholdDelta, minArea, maxArea, minProbability, nonMaxSuppression, minProbabilityDiff)
  65. public static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression, float minProbabilityDiff)
  66. {
  67. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  68. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_10 (filename, thresholdDelta, minArea, maxArea, minProbability, nonMaxSuppression, minProbabilityDiff));
  69. return retVal;
  70. #else
  71. return null;
  72. #endif
  73. }
  74. //javadoc: createERFilterNM1(filename, thresholdDelta, minArea, maxArea, minProbability, nonMaxSuppression)
  75. public static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression)
  76. {
  77. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  78. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_11 (filename, thresholdDelta, minArea, maxArea, minProbability, nonMaxSuppression));
  79. return retVal;
  80. #else
  81. return null;
  82. #endif
  83. }
  84. //javadoc: createERFilterNM1(filename, thresholdDelta, minArea, maxArea, minProbability)
  85. public static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability)
  86. {
  87. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  88. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_12 (filename, thresholdDelta, minArea, maxArea, minProbability));
  89. return retVal;
  90. #else
  91. return null;
  92. #endif
  93. }
  94. //javadoc: createERFilterNM1(filename, thresholdDelta, minArea, maxArea)
  95. public static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea)
  96. {
  97. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  98. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_13 (filename, thresholdDelta, minArea, maxArea));
  99. return retVal;
  100. #else
  101. return null;
  102. #endif
  103. }
  104. //javadoc: createERFilterNM1(filename, thresholdDelta, minArea)
  105. public static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea)
  106. {
  107. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  108. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_14 (filename, thresholdDelta, minArea));
  109. return retVal;
  110. #else
  111. return null;
  112. #endif
  113. }
  114. //javadoc: createERFilterNM1(filename, thresholdDelta)
  115. public static ERFilter createERFilterNM1 (string filename, int thresholdDelta)
  116. {
  117. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  118. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_15 (filename, thresholdDelta));
  119. return retVal;
  120. #else
  121. return null;
  122. #endif
  123. }
  124. //javadoc: createERFilterNM1(filename)
  125. public static ERFilter createERFilterNM1 (string filename)
  126. {
  127. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  128. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM1_16 (filename));
  129. return retVal;
  130. #else
  131. return null;
  132. #endif
  133. }
  134. //
  135. // C++: Ptr_ERFilter cv::text::createERFilterNM2(Ptr_ERFilter_Callback cb, float minProbability = (float)0.3)
  136. //
  137. // Unknown type 'Ptr_ERFilter_Callback' (I), skipping the function
  138. //
  139. // C++: Ptr_ERFilter cv::text::createERFilterNM2(String filename, float minProbability = (float)0.3)
  140. //
  141. //javadoc: createERFilterNM2(filename, minProbability)
  142. public static ERFilter createERFilterNM2 (string filename, float minProbability)
  143. {
  144. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  145. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM2_10 (filename, minProbability));
  146. return retVal;
  147. #else
  148. return null;
  149. #endif
  150. }
  151. //javadoc: createERFilterNM2(filename)
  152. public static ERFilter createERFilterNM2 (string filename)
  153. {
  154. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  155. ERFilter retVal = ERFilter.__fromPtr__ (text_Text_createERFilterNM2_11 (filename));
  156. return retVal;
  157. #else
  158. return null;
  159. #endif
  160. }
  161. //
  162. // C++: Ptr_ERFilter_Callback cv::text::loadClassifierNM1(String filename)
  163. //
  164. // Return type 'Ptr_ERFilter_Callback' is not supported, skipping the function
  165. //
  166. // C++: Ptr_ERFilter_Callback cv::text::loadClassifierNM2(String filename)
  167. //
  168. // Return type 'Ptr_ERFilter_Callback' is not supported, skipping the function
  169. //
  170. // C++: Ptr_OCRBeamSearchDecoder_ClassifierCallback cv::text::loadOCRBeamSearchClassifierCNN(String filename)
  171. //
  172. // Return type 'Ptr_OCRBeamSearchDecoder_ClassifierCallback' is not supported, skipping the function
  173. //
  174. // C++: Ptr_OCRHMMDecoder_ClassifierCallback cv::text::loadOCRHMMClassifier(String filename, int classifier)
  175. //
  176. // Return type 'Ptr_OCRHMMDecoder_ClassifierCallback' is not supported, skipping the function
  177. //
  178. // C++: Ptr_OCRHMMDecoder_ClassifierCallback cv::text::loadOCRHMMClassifierCNN(String filename)
  179. //
  180. // Return type 'Ptr_OCRHMMDecoder_ClassifierCallback' is not supported, skipping the function
  181. //
  182. // C++: Ptr_OCRHMMDecoder_ClassifierCallback cv::text::loadOCRHMMClassifierNM(String filename)
  183. //
  184. // Return type 'Ptr_OCRHMMDecoder_ClassifierCallback' is not supported, skipping the function
  185. //
  186. // C++: void cv::text::computeNMChannels(Mat _src, vector_Mat& _channels, int _mode = ERFILTER_NM_RGBLGrad)
  187. //
  188. //javadoc: computeNMChannels(_src, _channels, _mode)
  189. public static void computeNMChannels (Mat _src, List<Mat> _channels, int _mode)
  190. {
  191. if (_src != null)
  192. _src.ThrowIfDisposed ();
  193. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  194. Mat _channels_mat = new Mat ();
  195. text_Text_computeNMChannels_10 (_src.nativeObj, _channels_mat.nativeObj, _mode);
  196. Converters.Mat_to_vector_Mat (_channels_mat, _channels);
  197. _channels_mat.release ();
  198. return;
  199. #else
  200. return;
  201. #endif
  202. }
  203. //javadoc: computeNMChannels(_src, _channels)
  204. public static void computeNMChannels (Mat _src, List<Mat> _channels)
  205. {
  206. if (_src != null)
  207. _src.ThrowIfDisposed ();
  208. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  209. Mat _channels_mat = new Mat ();
  210. text_Text_computeNMChannels_11 (_src.nativeObj, _channels_mat.nativeObj);
  211. Converters.Mat_to_vector_Mat (_channels_mat, _channels);
  212. _channels_mat.release ();
  213. return;
  214. #else
  215. return;
  216. #endif
  217. }
  218. //
  219. // C++: void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_Rect& groups_rects, int method = ERGROUPING_ORIENTATION_HORIZ, String filename = String(), float minProbability = (float)0.5)
  220. //
  221. //javadoc: detectRegions(image, er_filter1, er_filter2, groups_rects, method, filename, minProbability)
  222. public static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, string filename, float minProbability)
  223. {
  224. if (image != null)
  225. image.ThrowIfDisposed ();
  226. if (er_filter1 != null)
  227. er_filter1.ThrowIfDisposed ();
  228. if (er_filter2 != null)
  229. er_filter2.ThrowIfDisposed ();
  230. if (groups_rects != null)
  231. groups_rects.ThrowIfDisposed ();
  232. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  233. Mat groups_rects_mat = groups_rects;
  234. text_Text_detectRegions_10 (image.nativeObj, er_filter1.getNativeObjAddr (), er_filter2.getNativeObjAddr (), groups_rects_mat.nativeObj, method, filename, minProbability);
  235. return;
  236. #else
  237. return;
  238. #endif
  239. }
  240. //javadoc: detectRegions(image, er_filter1, er_filter2, groups_rects, method, filename)
  241. public static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, string filename)
  242. {
  243. if (image != null)
  244. image.ThrowIfDisposed ();
  245. if (er_filter1 != null)
  246. er_filter1.ThrowIfDisposed ();
  247. if (er_filter2 != null)
  248. er_filter2.ThrowIfDisposed ();
  249. if (groups_rects != null)
  250. groups_rects.ThrowIfDisposed ();
  251. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  252. Mat groups_rects_mat = groups_rects;
  253. text_Text_detectRegions_11 (image.nativeObj, er_filter1.getNativeObjAddr (), er_filter2.getNativeObjAddr (), groups_rects_mat.nativeObj, method, filename);
  254. return;
  255. #else
  256. return;
  257. #endif
  258. }
  259. //javadoc: detectRegions(image, er_filter1, er_filter2, groups_rects, method)
  260. public static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method)
  261. {
  262. if (image != null)
  263. image.ThrowIfDisposed ();
  264. if (er_filter1 != null)
  265. er_filter1.ThrowIfDisposed ();
  266. if (er_filter2 != null)
  267. er_filter2.ThrowIfDisposed ();
  268. if (groups_rects != null)
  269. groups_rects.ThrowIfDisposed ();
  270. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  271. Mat groups_rects_mat = groups_rects;
  272. text_Text_detectRegions_12 (image.nativeObj, er_filter1.getNativeObjAddr (), er_filter2.getNativeObjAddr (), groups_rects_mat.nativeObj, method);
  273. return;
  274. #else
  275. return;
  276. #endif
  277. }
  278. //javadoc: detectRegions(image, er_filter1, er_filter2, groups_rects)
  279. public static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects)
  280. {
  281. if (image != null)
  282. image.ThrowIfDisposed ();
  283. if (er_filter1 != null)
  284. er_filter1.ThrowIfDisposed ();
  285. if (er_filter2 != null)
  286. er_filter2.ThrowIfDisposed ();
  287. if (groups_rects != null)
  288. groups_rects.ThrowIfDisposed ();
  289. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  290. Mat groups_rects_mat = groups_rects;
  291. text_Text_detectRegions_13 (image.nativeObj, er_filter1.getNativeObjAddr (), er_filter2.getNativeObjAddr (), groups_rects_mat.nativeObj);
  292. return;
  293. #else
  294. return;
  295. #endif
  296. }
  297. //
  298. // C++: void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_vector_Point& regions)
  299. //
  300. //javadoc: detectRegions(image, er_filter1, er_filter2, regions)
  301. public static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, List<MatOfPoint> regions)
  302. {
  303. if (image != null)
  304. image.ThrowIfDisposed ();
  305. if (er_filter1 != null)
  306. er_filter1.ThrowIfDisposed ();
  307. if (er_filter2 != null)
  308. er_filter2.ThrowIfDisposed ();
  309. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  310. Mat regions_mat = new Mat ();
  311. text_Text_detectRegions_14 (image.nativeObj, er_filter1.getNativeObjAddr (), er_filter2.getNativeObjAddr (), regions_mat.nativeObj);
  312. Converters.Mat_to_vector_vector_Point (regions_mat, regions);
  313. regions_mat.release ();
  314. return;
  315. #else
  316. return;
  317. #endif
  318. }
  319. //
  320. // C++: void cv::text::erGrouping(Mat image, Mat channel, vector_vector_Point regions, vector_Rect& groups_rects, int method = ERGROUPING_ORIENTATION_HORIZ, String filename = String(), float minProbablity = (float)0.5)
  321. //
  322. //javadoc: erGrouping(image, channel, regions, groups_rects, method, filename, minProbablity)
  323. public static void erGrouping (Mat image, Mat channel, List<MatOfPoint> regions, MatOfRect groups_rects, int method, string filename, float minProbablity)
  324. {
  325. if (image != null)
  326. image.ThrowIfDisposed ();
  327. if (channel != null)
  328. channel.ThrowIfDisposed ();
  329. if (groups_rects != null)
  330. groups_rects.ThrowIfDisposed ();
  331. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  332. List<Mat> regions_tmplm = new List<Mat> ((regions != null) ? regions.Count : 0);
  333. Mat regions_mat = Converters.vector_vector_Point_to_Mat (regions, regions_tmplm);
  334. Mat groups_rects_mat = groups_rects;
  335. text_Text_erGrouping_10 (image.nativeObj, channel.nativeObj, regions_mat.nativeObj, groups_rects_mat.nativeObj, method, filename, minProbablity);
  336. return;
  337. #else
  338. return;
  339. #endif
  340. }
  341. //javadoc: erGrouping(image, channel, regions, groups_rects, method, filename)
  342. public static void erGrouping (Mat image, Mat channel, List<MatOfPoint> regions, MatOfRect groups_rects, int method, string filename)
  343. {
  344. if (image != null)
  345. image.ThrowIfDisposed ();
  346. if (channel != null)
  347. channel.ThrowIfDisposed ();
  348. if (groups_rects != null)
  349. groups_rects.ThrowIfDisposed ();
  350. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  351. List<Mat> regions_tmplm = new List<Mat> ((regions != null) ? regions.Count : 0);
  352. Mat regions_mat = Converters.vector_vector_Point_to_Mat (regions, regions_tmplm);
  353. Mat groups_rects_mat = groups_rects;
  354. text_Text_erGrouping_11 (image.nativeObj, channel.nativeObj, regions_mat.nativeObj, groups_rects_mat.nativeObj, method, filename);
  355. return;
  356. #else
  357. return;
  358. #endif
  359. }
  360. //javadoc: erGrouping(image, channel, regions, groups_rects, method)
  361. public static void erGrouping (Mat image, Mat channel, List<MatOfPoint> regions, MatOfRect groups_rects, int method)
  362. {
  363. if (image != null)
  364. image.ThrowIfDisposed ();
  365. if (channel != null)
  366. channel.ThrowIfDisposed ();
  367. if (groups_rects != null)
  368. groups_rects.ThrowIfDisposed ();
  369. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  370. List<Mat> regions_tmplm = new List<Mat> ((regions != null) ? regions.Count : 0);
  371. Mat regions_mat = Converters.vector_vector_Point_to_Mat (regions, regions_tmplm);
  372. Mat groups_rects_mat = groups_rects;
  373. text_Text_erGrouping_12 (image.nativeObj, channel.nativeObj, regions_mat.nativeObj, groups_rects_mat.nativeObj, method);
  374. return;
  375. #else
  376. return;
  377. #endif
  378. }
  379. //javadoc: erGrouping(image, channel, regions, groups_rects)
  380. public static void erGrouping (Mat image, Mat channel, List<MatOfPoint> regions, MatOfRect groups_rects)
  381. {
  382. if (image != null)
  383. image.ThrowIfDisposed ();
  384. if (channel != null)
  385. channel.ThrowIfDisposed ();
  386. if (groups_rects != null)
  387. groups_rects.ThrowIfDisposed ();
  388. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  389. List<Mat> regions_tmplm = new List<Mat> ((regions != null) ? regions.Count : 0);
  390. Mat regions_mat = Converters.vector_vector_Point_to_Mat (regions, regions_tmplm);
  391. Mat groups_rects_mat = groups_rects;
  392. text_Text_erGrouping_13 (image.nativeObj, channel.nativeObj, regions_mat.nativeObj, groups_rects_mat.nativeObj);
  393. return;
  394. #else
  395. return;
  396. #endif
  397. }
  398. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  399. const string LIBNAME = "__Internal";
  400. #else
  401. const string LIBNAME = "opencvforunity";
  402. #endif
  403. // C++: Mat cv::text::createOCRHMMTransitionsTable(String vocabulary, vector_String lexicon)
  404. [DllImport (LIBNAME)]
  405. private static extern IntPtr text_Text_createOCRHMMTransitionsTable_10 (string vocabulary, IntPtr lexicon_mat_nativeObj);
  406. // C++: Ptr_ERFilter cv::text::createERFilterNM1(String filename, int thresholdDelta = 1, float minArea = (float)0.00025, float maxArea = (float)0.13, float minProbability = (float)0.4, bool nonMaxSuppression = true, float minProbabilityDiff = (float)0.1)
  407. [DllImport (LIBNAME)]
  408. private static extern IntPtr text_Text_createERFilterNM1_10 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression, float minProbabilityDiff);
  409. [DllImport (LIBNAME)]
  410. private static extern IntPtr text_Text_createERFilterNM1_11 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression);
  411. [DllImport (LIBNAME)]
  412. private static extern IntPtr text_Text_createERFilterNM1_12 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability);
  413. [DllImport (LIBNAME)]
  414. private static extern IntPtr text_Text_createERFilterNM1_13 (string filename, int thresholdDelta, float minArea, float maxArea);
  415. [DllImport (LIBNAME)]
  416. private static extern IntPtr text_Text_createERFilterNM1_14 (string filename, int thresholdDelta, float minArea);
  417. [DllImport (LIBNAME)]
  418. private static extern IntPtr text_Text_createERFilterNM1_15 (string filename, int thresholdDelta);
  419. [DllImport (LIBNAME)]
  420. private static extern IntPtr text_Text_createERFilterNM1_16 (string filename);
  421. // C++: Ptr_ERFilter cv::text::createERFilterNM2(String filename, float minProbability = (float)0.3)
  422. [DllImport (LIBNAME)]
  423. private static extern IntPtr text_Text_createERFilterNM2_10 (string filename, float minProbability);
  424. [DllImport (LIBNAME)]
  425. private static extern IntPtr text_Text_createERFilterNM2_11 (string filename);
  426. // C++: void cv::text::computeNMChannels(Mat _src, vector_Mat& _channels, int _mode = ERFILTER_NM_RGBLGrad)
  427. [DllImport (LIBNAME)]
  428. private static extern void text_Text_computeNMChannels_10 (IntPtr _src_nativeObj, IntPtr _channels_mat_nativeObj, int _mode);
  429. [DllImport (LIBNAME)]
  430. private static extern void text_Text_computeNMChannels_11 (IntPtr _src_nativeObj, IntPtr _channels_mat_nativeObj);
  431. // C++: void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_Rect& groups_rects, int method = ERGROUPING_ORIENTATION_HORIZ, String filename = String(), float minProbability = (float)0.5)
  432. [DllImport (LIBNAME)]
  433. private static extern void text_Text_detectRegions_10 (IntPtr image_nativeObj, IntPtr er_filter1_nativeObj, IntPtr er_filter2_nativeObj, IntPtr groups_rects_mat_nativeObj, int method, string filename, float minProbability);
  434. [DllImport (LIBNAME)]
  435. private static extern void text_Text_detectRegions_11 (IntPtr image_nativeObj, IntPtr er_filter1_nativeObj, IntPtr er_filter2_nativeObj, IntPtr groups_rects_mat_nativeObj, int method, string filename);
  436. [DllImport (LIBNAME)]
  437. private static extern void text_Text_detectRegions_12 (IntPtr image_nativeObj, IntPtr er_filter1_nativeObj, IntPtr er_filter2_nativeObj, IntPtr groups_rects_mat_nativeObj, int method);
  438. [DllImport (LIBNAME)]
  439. private static extern void text_Text_detectRegions_13 (IntPtr image_nativeObj, IntPtr er_filter1_nativeObj, IntPtr er_filter2_nativeObj, IntPtr groups_rects_mat_nativeObj);
  440. // C++: void cv::text::detectRegions(Mat image, Ptr_ERFilter er_filter1, Ptr_ERFilter er_filter2, vector_vector_Point& regions)
  441. [DllImport (LIBNAME)]
  442. private static extern void text_Text_detectRegions_14 (IntPtr image_nativeObj, IntPtr er_filter1_nativeObj, IntPtr er_filter2_nativeObj, IntPtr regions_mat_nativeObj);
  443. // C++: void cv::text::erGrouping(Mat image, Mat channel, vector_vector_Point regions, vector_Rect& groups_rects, int method = ERGROUPING_ORIENTATION_HORIZ, String filename = String(), float minProbablity = (float)0.5)
  444. [DllImport (LIBNAME)]
  445. private static extern void text_Text_erGrouping_10 (IntPtr image_nativeObj, IntPtr channel_nativeObj, IntPtr regions_mat_nativeObj, IntPtr groups_rects_mat_nativeObj, int method, string filename, float minProbablity);
  446. [DllImport (LIBNAME)]
  447. private static extern void text_Text_erGrouping_11 (IntPtr image_nativeObj, IntPtr channel_nativeObj, IntPtr regions_mat_nativeObj, IntPtr groups_rects_mat_nativeObj, int method, string filename);
  448. [DllImport (LIBNAME)]
  449. private static extern void text_Text_erGrouping_12 (IntPtr image_nativeObj, IntPtr channel_nativeObj, IntPtr regions_mat_nativeObj, IntPtr groups_rects_mat_nativeObj, int method);
  450. [DllImport (LIBNAME)]
  451. private static extern void text_Text_erGrouping_13 (IntPtr image_nativeObj, IntPtr channel_nativeObj, IntPtr regions_mat_nativeObj, IntPtr groups_rects_mat_nativeObj);
  452. }
  453. }
  454. #endif