test_bif.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. */
  31. #include "test_precomp.hpp"
  32. namespace opencv_test { namespace {
  33. TEST(CV_Face_BIF, can_create_default) {
  34. cv::Ptr<cv::face::BIF> bif;
  35. EXPECT_NO_THROW(bif = cv::face::BIF::create());
  36. EXPECT_FALSE(bif.empty());
  37. }
  38. TEST(CV_Face_BIF, fails_when_zero_bands) {
  39. EXPECT_ANY_THROW(cv::face::BIF::create(0));
  40. }
  41. TEST(CV_Face_BIF, fails_when_too_many_bands) {
  42. EXPECT_ANY_THROW(cv::face::BIF::create(9));
  43. }
  44. TEST(CV_Face_BIF, fails_when_zero_rotations) {
  45. EXPECT_ANY_THROW(cv::face::BIF::create(8, 0));
  46. }
  47. TEST(CV_Face_BIF, can_compute) {
  48. cv::Mat image(60, 60, CV_32F);
  49. cv::theRNG().fill(image, cv::RNG::UNIFORM, -1, 1);
  50. cv::Ptr<cv::face::BIF> bif = cv::face::BIF::create();
  51. cv::Mat fea;
  52. EXPECT_NO_THROW(bif->compute(image, fea));
  53. EXPECT_EQ(cv::Size(1, 13188), fea.size());
  54. }
  55. }} // namespace