perf_descriptor.cpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*M///////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
  4. //
  5. // By downloading, copying, installing or using the software you agree to this license.
  6. // If you do not agree to this license, do not download, install,
  7. // copy or use the software.
  8. //
  9. //
  10. // License Agreement
  11. // For Open Source Computer Vision Library
  12. //
  13. // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
  14. // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
  15. // Third party copyrights are property of their respective owners.
  16. //
  17. // Redistribution and use in source and binary forms, with or without modification,
  18. // are permitted provided that the following conditions are met:
  19. //
  20. // * Redistribution's of source code must retain the above copyright notice,
  21. // this list of conditions and the following disclaimer.
  22. //
  23. // * Redistribution's in binary form must reproduce the above copyright notice,
  24. // this list of conditions and the following disclaimer in the documentation
  25. // and/or other materials provided with the distribution.
  26. //
  27. // * The name of the copyright holders may not be used to endorse or promote products
  28. // derived from this software without specific prior written permission.
  29. //
  30. // This software is provided by the copyright holders and contributors "as is" and
  31. // any express or implied warranties, including, but not limited to, the implied
  32. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  33. // In no event shall the Intel Corporation or contributors be liable for any direct,
  34. // indirect, incidental, special, exemplary, or consequential damages
  35. // (including, but not limited to, procurement of substitute goods or services;
  36. // loss of use, data, or profits; or business interruption) however caused
  37. // and on any theory of liability, whether in contract, strict liability,
  38. // or tort (including negligence or otherwise) arising in any way out of
  39. // the use of this software, even if advised of the possibility of such damage.
  40. //
  41. //M*/
  42. #include "perf_precomp.hpp"
  43. namespace opencv_test { namespace {
  44. typedef tuple<Size, MatType, MatDepth> descript_params_t;
  45. typedef perf::TestBaseWithParam<descript_params_t> descript_params;
  46. PERF_TEST_P( descript_params, census_sparse_descriptor,
  47. testing::Combine(
  48. testing::Values( TYPICAL_MAT_SIZES ),
  49. testing::Values( CV_8U ),
  50. testing::Values( CV_32SC4,CV_32S )
  51. )
  52. )
  53. {
  54. Size sz = get<0>(GetParam());
  55. int matType = get<1>(GetParam());
  56. int sdepth = get<2>(GetParam());
  57. Mat left(sz, matType);
  58. Mat out1(sz, sdepth);
  59. declare.in(left, WARMUP_RNG)
  60. .out(out1)
  61. .time(0.01);
  62. TEST_CYCLE()
  63. {
  64. censusTransform(left,9,out1,CV_SPARSE_CENSUS);
  65. }
  66. SANITY_CHECK_NOTHING();
  67. }
  68. PERF_TEST_P( descript_params, star_census_transform,
  69. testing::Combine(
  70. testing::Values( TYPICAL_MAT_SIZES ),
  71. testing::Values( CV_8U ),
  72. testing::Values( CV_32SC4,CV_32S )
  73. )
  74. )
  75. {
  76. Size sz = get<0>(GetParam());
  77. int matType = get<1>(GetParam());
  78. int sdepth = get<2>(GetParam());
  79. Mat left(sz, matType);
  80. Mat out1(sz, sdepth);
  81. declare.in(left, WARMUP_RNG)
  82. .out(out1)
  83. .time(0.01);
  84. TEST_CYCLE()
  85. {
  86. starCensusTransform(left,9,out1);
  87. }
  88. SANITY_CHECK_NOTHING();
  89. }
  90. PERF_TEST_P( descript_params, modified_census_transform,
  91. testing::Combine(
  92. testing::Values( TYPICAL_MAT_SIZES ),
  93. testing::Values( CV_8U ),
  94. testing::Values( CV_32SC4,CV_32S )
  95. )
  96. )
  97. {
  98. Size sz = get<0>(GetParam());
  99. int matType = get<1>(GetParam());
  100. int sdepth = get<2>(GetParam());
  101. Mat left(sz, matType);
  102. Mat out1(sz, sdepth);
  103. declare.in(left, WARMUP_RNG)
  104. .out(out1)
  105. .time(0.01);
  106. TEST_CYCLE()
  107. {
  108. modifiedCensusTransform(left,9,out1,CV_MODIFIED_CENSUS_TRANSFORM);
  109. }
  110. SANITY_CHECK_NOTHING();
  111. }
  112. PERF_TEST_P( descript_params, center_symetric_census,
  113. testing::Combine(
  114. testing::Values( TYPICAL_MAT_SIZES ),
  115. testing::Values( CV_8U ),
  116. testing::Values( CV_32SC4,CV_32S )
  117. )
  118. )
  119. {
  120. Size sz = get<0>(GetParam());
  121. int matType = get<1>(GetParam());
  122. int sdepth = get<2>(GetParam());
  123. Mat left(sz, matType);
  124. Mat out1(sz, sdepth);
  125. declare.in(left, WARMUP_RNG)
  126. .out(out1)
  127. .time(0.01);
  128. TEST_CYCLE()
  129. {
  130. symetricCensusTransform(left,7,out1,CV_CS_CENSUS);
  131. }
  132. SANITY_CHECK_NOTHING();
  133. }
  134. }} // namespace