histogramphaseunwrapping.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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, OpenCV Foundation, all rights reserved.
  14. // 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_HISTOGRAM_PHASE_UNWRAPPING_HPP__
  42. #define __OPENCV_HISTOGRAM_PHASE_UNWRAPPING_HPP__
  43. #include "opencv2/core.hpp"
  44. #include <opencv2/imgproc.hpp>
  45. #include "opencv2/phase_unwrapping/phase_unwrapping.hpp"
  46. namespace cv {
  47. namespace phase_unwrapping {
  48. //! @addtogroup phase_unwrapping
  49. //! @{
  50. /** @brief Class implementing two-dimensional phase unwrapping based on @cite histogramUnwrapping
  51. * This algorithm belongs to the quality-guided phase unwrapping methods.
  52. * First, it computes a reliability map from second differences between a pixel and its eight neighbours.
  53. * Reliability values lie between 0 and 16*pi*pi. Then, this reliability map is used to compute
  54. * the reliabilities of "edges". An edge is an entity defined by two pixels that are connected
  55. * horizontally or vertically. Its reliability is found by adding the the reliabilities of the
  56. * two pixels connected through it. Edges are sorted in a histogram based on their reliability values.
  57. * This histogram is then used to unwrap pixels, starting from the highest quality pixel.
  58. * The wrapped phase map and the unwrapped result are stored in CV_32FC1 Mat.
  59. */
  60. class CV_EXPORTS_W HistogramPhaseUnwrapping : public PhaseUnwrapping
  61. {
  62. public:
  63. /**
  64. * @brief Parameters of phaseUnwrapping constructor.
  65. * @param width Phase map width.
  66. * @param height Phase map height.
  67. * @param histThresh Bins in the histogram are not of equal size. Default value is 3*pi*pi. The one before "histThresh" value are smaller.
  68. * @param nbrOfSmallBins Number of bins between 0 and "histThresh". Default value is 10.
  69. * @param nbrOfLargeBins Number of bins between "histThresh" and 32*pi*pi (highest edge reliability value). Default value is 5.
  70. */
  71. struct CV_EXPORTS Params
  72. {
  73. Params();
  74. int width;
  75. int height;
  76. float histThresh;
  77. int nbrOfSmallBins;
  78. int nbrOfLargeBins;
  79. };
  80. /**
  81. * @brief Constructor
  82. * @param parameters HistogramPhaseUnwrapping parameters HistogramPhaseUnwrapping::Params: width,height of the phase map and histogram characteristics.
  83. */
  84. static Ptr<HistogramPhaseUnwrapping> create( const HistogramPhaseUnwrapping::Params &parameters =
  85. HistogramPhaseUnwrapping::Params() );
  86. /**
  87. * @brief Get the reliability map computed from the wrapped phase map.
  88. * @param reliabilityMap Image where the reliability map is stored.
  89. */
  90. CV_WRAP
  91. virtual void getInverseReliabilityMap( OutputArray reliabilityMap ) = 0;
  92. };
  93. //! @}
  94. }
  95. }
  96. #endif