gapi_fluid_test_kernels.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. //
  5. // Copyright (C) 2018 Intel Corporation
  6. #ifndef GAPI_FLUID_TEST_KERNELS_HPP
  7. #define GAPI_FLUID_TEST_KERNELS_HPP
  8. #include <opencv2/gapi/fluid/gfluidkernel.hpp>
  9. namespace cv
  10. {
  11. namespace gapi_test_kernels
  12. {
  13. using cv::gapi::core::GMat3;
  14. using GMat2 = std::tuple<GMat, GMat>;
  15. G_TYPED_KERNEL(TAddSimple, <GMat(GMat, GMat)>, "test.fluid.add_simple") {
  16. static cv::GMatDesc outMeta(cv::GMatDesc a, cv::GMatDesc) {
  17. return a;
  18. }
  19. };
  20. G_TYPED_KERNEL(TAddCSimple, <GMat(GMat,int)>, "test.fluid.addc_simple")
  21. {
  22. static GMatDesc outMeta(const cv::GMatDesc &in, int) {
  23. return in;
  24. }
  25. };
  26. G_TYPED_KERNEL(TAddScalar, <GMat(GMat,GScalar)>, "test.fluid.addc_scalar")
  27. {
  28. static GMatDesc outMeta(const cv::GMatDesc &in, const cv::GScalarDesc&) {
  29. return in;
  30. }
  31. };
  32. G_TYPED_KERNEL(TAddScalarToMat, <GMat(GScalar,GMat)>, "test.fluid.add_scalar_to_mat")
  33. {
  34. static GMatDesc outMeta(const cv::GScalarDesc&, const cv::GMatDesc &in) {
  35. return in;
  36. }
  37. };
  38. G_TYPED_KERNEL(TBlur1x1, <GMat(GMat,int,Scalar)>, "org.opencv.imgproc.filters.blur1x1"){
  39. static GMatDesc outMeta(GMatDesc in, int, Scalar) {
  40. return in;
  41. }
  42. };
  43. G_TYPED_KERNEL(TBlur3x3, <GMat(GMat,int,Scalar)>, "org.opencv.imgproc.filters.blur3x3"){
  44. static GMatDesc outMeta(GMatDesc in, int, Scalar) {
  45. return in;
  46. }
  47. };
  48. G_TYPED_KERNEL(TBlur5x5, <GMat(GMat,int,Scalar)>, "org.opencv.imgproc.filters.blur5x5"){
  49. static GMatDesc outMeta(GMatDesc in, int, Scalar) {
  50. return in;
  51. }
  52. };
  53. G_TYPED_KERNEL(TBlur3x3_2lpi, <GMat(GMat,int,Scalar)>, "org.opencv.imgproc.filters.blur3x3_2lpi"){
  54. static GMatDesc outMeta(GMatDesc in, int, Scalar) {
  55. return in;
  56. }
  57. };
  58. G_TYPED_KERNEL(TBlur5x5_2lpi, <GMat(GMat,int,Scalar)>, "org.opencv.imgproc.filters.blur5x5_2lpi"){
  59. static GMatDesc outMeta(GMatDesc in, int, Scalar) {
  60. return in;
  61. }
  62. };
  63. G_TYPED_KERNEL(TId, <GMat(GMat)>, "test.fluid.identity") {
  64. static cv::GMatDesc outMeta(cv::GMatDesc a) {
  65. return a;
  66. }
  67. };
  68. G_TYPED_KERNEL(TId7x7, <GMat(GMat)>, "test.fluid.identity7x7") {
  69. static cv::GMatDesc outMeta(cv::GMatDesc a) {
  70. return a;
  71. }
  72. };
  73. G_TYPED_KERNEL(TMerge3_4lpi, <GMat(GMat,GMat,GMat)>, "test.fluid.merge3_4lpi") {
  74. static GMatDesc outMeta(GMatDesc in, GMatDesc, GMatDesc) {
  75. return in.withType(in.depth, 3);
  76. }
  77. };
  78. G_TYPED_KERNEL(TPlusRow0, <GMat(GMat)>, "test.fluid.plus_row0") {
  79. static cv::GMatDesc outMeta(cv::GMatDesc a) {
  80. return a;
  81. }
  82. };
  83. G_TYPED_KERNEL(TSum2MatsAndScalar, <GMat(GMat,GScalar,GMat)>, "test.fluid.sum_2_mats_and_scalar")
  84. {
  85. static GMatDesc outMeta(const cv::GMatDesc &in, const cv::GScalarDesc&, const cv::GMatDesc&) {
  86. return in;
  87. }
  88. };
  89. G_TYPED_KERNEL_M(TSplit3_4lpi, <GMat3(GMat)>, "test.fluid.split3_4lpi") {
  90. static std::tuple<GMatDesc, GMatDesc, GMatDesc> outMeta(GMatDesc in) {
  91. const auto out_depth = in.depth;
  92. const auto out_desc = in.withType(out_depth, 1);
  93. return std::make_tuple(out_desc, out_desc, out_desc);
  94. }
  95. };
  96. G_TYPED_KERNEL(TEqualizeHist, <GMat(GMat, GArray<int>)>, "test.fluid.equalize_hist")
  97. {
  98. static GMatDesc outMeta(GMatDesc in, const cv::GArrayDesc&) {
  99. return in;
  100. }
  101. };
  102. G_TYPED_KERNEL(TCalcHist, <GArray<int>(GMat)>, "test.ocv.calc_hist")
  103. {
  104. static GArrayDesc outMeta(GMatDesc) {
  105. return {};
  106. }
  107. };
  108. GMat merge3_4lpi(const GMat& src1, const GMat& src2, const GMat& src3);
  109. std::tuple<GMat, GMat, GMat> split3_4lpi(const GMat& src);
  110. extern cv::GKernelPackage fluidTestPackage;
  111. } // namespace gapi_test_kernels
  112. } // namespace cv
  113. #endif // GAPI_FLUID_TEST_KERNELS_HPP