Face.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.FaceModule
  7. {
  8. // C++: class Face
  9. public class Face
  10. {
  11. //
  12. // C++: Ptr_Facemark cv::face::createFacemarkAAM()
  13. //
  14. public static Facemark createFacemarkAAM()
  15. {
  16. return Facemark.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(face_Face_createFacemarkAAM_10()));
  17. }
  18. //
  19. // C++: Ptr_Facemark cv::face::createFacemarkLBF()
  20. //
  21. public static Facemark createFacemarkLBF()
  22. {
  23. return Facemark.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(face_Face_createFacemarkLBF_10()));
  24. }
  25. //
  26. // C++: Ptr_Facemark cv::face::createFacemarkKazemi()
  27. //
  28. public static Facemark createFacemarkKazemi()
  29. {
  30. return Facemark.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(face_Face_createFacemarkKazemi_10()));
  31. }
  32. //
  33. // C++: bool cv::face::getFacesHAAR(Mat image, Mat& faces, String face_cascade_name)
  34. //
  35. /**
  36. * Default face detector
  37. * This function is mainly utilized by the implementation of a Facemark Algorithm.
  38. * End users are advised to use function Facemark::getFaces which can be manually defined
  39. * and circumvented to the algorithm by Facemark::setFaceDetector.
  40. *
  41. * param image The input image to be processed.
  42. * param faces Output of the function which represent region of interest of the detected faces.
  43. * Each face is stored in cv::Rect container.
  44. *
  45. * <B>Example of usage</B>
  46. * <code>
  47. * std::vector&lt;cv::Rect&gt; faces;
  48. * CParams params("haarcascade_frontalface_alt.xml");
  49. * cv::face::getFaces(frame, faces, &amp;params);
  50. * for(int j=0;j&lt;faces.size();j++){
  51. * cv::rectangle(frame, faces[j], cv::Scalar(255,0,255));
  52. * }
  53. * cv::imshow("detection", frame);
  54. * </code>
  55. * param face_cascade_name automatically generated
  56. * return automatically generated
  57. */
  58. public static bool getFacesHAAR(Mat image, Mat faces, string face_cascade_name)
  59. {
  60. if (image != null) image.ThrowIfDisposed();
  61. if (faces != null) faces.ThrowIfDisposed();
  62. return face_Face_getFacesHAAR_10(image.nativeObj, faces.nativeObj, face_cascade_name);
  63. }
  64. //
  65. // C++: bool cv::face::loadDatasetList(String imageList, String annotationList, vector_String images, vector_String annotations)
  66. //
  67. /**
  68. * A utility to load list of paths to training image and annotation file.
  69. * param imageList The specified file contains paths to the training images.
  70. * param annotationList The specified file contains paths to the training annotations.
  71. * param images The loaded paths of training images.
  72. * param annotations The loaded paths of annotation files.
  73. *
  74. * Example of usage:
  75. * <code>
  76. * String imageFiles = "images_path.txt";
  77. * String ptsFiles = "annotations_path.txt";
  78. * std::vector&lt;String&gt; images_train;
  79. * std::vector&lt;String&gt; landmarks_train;
  80. * loadDatasetList(imageFiles,ptsFiles,images_train,landmarks_train);
  81. * </code>
  82. * return automatically generated
  83. */
  84. public static bool loadDatasetList(string imageList, string annotationList, List<string> images, List<string> annotations)
  85. {
  86. Mat images_mat = Converters.vector_String_to_Mat(images);
  87. Mat annotations_mat = Converters.vector_String_to_Mat(annotations);
  88. return face_Face_loadDatasetList_10(imageList, annotationList, images_mat.nativeObj, annotations_mat.nativeObj);
  89. }
  90. //
  91. // C++: bool cv::face::loadTrainingData(String filename, vector_String images, Mat& facePoints, char delim = ' ', float offset = 0.0f)
  92. //
  93. /**
  94. * A utility to load facial landmark dataset from a single file.
  95. *
  96. * param filename The filename of a file that contains the dataset information.
  97. * Each line contains the filename of an image followed by
  98. * pairs of x and y values of facial landmarks points separated by a space.
  99. * Example
  100. * <code>
  101. * /home/user/ibug/image_003_1.jpg 336.820955 240.864510 334.238298 260.922709 335.266918 ...
  102. * /home/user/ibug/image_005_1.jpg 376.158428 230.845712 376.736984 254.924635 383.265403 ...
  103. * </code>
  104. * param images A vector where each element represent the filename of image in the dataset.
  105. * Images are not loaded by default to save the memory.
  106. * param facePoints The loaded landmark points for all training data.
  107. * param delim Delimiter between each element, the default value is a whitespace.
  108. * param offset An offset value to adjust the loaded points.
  109. *
  110. * &lt;B&gt;Example of usage&lt;/B&gt;
  111. * <code>
  112. * cv::String imageFiles = "../data/images_train.txt";
  113. * cv::String ptsFiles = "../data/points_train.txt";
  114. * std::vector&lt;String&gt; images;
  115. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; facePoints;
  116. * loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);
  117. * </code>
  118. * return automatically generated
  119. */
  120. public static bool loadTrainingData(string filename, List<string> images, Mat facePoints, char delim, float offset)
  121. {
  122. if (facePoints != null) facePoints.ThrowIfDisposed();
  123. Mat images_mat = Converters.vector_String_to_Mat(images);
  124. return face_Face_loadTrainingData_10(filename, images_mat.nativeObj, facePoints.nativeObj, delim, offset);
  125. }
  126. /**
  127. * A utility to load facial landmark dataset from a single file.
  128. *
  129. * param filename The filename of a file that contains the dataset information.
  130. * Each line contains the filename of an image followed by
  131. * pairs of x and y values of facial landmarks points separated by a space.
  132. * Example
  133. * <code>
  134. * /home/user/ibug/image_003_1.jpg 336.820955 240.864510 334.238298 260.922709 335.266918 ...
  135. * /home/user/ibug/image_005_1.jpg 376.158428 230.845712 376.736984 254.924635 383.265403 ...
  136. * </code>
  137. * param images A vector where each element represent the filename of image in the dataset.
  138. * Images are not loaded by default to save the memory.
  139. * param facePoints The loaded landmark points for all training data.
  140. * param delim Delimiter between each element, the default value is a whitespace.
  141. *
  142. * &lt;B&gt;Example of usage&lt;/B&gt;
  143. * <code>
  144. * cv::String imageFiles = "../data/images_train.txt";
  145. * cv::String ptsFiles = "../data/points_train.txt";
  146. * std::vector&lt;String&gt; images;
  147. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; facePoints;
  148. * loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);
  149. * </code>
  150. * return automatically generated
  151. */
  152. public static bool loadTrainingData(string filename, List<string> images, Mat facePoints, char delim)
  153. {
  154. if (facePoints != null) facePoints.ThrowIfDisposed();
  155. Mat images_mat = Converters.vector_String_to_Mat(images);
  156. return face_Face_loadTrainingData_11(filename, images_mat.nativeObj, facePoints.nativeObj, delim);
  157. }
  158. /**
  159. * A utility to load facial landmark dataset from a single file.
  160. *
  161. * param filename The filename of a file that contains the dataset information.
  162. * Each line contains the filename of an image followed by
  163. * pairs of x and y values of facial landmarks points separated by a space.
  164. * Example
  165. * <code>
  166. * /home/user/ibug/image_003_1.jpg 336.820955 240.864510 334.238298 260.922709 335.266918 ...
  167. * /home/user/ibug/image_005_1.jpg 376.158428 230.845712 376.736984 254.924635 383.265403 ...
  168. * </code>
  169. * param images A vector where each element represent the filename of image in the dataset.
  170. * Images are not loaded by default to save the memory.
  171. * param facePoints The loaded landmark points for all training data.
  172. *
  173. * &lt;B&gt;Example of usage&lt;/B&gt;
  174. * <code>
  175. * cv::String imageFiles = "../data/images_train.txt";
  176. * cv::String ptsFiles = "../data/points_train.txt";
  177. * std::vector&lt;String&gt; images;
  178. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; facePoints;
  179. * loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);
  180. * </code>
  181. * return automatically generated
  182. */
  183. public static bool loadTrainingData(string filename, List<string> images, Mat facePoints)
  184. {
  185. if (facePoints != null) facePoints.ThrowIfDisposed();
  186. Mat images_mat = Converters.vector_String_to_Mat(images);
  187. return face_Face_loadTrainingData_12(filename, images_mat.nativeObj, facePoints.nativeObj);
  188. }
  189. //
  190. // C++: bool cv::face::loadTrainingData(String imageList, String groundTruth, vector_String images, Mat& facePoints, float offset = 0.0f)
  191. //
  192. /**
  193. * A utility to load facial landmark information from the dataset.
  194. *
  195. * param imageList A file contains the list of image filenames in the training dataset.
  196. * param groundTruth A file contains the list of filenames
  197. * where the landmarks points information are stored.
  198. * The content in each file should follow the standard format (see face::loadFacePoints).
  199. * param images A vector where each element represent the filename of image in the dataset.
  200. * Images are not loaded by default to save the memory.
  201. * param facePoints The loaded landmark points for all training data.
  202. * param offset An offset value to adjust the loaded points.
  203. *
  204. * &lt;B&gt;Example of usage&lt;/B&gt;
  205. * <code>
  206. * cv::String imageFiles = "../data/images_train.txt";
  207. * cv::String ptsFiles = "../data/points_train.txt";
  208. * std::vector&lt;String&gt; images;
  209. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; facePoints;
  210. * loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);
  211. * </code>
  212. *
  213. * example of content in the images_train.txt
  214. * <code>
  215. * /home/user/ibug/image_003_1.jpg
  216. * /home/user/ibug/image_004_1.jpg
  217. * /home/user/ibug/image_005_1.jpg
  218. * /home/user/ibug/image_006.jpg
  219. * </code>
  220. *
  221. * example of content in the points_train.txt
  222. * <code>
  223. * /home/user/ibug/image_003_1.pts
  224. * /home/user/ibug/image_004_1.pts
  225. * /home/user/ibug/image_005_1.pts
  226. * /home/user/ibug/image_006.pts
  227. * </code>
  228. * return automatically generated
  229. */
  230. public static bool loadTrainingData(string imageList, string groundTruth, List<string> images, Mat facePoints, float offset)
  231. {
  232. if (facePoints != null) facePoints.ThrowIfDisposed();
  233. Mat images_mat = Converters.vector_String_to_Mat(images);
  234. return face_Face_loadTrainingData_13(imageList, groundTruth, images_mat.nativeObj, facePoints.nativeObj, offset);
  235. }
  236. /**
  237. * A utility to load facial landmark information from the dataset.
  238. *
  239. * param imageList A file contains the list of image filenames in the training dataset.
  240. * param groundTruth A file contains the list of filenames
  241. * where the landmarks points information are stored.
  242. * The content in each file should follow the standard format (see face::loadFacePoints).
  243. * param images A vector where each element represent the filename of image in the dataset.
  244. * Images are not loaded by default to save the memory.
  245. * param facePoints The loaded landmark points for all training data.
  246. *
  247. * &lt;B&gt;Example of usage&lt;/B&gt;
  248. * <code>
  249. * cv::String imageFiles = "../data/images_train.txt";
  250. * cv::String ptsFiles = "../data/points_train.txt";
  251. * std::vector&lt;String&gt; images;
  252. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; facePoints;
  253. * loadTrainingData(imageFiles, ptsFiles, images, facePoints, 0.0f);
  254. * </code>
  255. *
  256. * example of content in the images_train.txt
  257. * <code>
  258. * /home/user/ibug/image_003_1.jpg
  259. * /home/user/ibug/image_004_1.jpg
  260. * /home/user/ibug/image_005_1.jpg
  261. * /home/user/ibug/image_006.jpg
  262. * </code>
  263. *
  264. * example of content in the points_train.txt
  265. * <code>
  266. * /home/user/ibug/image_003_1.pts
  267. * /home/user/ibug/image_004_1.pts
  268. * /home/user/ibug/image_005_1.pts
  269. * /home/user/ibug/image_006.pts
  270. * </code>
  271. * return automatically generated
  272. */
  273. public static bool loadTrainingData(string imageList, string groundTruth, List<string> images, Mat facePoints)
  274. {
  275. if (facePoints != null) facePoints.ThrowIfDisposed();
  276. Mat images_mat = Converters.vector_String_to_Mat(images);
  277. return face_Face_loadTrainingData_14(imageList, groundTruth, images_mat.nativeObj, facePoints.nativeObj);
  278. }
  279. //
  280. // C++: bool cv::face::loadTrainingData(vector_String filename, vector_vector_Point2f trainlandmarks, vector_String trainimages)
  281. //
  282. /**
  283. * This function extracts the data for training from .txt files which contains the corresponding image name and landmarks.
  284. * The first file in each file should give the path of the image whose
  285. * landmarks are being described in the file. Then in the subsequent
  286. * lines there should be coordinates of the landmarks in the image
  287. * i.e each line should be of the form x,y
  288. * where x represents the x coordinate of the landmark and y represents
  289. * the y coordinate of the landmark.
  290. *
  291. * For reference you can see the files as provided in the
  292. * &lt;a href="http://www.ifp.illinois.edu/~vuongle2/helen/"&gt;HELEN dataset&lt;/a&gt;
  293. *
  294. * param filename A vector of type cv::String containing name of the .txt files.
  295. * param trainlandmarks A vector of type cv::Point2f that would store shape or landmarks of all images.
  296. * param trainimages A vector of type cv::String which stores the name of images whose landmarks are tracked
  297. * return A boolean value. It returns true when it reads the data successfully and false otherwise
  298. */
  299. public static bool loadTrainingData(List<string> filename, List<MatOfPoint2f> trainlandmarks, List<string> trainimages)
  300. {
  301. Mat filename_mat = Converters.vector_String_to_Mat(filename);
  302. List<Mat> trainlandmarks_tmplm = new List<Mat>((trainlandmarks != null) ? trainlandmarks.Count : 0);
  303. Mat trainlandmarks_mat = Converters.vector_vector_Point2f_to_Mat(trainlandmarks, trainlandmarks_tmplm);
  304. Mat trainimages_mat = Converters.vector_String_to_Mat(trainimages);
  305. return face_Face_loadTrainingData_15(filename_mat.nativeObj, trainlandmarks_mat.nativeObj, trainimages_mat.nativeObj);
  306. }
  307. //
  308. // C++: bool cv::face::loadFacePoints(String filename, Mat& points, float offset = 0.0f)
  309. //
  310. /**
  311. * A utility to load facial landmark information from a given file.
  312. *
  313. * param filename The filename of file contains the facial landmarks data.
  314. * param points The loaded facial landmark points.
  315. * param offset An offset value to adjust the loaded points.
  316. *
  317. * &lt;B&gt;Example of usage&lt;/B&gt;
  318. * <code>
  319. * std::vector&lt;Point2f&gt; points;
  320. * face::loadFacePoints("filename.txt", points, 0.0f);
  321. * </code>
  322. *
  323. * The annotation file should follow the default format which is
  324. * <code>
  325. * version: 1
  326. * n_points: 68
  327. * {
  328. * 212.716603 499.771793
  329. * 230.232816 566.290071
  330. * ...
  331. * }
  332. * </code>
  333. * where n_points is the number of points considered
  334. * and each point is represented as its position in x and y.
  335. * return automatically generated
  336. */
  337. public static bool loadFacePoints(string filename, Mat points, float offset)
  338. {
  339. if (points != null) points.ThrowIfDisposed();
  340. return face_Face_loadFacePoints_10(filename, points.nativeObj, offset);
  341. }
  342. /**
  343. * A utility to load facial landmark information from a given file.
  344. *
  345. * param filename The filename of file contains the facial landmarks data.
  346. * param points The loaded facial landmark points.
  347. *
  348. * &lt;B&gt;Example of usage&lt;/B&gt;
  349. * <code>
  350. * std::vector&lt;Point2f&gt; points;
  351. * face::loadFacePoints("filename.txt", points, 0.0f);
  352. * </code>
  353. *
  354. * The annotation file should follow the default format which is
  355. * <code>
  356. * version: 1
  357. * n_points: 68
  358. * {
  359. * 212.716603 499.771793
  360. * 230.232816 566.290071
  361. * ...
  362. * }
  363. * </code>
  364. * where n_points is the number of points considered
  365. * and each point is represented as its position in x and y.
  366. * return automatically generated
  367. */
  368. public static bool loadFacePoints(string filename, Mat points)
  369. {
  370. if (points != null) points.ThrowIfDisposed();
  371. return face_Face_loadFacePoints_11(filename, points.nativeObj);
  372. }
  373. //
  374. // C++: void cv::face::drawFacemarks(Mat& image, Mat points, Scalar color = Scalar(255,0,0))
  375. //
  376. /**
  377. * Utility to draw the detected facial landmark points
  378. *
  379. * param image The input image to be processed.
  380. * param points Contains the data of points which will be drawn.
  381. * param color The color of points in BGR format represented by cv::Scalar.
  382. *
  383. * &lt;B&gt;Example of usage&lt;/B&gt;
  384. * <code>
  385. * std::vector&lt;Rect&gt; faces;
  386. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; landmarks;
  387. * facemark-&gt;getFaces(img, faces);
  388. * facemark-&gt;fit(img, faces, landmarks);
  389. * for(int j=0;j&lt;rects.size();j++){
  390. * face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
  391. * }
  392. * </code>
  393. */
  394. public static void drawFacemarks(Mat image, Mat points, Scalar color)
  395. {
  396. if (image != null) image.ThrowIfDisposed();
  397. if (points != null) points.ThrowIfDisposed();
  398. face_Face_drawFacemarks_10(image.nativeObj, points.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);
  399. }
  400. /**
  401. * Utility to draw the detected facial landmark points
  402. *
  403. * param image The input image to be processed.
  404. * param points Contains the data of points which will be drawn.
  405. *
  406. * &lt;B&gt;Example of usage&lt;/B&gt;
  407. * <code>
  408. * std::vector&lt;Rect&gt; faces;
  409. * std::vector&lt;std::vector&lt;Point2f&gt; &gt; landmarks;
  410. * facemark-&gt;getFaces(img, faces);
  411. * facemark-&gt;fit(img, faces, landmarks);
  412. * for(int j=0;j&lt;rects.size();j++){
  413. * face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255));
  414. * }
  415. * </code>
  416. */
  417. public static void drawFacemarks(Mat image, Mat points)
  418. {
  419. if (image != null) image.ThrowIfDisposed();
  420. if (points != null) points.ThrowIfDisposed();
  421. face_Face_drawFacemarks_11(image.nativeObj, points.nativeObj);
  422. }
  423. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  424. const string LIBNAME = "__Internal";
  425. #else
  426. const string LIBNAME = "opencvforunity";
  427. #endif
  428. // C++: Ptr_Facemark cv::face::createFacemarkAAM()
  429. [DllImport(LIBNAME)]
  430. private static extern IntPtr face_Face_createFacemarkAAM_10();
  431. // C++: Ptr_Facemark cv::face::createFacemarkLBF()
  432. [DllImport(LIBNAME)]
  433. private static extern IntPtr face_Face_createFacemarkLBF_10();
  434. // C++: Ptr_Facemark cv::face::createFacemarkKazemi()
  435. [DllImport(LIBNAME)]
  436. private static extern IntPtr face_Face_createFacemarkKazemi_10();
  437. // C++: bool cv::face::getFacesHAAR(Mat image, Mat& faces, String face_cascade_name)
  438. [DllImport(LIBNAME)]
  439. [return: MarshalAs(UnmanagedType.U1)]
  440. private static extern bool face_Face_getFacesHAAR_10(IntPtr image_nativeObj, IntPtr faces_nativeObj, string face_cascade_name);
  441. // C++: bool cv::face::loadDatasetList(String imageList, String annotationList, vector_String images, vector_String annotations)
  442. [DllImport(LIBNAME)]
  443. [return: MarshalAs(UnmanagedType.U1)]
  444. private static extern bool face_Face_loadDatasetList_10(string imageList, string annotationList, IntPtr images_mat_nativeObj, IntPtr annotations_mat_nativeObj);
  445. // C++: bool cv::face::loadTrainingData(String filename, vector_String images, Mat& facePoints, char delim = ' ', float offset = 0.0f)
  446. [DllImport(LIBNAME)]
  447. [return: MarshalAs(UnmanagedType.U1)]
  448. private static extern bool face_Face_loadTrainingData_10(string filename, IntPtr images_mat_nativeObj, IntPtr facePoints_nativeObj, char delim, float offset);
  449. [DllImport(LIBNAME)]
  450. [return: MarshalAs(UnmanagedType.U1)]
  451. private static extern bool face_Face_loadTrainingData_11(string filename, IntPtr images_mat_nativeObj, IntPtr facePoints_nativeObj, char delim);
  452. [DllImport(LIBNAME)]
  453. [return: MarshalAs(UnmanagedType.U1)]
  454. private static extern bool face_Face_loadTrainingData_12(string filename, IntPtr images_mat_nativeObj, IntPtr facePoints_nativeObj);
  455. // C++: bool cv::face::loadTrainingData(String imageList, String groundTruth, vector_String images, Mat& facePoints, float offset = 0.0f)
  456. [DllImport(LIBNAME)]
  457. [return: MarshalAs(UnmanagedType.U1)]
  458. private static extern bool face_Face_loadTrainingData_13(string imageList, string groundTruth, IntPtr images_mat_nativeObj, IntPtr facePoints_nativeObj, float offset);
  459. [DllImport(LIBNAME)]
  460. [return: MarshalAs(UnmanagedType.U1)]
  461. private static extern bool face_Face_loadTrainingData_14(string imageList, string groundTruth, IntPtr images_mat_nativeObj, IntPtr facePoints_nativeObj);
  462. // C++: bool cv::face::loadTrainingData(vector_String filename, vector_vector_Point2f trainlandmarks, vector_String trainimages)
  463. [DllImport(LIBNAME)]
  464. [return: MarshalAs(UnmanagedType.U1)]
  465. private static extern bool face_Face_loadTrainingData_15(IntPtr filename_mat_nativeObj, IntPtr trainlandmarks_mat_nativeObj, IntPtr trainimages_mat_nativeObj);
  466. // C++: bool cv::face::loadFacePoints(String filename, Mat& points, float offset = 0.0f)
  467. [DllImport(LIBNAME)]
  468. [return: MarshalAs(UnmanagedType.U1)]
  469. private static extern bool face_Face_loadFacePoints_10(string filename, IntPtr points_nativeObj, float offset);
  470. [DllImport(LIBNAME)]
  471. [return: MarshalAs(UnmanagedType.U1)]
  472. private static extern bool face_Face_loadFacePoints_11(string filename, IntPtr points_nativeObj);
  473. // C++: void cv::face::drawFacemarks(Mat& image, Mat points, Scalar color = Scalar(255,0,0))
  474. [DllImport(LIBNAME)]
  475. private static extern void face_Face_drawFacemarks_10(IntPtr image_nativeObj, IntPtr points_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3);
  476. [DllImport(LIBNAME)]
  477. private static extern void face_Face_drawFacemarks_11(IntPtr image_nativeObj, IntPtr points_nativeObj);
  478. }
  479. }