fuzzy_F1_math.hpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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) 2015, University of Ostrava, Institute for Research and Applications of Fuzzy Modeling,
  14. // Pavel Vlasanek, all rights reserved. Third party copyrights are property of their respective owners.
  15. //
  16. // Redistribution and use in source and binary forms, with or without modification,
  17. // are permitted provided that the following conditions are met:
  18. //
  19. // * Redistribution's of source code must retain the above copyright notice,
  20. // this list of conditions and the following disclaimer.
  21. //
  22. // * Redistribution's in binary form must reproduce the above copyright notice,
  23. // this list of conditions and the following disclaimer in the documentation
  24. // and/or other materials provided with the distribution.
  25. //
  26. // * The name of the copyright holders may not be used to endorse or promote products
  27. // derived from this software without specific prior written permission.
  28. //
  29. // This software is provided by the copyright holders and contributors "as is" and
  30. // any express or implied warranties, including, but not limited to, the implied
  31. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  32. // In no event shall the Intel Corporation or contributors be liable for any direct,
  33. // indirect, incidental, special, exemplary, or consequential damages
  34. // (including, but not limited to, procurement of substitute goods or services;
  35. // loss of use, data, or profits; or business interruption) however caused
  36. // and on any theory of liability, whether in contract, strict liability,
  37. // or tort (including negligence or otherwise) arising in any way out of
  38. // the use of this software, even if advised of the possibility of such damage.
  39. //
  40. //M*/
  41. #ifndef __OPENCV_FUZZY_F1_MATH_H__
  42. #define __OPENCV_FUZZY_F1_MATH_H__
  43. #include "opencv2/fuzzy/types.hpp"
  44. #include "opencv2/core.hpp"
  45. namespace cv
  46. {
  47. namespace ft
  48. {
  49. //! @addtogroup f1_math
  50. //! @{
  51. /** @brief Computes components of the array using direct \f$F^1\f$-transform.
  52. @param matrix Input array.
  53. @param kernel Kernel used for processing. Function `ft::createKernel` can be used.
  54. @param components Output 32-bit float array for the components.
  55. The function computes linear components using predefined kernel.
  56. */
  57. CV_EXPORTS_W void FT12D_components(InputArray matrix, InputArray kernel, OutputArray components);
  58. /** @brief Computes elements of \f$F^1\f$-transform components.
  59. @param matrix Input array.
  60. @param kernel Kernel used for processing. Function `ft::createKernel` can be used.
  61. @param c00 Elements represent average color.
  62. @param c10 Elements represent average vertical gradient.
  63. @param c01 Elements represent average horizontal gradient.
  64. @param components Output 32-bit float array for the components.
  65. @param mask Mask can be used for unwanted area marking.
  66. The function computes components and its elements using predefined kernel and mask.
  67. */
  68. CV_EXPORTS_W void FT12D_polynomial(InputArray matrix, InputArray kernel, OutputArray c00, OutputArray c10, OutputArray c01, OutputArray components, InputArray mask = noArray());
  69. /** @brief Creates vertical matrix for \f$F^1\f$-transform computation.
  70. @param radius Radius of the basic function.
  71. @param matrix The vertical matrix.
  72. @param chn Number of channels.
  73. The function creates helper vertical matrix for \f$F^1\f$-transfrom processing. It is used for gradient computation.
  74. */
  75. CV_EXPORTS_W void FT12D_createPolynomMatrixVertical(int radius, OutputArray matrix, const int chn);
  76. /** @brief Creates horizontal matrix for \f$F^1\f$-transform computation.
  77. @param radius Radius of the basic function.
  78. @param matrix The horizontal matrix.
  79. @param chn Number of channels.
  80. The function creates helper horizontal matrix for \f$F^1\f$-transfrom processing. It is used for gradient computation.
  81. */
  82. CV_EXPORTS_W void FT12D_createPolynomMatrixHorizontal(int radius, OutputArray matrix, const int chn);
  83. /** @brief Computes \f$F^1\f$-transfrom and inverse \f$F^1\f$-transfrom at once.
  84. @param matrix Input matrix.
  85. @param kernel Kernel used for processing. Function `ft::createKernel` can be used.
  86. @param output Output 32-bit float array.
  87. @param mask Mask used for unwanted area marking.
  88. This function computes \f$F^1\f$-transfrom and inverse \f$F^1\f$-transfotm in one step. It is fully sufficient and optimized for `cv::Mat`.
  89. @note
  90. F-transform technique of first degreee is described in paper @cite Vlas:FT.
  91. */
  92. CV_EXPORTS_W void FT12D_process(InputArray matrix, InputArray kernel, OutputArray output, InputArray mask = noArray());
  93. /** @brief Computes inverse \f$F^1\f$-transfrom.
  94. @param components Input 32-bit float single channel array for the components.
  95. @param kernel Kernel used for processing. The same kernel as for components computation must be used.
  96. @param output Output 32-bit float array.
  97. @param width Width of the output array.
  98. @param height Height of the output array.
  99. Computation of inverse \f$F^1\f$-transform.
  100. */
  101. CV_EXPORTS_W void FT12D_inverseFT(InputArray components, InputArray kernel, OutputArray output, int width, int height);
  102. //! @}
  103. }
  104. }
  105. #endif // __OPENCV_FUZZY_F1_MATH_H__