inpainting.hpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. // (3-clause BSD License)
  13. //
  14. // Copyright (C) 2000-2019, Intel Corporation, all rights reserved.
  15. // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
  16. // Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
  17. // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
  18. // Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved.
  19. // Copyright (C) 2015-2016, Itseez Inc., all rights reserved.
  20. // Third party copyrights are property of their respective owners.
  21. //
  22. // Redistribution and use in source and binary forms, with or without modification,
  23. // are permitted provided that the following conditions are met:
  24. //
  25. // * Redistribution's of source code must retain the above copyright notice,
  26. // this list of conditions and the following disclaimer.
  27. //
  28. // * Redistribution's in binary form must reproduce the above copyright notice,
  29. // this list of conditions and the following disclaimer in the documentation
  30. // and/or other materials provided with the distribution.
  31. //
  32. // * Neither the names of the copyright holders nor the names of the contributors
  33. // may be used to endorse or promote products derived from this software
  34. // without specific prior written permission.
  35. //
  36. // This software is provided by the copyright holders and contributors "as is" and
  37. // any express or implied warranties, including, but not limited to, the implied
  38. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  39. // In no event shall the Intel Corporation or contributors be liable for any direct,
  40. // indirect, incidental, special, exemplary, or consequential damages
  41. // (including, but not limited to, procurement of substitute goods or services;
  42. // loss of use, data, or profits; or business interruption) however caused
  43. // and on any theory of liability, whether in contract, strict liability,
  44. // or tort (including negligence or otherwise) arising in any way out of
  45. // the use of this software, even if advised of the possibility of such damage.
  46. //
  47. //M*/
  48. #ifndef __OPENCV_INPAINTING_HPP__
  49. #define __OPENCV_INPAINTING_HPP__
  50. /** @file
  51. @date Jul 22, 2014
  52. @author Yury Gitman
  53. */
  54. #include <opencv2/core.hpp>
  55. namespace cv
  56. {
  57. namespace xphoto
  58. {
  59. //! @addtogroup xphoto
  60. //! @{
  61. //! @brief Various inpainting algorithms
  62. //! @sa inpaint
  63. enum InpaintTypes
  64. {
  65. /** This algorithm searches for dominant correspondences (transformations) of
  66. image patches and tries to seamlessly fill-in the area to be inpainted using this
  67. transformations */
  68. INPAINT_SHIFTMAP = 0,
  69. /** Performs Frequency Selective Reconstruction (FSR).
  70. One of the two quality profiles BEST and FAST can be chosen, depending on the time available for reconstruction.
  71. See @cite GenserPCS2018 and @cite SeilerTIP2015 for details.
  72. The algorithm may be utilized for the following areas of application:
  73. 1. %Error Concealment (Inpainting).
  74. The sampling mask indicates the missing pixels of the distorted input
  75. image to be reconstructed.
  76. 2. Non-Regular Sampling.
  77. For more information on how to choose a good sampling mask, please review
  78. @cite GroscheICIP2018 and @cite GroscheIST2018.
  79. 1-channel grayscale or 3-channel BGR image are accepted.
  80. Conventional accepted ranges:
  81. - 0-255 for CV_8U
  82. - 0-65535 for CV_16U
  83. - 0-1 for CV_32F/CV_64F.
  84. */
  85. INPAINT_FSR_BEST = 1,
  86. INPAINT_FSR_FAST = 2 //!< See #INPAINT_FSR_BEST
  87. };
  88. /** @brief The function implements different single-image inpainting algorithms.
  89. See the original papers @cite He2012 (Shiftmap) or @cite GenserPCS2018 and @cite SeilerTIP2015 (FSR) for details.
  90. @param src source image
  91. - #INPAINT_SHIFTMAP: it could be of any type and any number of channels from 1 to 4. In case of
  92. 3- and 4-channels images the function expect them in CIELab colorspace or similar one, where first
  93. color component shows intensity, while second and third shows colors. Nonetheless you can try any
  94. colorspaces.
  95. - #INPAINT_FSR_BEST or #INPAINT_FSR_FAST: 1-channel grayscale or 3-channel BGR image.
  96. @param mask mask (#CV_8UC1), where non-zero pixels indicate valid image area, while zero pixels
  97. indicate area to be inpainted
  98. @param dst destination image
  99. @param algorithmType see xphoto::InpaintTypes
  100. */
  101. CV_EXPORTS_W void inpaint(const Mat &src, const Mat &mask, Mat &dst, const int algorithmType);
  102. //! @}
  103. }
  104. }
  105. #endif // __OPENCV_INPAINTING_HPP__