test_facemark.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. By downloading, copying, installing or using the software you agree to this
  3. license. If you do not agree to this license, do not download, install,
  4. copy or use the software.
  5. License Agreement
  6. For Open Source Computer Vision Library
  7. (3-clause BSD License)
  8. Copyright (C) 2013, OpenCV Foundation, all rights reserved.
  9. Third party copyrights are property of their respective owners.
  10. Redistribution and use in source and binary forms, with or without modification,
  11. are permitted provided that the following conditions are met:
  12. * Redistributions of source code must retain the above copyright notice,
  13. this list of conditions and the following disclaimer.
  14. * Redistributions in binary form must reproduce the above copyright notice,
  15. this list of conditions and the following disclaimer in the documentation
  16. and/or other materials provided with the distribution.
  17. * Neither the names of the copyright holders nor the names of the contributors
  18. may be used to endorse or promote products derived from this software
  19. without specific prior written permission.
  20. This software is provided by the copyright holders and contributors "as is" and
  21. any express or implied warranties, including, but not limited to, the implied
  22. warranties of merchantability and fitness for a particular purpose are
  23. disclaimed. In no event shall copyright holders or contributors be liable for
  24. any direct, indirect, incidental, special, exemplary, or consequential damages
  25. (including, but not limited to, procurement of substitute goods or services;
  26. loss of use, data, or profits; or business interruption) however caused
  27. and on any theory of liability, whether in contract, strict liability,
  28. or tort (including negligence or otherwise) arising in any way out of
  29. the use of this software, even if advised of the possibility of such damage.
  30. This file was part of GSoC Project: Facemark API for OpenCV
  31. Final report: https://gist.github.com/kurnianggoro/74de9121e122ad0bd825176751d47ecc
  32. Student: Laksono Kurnianggoro
  33. Mentor: Delia Passalacqua
  34. */
  35. #include "test_precomp.hpp"
  36. namespace opencv_test { namespace {
  37. TEST(CV_Face_Facemark, test_utilities) {
  38. string image_file = cvtest::findDataFile("face/david1.jpg", true);
  39. string annotation_file = cvtest::findDataFile("face/david1.pts", true);
  40. string cascade_filename =
  41. cvtest::findDataFile("cascadeandhog/cascades/lbpcascade_frontalface.xml", true);
  42. std::vector<Point2f> facial_points;
  43. EXPECT_NO_THROW(loadFacePoints(annotation_file,facial_points));
  44. Mat img = imread(image_file);
  45. EXPECT_NO_THROW(drawFacemarks(img, facial_points, Scalar(0,0,255)));
  46. CParams params(cascade_filename);
  47. std::vector<Rect> faces;
  48. EXPECT_TRUE(getFaces(img, faces, &params));
  49. }
  50. }} // namespace