Joe Verbout
/
main
opencv on mbed
opencv2/photo.hpp@0:ea44dc9ed014, 2016-03-31 (annotated)
- Committer:
- joeverbout
- Date:
- Thu Mar 31 21:16:38 2016 +0000
- Revision:
- 0:ea44dc9ed014
OpenCV on mbed attempt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joeverbout | 0:ea44dc9ed014 | 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// |
joeverbout | 0:ea44dc9ed014 | 2 | // |
joeverbout | 0:ea44dc9ed014 | 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. |
joeverbout | 0:ea44dc9ed014 | 4 | // |
joeverbout | 0:ea44dc9ed014 | 5 | // By downloading, copying, installing or using the software you agree to this license. |
joeverbout | 0:ea44dc9ed014 | 6 | // If you do not agree to this license, do not download, install, |
joeverbout | 0:ea44dc9ed014 | 7 | // copy or use the software. |
joeverbout | 0:ea44dc9ed014 | 8 | // |
joeverbout | 0:ea44dc9ed014 | 9 | // |
joeverbout | 0:ea44dc9ed014 | 10 | // License Agreement |
joeverbout | 0:ea44dc9ed014 | 11 | // For Open Source Computer Vision Library |
joeverbout | 0:ea44dc9ed014 | 12 | // |
joeverbout | 0:ea44dc9ed014 | 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 14 | // Copyright (C) 2008-2012, Willow Garage Inc., all rights reserved. |
joeverbout | 0:ea44dc9ed014 | 15 | // Third party copyrights are property of their respective owners. |
joeverbout | 0:ea44dc9ed014 | 16 | // |
joeverbout | 0:ea44dc9ed014 | 17 | // Redistribution and use in source and binary forms, with or without modification, |
joeverbout | 0:ea44dc9ed014 | 18 | // are permitted provided that the following conditions are met: |
joeverbout | 0:ea44dc9ed014 | 19 | // |
joeverbout | 0:ea44dc9ed014 | 20 | // * Redistribution's of source code must retain the above copyright notice, |
joeverbout | 0:ea44dc9ed014 | 21 | // this list of conditions and the following disclaimer. |
joeverbout | 0:ea44dc9ed014 | 22 | // |
joeverbout | 0:ea44dc9ed014 | 23 | // * Redistribution's in binary form must reproduce the above copyright notice, |
joeverbout | 0:ea44dc9ed014 | 24 | // this list of conditions and the following disclaimer in the documentation |
joeverbout | 0:ea44dc9ed014 | 25 | // and/or other materials provided with the distribution. |
joeverbout | 0:ea44dc9ed014 | 26 | // |
joeverbout | 0:ea44dc9ed014 | 27 | // * The name of the copyright holders may not be used to endorse or promote products |
joeverbout | 0:ea44dc9ed014 | 28 | // derived from this software without specific prior written permission. |
joeverbout | 0:ea44dc9ed014 | 29 | // |
joeverbout | 0:ea44dc9ed014 | 30 | // This software is provided by the copyright holders and contributors "as is" and |
joeverbout | 0:ea44dc9ed014 | 31 | // any express or implied warranties, including, but not limited to, the implied |
joeverbout | 0:ea44dc9ed014 | 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. |
joeverbout | 0:ea44dc9ed014 | 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, |
joeverbout | 0:ea44dc9ed014 | 34 | // indirect, incidental, special, exemplary, or consequential damages |
joeverbout | 0:ea44dc9ed014 | 35 | // (including, but not limited to, procurement of substitute goods or services; |
joeverbout | 0:ea44dc9ed014 | 36 | // loss of use, data, or profits; or business interruption) however caused |
joeverbout | 0:ea44dc9ed014 | 37 | // and on any theory of liability, whether in contract, strict liability, |
joeverbout | 0:ea44dc9ed014 | 38 | // or tort (including negligence or otherwise) arising in any way out of |
joeverbout | 0:ea44dc9ed014 | 39 | // the use of this software, even if advised of the possibility of such damage. |
joeverbout | 0:ea44dc9ed014 | 40 | // |
joeverbout | 0:ea44dc9ed014 | 41 | //M*/ |
joeverbout | 0:ea44dc9ed014 | 42 | |
joeverbout | 0:ea44dc9ed014 | 43 | #ifndef __OPENCV_PHOTO_HPP__ |
joeverbout | 0:ea44dc9ed014 | 44 | #define __OPENCV_PHOTO_HPP__ |
joeverbout | 0:ea44dc9ed014 | 45 | |
joeverbout | 0:ea44dc9ed014 | 46 | #include "opencv2/core.hpp" |
joeverbout | 0:ea44dc9ed014 | 47 | #include "opencv2/imgproc.hpp" |
joeverbout | 0:ea44dc9ed014 | 48 | |
joeverbout | 0:ea44dc9ed014 | 49 | /** |
joeverbout | 0:ea44dc9ed014 | 50 | @defgroup photo Computational Photography |
joeverbout | 0:ea44dc9ed014 | 51 | @{ |
joeverbout | 0:ea44dc9ed014 | 52 | @defgroup photo_denoise Denoising |
joeverbout | 0:ea44dc9ed014 | 53 | @defgroup photo_hdr HDR imaging |
joeverbout | 0:ea44dc9ed014 | 54 | |
joeverbout | 0:ea44dc9ed014 | 55 | This section describes high dynamic range imaging algorithms namely tonemapping, exposure alignment, |
joeverbout | 0:ea44dc9ed014 | 56 | camera calibration with multiple exposures and exposure fusion. |
joeverbout | 0:ea44dc9ed014 | 57 | |
joeverbout | 0:ea44dc9ed014 | 58 | @defgroup photo_clone Seamless Cloning |
joeverbout | 0:ea44dc9ed014 | 59 | @defgroup photo_render Non-Photorealistic Rendering |
joeverbout | 0:ea44dc9ed014 | 60 | @defgroup photo_c C API |
joeverbout | 0:ea44dc9ed014 | 61 | @} |
joeverbout | 0:ea44dc9ed014 | 62 | */ |
joeverbout | 0:ea44dc9ed014 | 63 | |
joeverbout | 0:ea44dc9ed014 | 64 | namespace cv |
joeverbout | 0:ea44dc9ed014 | 65 | { |
joeverbout | 0:ea44dc9ed014 | 66 | |
joeverbout | 0:ea44dc9ed014 | 67 | //! @addtogroup photo |
joeverbout | 0:ea44dc9ed014 | 68 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 69 | |
joeverbout | 0:ea44dc9ed014 | 70 | //! the inpainting algorithm |
joeverbout | 0:ea44dc9ed014 | 71 | enum |
joeverbout | 0:ea44dc9ed014 | 72 | { |
joeverbout | 0:ea44dc9ed014 | 73 | INPAINT_NS = 0, // Navier-Stokes algorithm |
joeverbout | 0:ea44dc9ed014 | 74 | INPAINT_TELEA = 1 // A. Telea algorithm |
joeverbout | 0:ea44dc9ed014 | 75 | }; |
joeverbout | 0:ea44dc9ed014 | 76 | |
joeverbout | 0:ea44dc9ed014 | 77 | enum |
joeverbout | 0:ea44dc9ed014 | 78 | { |
joeverbout | 0:ea44dc9ed014 | 79 | NORMAL_CLONE = 1, |
joeverbout | 0:ea44dc9ed014 | 80 | MIXED_CLONE = 2, |
joeverbout | 0:ea44dc9ed014 | 81 | MONOCHROME_TRANSFER = 3 |
joeverbout | 0:ea44dc9ed014 | 82 | }; |
joeverbout | 0:ea44dc9ed014 | 83 | |
joeverbout | 0:ea44dc9ed014 | 84 | enum |
joeverbout | 0:ea44dc9ed014 | 85 | { |
joeverbout | 0:ea44dc9ed014 | 86 | RECURS_FILTER = 1, |
joeverbout | 0:ea44dc9ed014 | 87 | NORMCONV_FILTER = 2 |
joeverbout | 0:ea44dc9ed014 | 88 | }; |
joeverbout | 0:ea44dc9ed014 | 89 | |
joeverbout | 0:ea44dc9ed014 | 90 | /** @brief Restores the selected region in an image using the region neighborhood. |
joeverbout | 0:ea44dc9ed014 | 91 | |
joeverbout | 0:ea44dc9ed014 | 92 | @param src Input 8-bit 1-channel or 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 93 | @param inpaintMask Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that |
joeverbout | 0:ea44dc9ed014 | 94 | needs to be inpainted. |
joeverbout | 0:ea44dc9ed014 | 95 | @param dst Output image with the same size and type as src . |
joeverbout | 0:ea44dc9ed014 | 96 | @param inpaintRadius Radius of a circular neighborhood of each point inpainted that is considered |
joeverbout | 0:ea44dc9ed014 | 97 | by the algorithm. |
joeverbout | 0:ea44dc9ed014 | 98 | @param flags Inpainting method that could be one of the following: |
joeverbout | 0:ea44dc9ed014 | 99 | - **INPAINT_NS** Navier-Stokes based method [Navier01] |
joeverbout | 0:ea44dc9ed014 | 100 | - **INPAINT_TELEA** Method by Alexandru Telea @cite Telea04 . |
joeverbout | 0:ea44dc9ed014 | 101 | |
joeverbout | 0:ea44dc9ed014 | 102 | The function reconstructs the selected image area from the pixel near the area boundary. The |
joeverbout | 0:ea44dc9ed014 | 103 | function may be used to remove dust and scratches from a scanned photo, or to remove undesirable |
joeverbout | 0:ea44dc9ed014 | 104 | objects from still images or video. See <http://en.wikipedia.org/wiki/Inpainting> for more details. |
joeverbout | 0:ea44dc9ed014 | 105 | |
joeverbout | 0:ea44dc9ed014 | 106 | @note |
joeverbout | 0:ea44dc9ed014 | 107 | - An example using the inpainting technique can be found at |
joeverbout | 0:ea44dc9ed014 | 108 | opencv_source_code/samples/cpp/inpaint.cpp |
joeverbout | 0:ea44dc9ed014 | 109 | - (Python) An example using the inpainting technique can be found at |
joeverbout | 0:ea44dc9ed014 | 110 | opencv_source_code/samples/python/inpaint.py |
joeverbout | 0:ea44dc9ed014 | 111 | */ |
joeverbout | 0:ea44dc9ed014 | 112 | CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask, |
joeverbout | 0:ea44dc9ed014 | 113 | OutputArray dst, double inpaintRadius, int flags ); |
joeverbout | 0:ea44dc9ed014 | 114 | |
joeverbout | 0:ea44dc9ed014 | 115 | //! @addtogroup photo_denoise |
joeverbout | 0:ea44dc9ed014 | 116 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 117 | |
joeverbout | 0:ea44dc9ed014 | 118 | /** @brief Perform image denoising using Non-local Means Denoising algorithm |
joeverbout | 0:ea44dc9ed014 | 119 | <http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational |
joeverbout | 0:ea44dc9ed014 | 120 | optimizations. Noise expected to be a gaussian white noise |
joeverbout | 0:ea44dc9ed014 | 121 | |
joeverbout | 0:ea44dc9ed014 | 122 | @param src Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image. |
joeverbout | 0:ea44dc9ed014 | 123 | @param dst Output image with the same size and type as src . |
joeverbout | 0:ea44dc9ed014 | 124 | @param templateWindowSize Size in pixels of the template patch that is used to compute weights. |
joeverbout | 0:ea44dc9ed014 | 125 | Should be odd. Recommended value 7 pixels |
joeverbout | 0:ea44dc9ed014 | 126 | @param searchWindowSize Size in pixels of the window that is used to compute weighted average for |
joeverbout | 0:ea44dc9ed014 | 127 | given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater |
joeverbout | 0:ea44dc9ed014 | 128 | denoising time. Recommended value 21 pixels |
joeverbout | 0:ea44dc9ed014 | 129 | @param h Parameter regulating filter strength. Big h value perfectly removes noise but also |
joeverbout | 0:ea44dc9ed014 | 130 | removes image details, smaller h value preserves details but also preserves some noise |
joeverbout | 0:ea44dc9ed014 | 131 | |
joeverbout | 0:ea44dc9ed014 | 132 | This function expected to be applied to grayscale images. For colored images look at |
joeverbout | 0:ea44dc9ed014 | 133 | fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored |
joeverbout | 0:ea44dc9ed014 | 134 | image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting |
joeverbout | 0:ea44dc9ed014 | 135 | image to CIELAB colorspace and then separately denoise L and AB components with different h |
joeverbout | 0:ea44dc9ed014 | 136 | parameter. |
joeverbout | 0:ea44dc9ed014 | 137 | */ |
joeverbout | 0:ea44dc9ed014 | 138 | CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3, |
joeverbout | 0:ea44dc9ed014 | 139 | int templateWindowSize = 7, int searchWindowSize = 21); |
joeverbout | 0:ea44dc9ed014 | 140 | |
joeverbout | 0:ea44dc9ed014 | 141 | /** @brief Perform image denoising using Non-local Means Denoising algorithm |
joeverbout | 0:ea44dc9ed014 | 142 | <http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational |
joeverbout | 0:ea44dc9ed014 | 143 | optimizations. Noise expected to be a gaussian white noise |
joeverbout | 0:ea44dc9ed014 | 144 | |
joeverbout | 0:ea44dc9ed014 | 145 | @param src Input 8-bit or 16-bit (only with NORM_L1) 1-channel, |
joeverbout | 0:ea44dc9ed014 | 146 | 2-channel, 3-channel or 4-channel image. |
joeverbout | 0:ea44dc9ed014 | 147 | @param dst Output image with the same size and type as src . |
joeverbout | 0:ea44dc9ed014 | 148 | @param templateWindowSize Size in pixels of the template patch that is used to compute weights. |
joeverbout | 0:ea44dc9ed014 | 149 | Should be odd. Recommended value 7 pixels |
joeverbout | 0:ea44dc9ed014 | 150 | @param searchWindowSize Size in pixels of the window that is used to compute weighted average for |
joeverbout | 0:ea44dc9ed014 | 151 | given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater |
joeverbout | 0:ea44dc9ed014 | 152 | denoising time. Recommended value 21 pixels |
joeverbout | 0:ea44dc9ed014 | 153 | @param h Array of parameters regulating filter strength, either one |
joeverbout | 0:ea44dc9ed014 | 154 | parameter applied to all channels or one per channel in dst. Big h value |
joeverbout | 0:ea44dc9ed014 | 155 | perfectly removes noise but also removes image details, smaller h |
joeverbout | 0:ea44dc9ed014 | 156 | value preserves details but also preserves some noise |
joeverbout | 0:ea44dc9ed014 | 157 | @param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1 |
joeverbout | 0:ea44dc9ed014 | 158 | |
joeverbout | 0:ea44dc9ed014 | 159 | This function expected to be applied to grayscale images. For colored images look at |
joeverbout | 0:ea44dc9ed014 | 160 | fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored |
joeverbout | 0:ea44dc9ed014 | 161 | image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting |
joeverbout | 0:ea44dc9ed014 | 162 | image to CIELAB colorspace and then separately denoise L and AB components with different h |
joeverbout | 0:ea44dc9ed014 | 163 | parameter. |
joeverbout | 0:ea44dc9ed014 | 164 | */ |
joeverbout | 0:ea44dc9ed014 | 165 | CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 166 | const std::vector<float>& h, |
joeverbout | 0:ea44dc9ed014 | 167 | int templateWindowSize = 7, int searchWindowSize = 21, |
joeverbout | 0:ea44dc9ed014 | 168 | int normType = NORM_L2); |
joeverbout | 0:ea44dc9ed014 | 169 | |
joeverbout | 0:ea44dc9ed014 | 170 | /** @brief Modification of fastNlMeansDenoising function for colored images |
joeverbout | 0:ea44dc9ed014 | 171 | |
joeverbout | 0:ea44dc9ed014 | 172 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 173 | @param dst Output image with the same size and type as src . |
joeverbout | 0:ea44dc9ed014 | 174 | @param templateWindowSize Size in pixels of the template patch that is used to compute weights. |
joeverbout | 0:ea44dc9ed014 | 175 | Should be odd. Recommended value 7 pixels |
joeverbout | 0:ea44dc9ed014 | 176 | @param searchWindowSize Size in pixels of the window that is used to compute weighted average for |
joeverbout | 0:ea44dc9ed014 | 177 | given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater |
joeverbout | 0:ea44dc9ed014 | 178 | denoising time. Recommended value 21 pixels |
joeverbout | 0:ea44dc9ed014 | 179 | @param h Parameter regulating filter strength for luminance component. Bigger h value perfectly |
joeverbout | 0:ea44dc9ed014 | 180 | removes noise but also removes image details, smaller h value preserves details but also preserves |
joeverbout | 0:ea44dc9ed014 | 181 | some noise |
joeverbout | 0:ea44dc9ed014 | 182 | @param hColor The same as h but for color components. For most images value equals 10 |
joeverbout | 0:ea44dc9ed014 | 183 | will be enough to remove colored noise and do not distort colors |
joeverbout | 0:ea44dc9ed014 | 184 | |
joeverbout | 0:ea44dc9ed014 | 185 | The function converts image to CIELAB colorspace and then separately denoise L and AB components |
joeverbout | 0:ea44dc9ed014 | 186 | with given h parameters using fastNlMeansDenoising function. |
joeverbout | 0:ea44dc9ed014 | 187 | */ |
joeverbout | 0:ea44dc9ed014 | 188 | CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 189 | float h = 3, float hColor = 3, |
joeverbout | 0:ea44dc9ed014 | 190 | int templateWindowSize = 7, int searchWindowSize = 21); |
joeverbout | 0:ea44dc9ed014 | 191 | |
joeverbout | 0:ea44dc9ed014 | 192 | /** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been |
joeverbout | 0:ea44dc9ed014 | 193 | captured in small period of time. For example video. This version of the function is for grayscale |
joeverbout | 0:ea44dc9ed014 | 194 | images or for manual manipulation with colorspaces. For more details see |
joeverbout | 0:ea44dc9ed014 | 195 | <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394> |
joeverbout | 0:ea44dc9ed014 | 196 | |
joeverbout | 0:ea44dc9ed014 | 197 | @param srcImgs Input 8-bit 1-channel, 2-channel, 3-channel or |
joeverbout | 0:ea44dc9ed014 | 198 | 4-channel images sequence. All images should have the same type and |
joeverbout | 0:ea44dc9ed014 | 199 | size. |
joeverbout | 0:ea44dc9ed014 | 200 | @param imgToDenoiseIndex Target image to denoise index in srcImgs sequence |
joeverbout | 0:ea44dc9ed014 | 201 | @param temporalWindowSize Number of surrounding images to use for target image denoising. Should |
joeverbout | 0:ea44dc9ed014 | 202 | be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to |
joeverbout | 0:ea44dc9ed014 | 203 | imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise |
joeverbout | 0:ea44dc9ed014 | 204 | srcImgs[imgToDenoiseIndex] image. |
joeverbout | 0:ea44dc9ed014 | 205 | @param dst Output image with the same size and type as srcImgs images. |
joeverbout | 0:ea44dc9ed014 | 206 | @param templateWindowSize Size in pixels of the template patch that is used to compute weights. |
joeverbout | 0:ea44dc9ed014 | 207 | Should be odd. Recommended value 7 pixels |
joeverbout | 0:ea44dc9ed014 | 208 | @param searchWindowSize Size in pixels of the window that is used to compute weighted average for |
joeverbout | 0:ea44dc9ed014 | 209 | given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater |
joeverbout | 0:ea44dc9ed014 | 210 | denoising time. Recommended value 21 pixels |
joeverbout | 0:ea44dc9ed014 | 211 | @param h Parameter regulating filter strength. Bigger h value |
joeverbout | 0:ea44dc9ed014 | 212 | perfectly removes noise but also removes image details, smaller h |
joeverbout | 0:ea44dc9ed014 | 213 | value preserves details but also preserves some noise |
joeverbout | 0:ea44dc9ed014 | 214 | */ |
joeverbout | 0:ea44dc9ed014 | 215 | CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 216 | int imgToDenoiseIndex, int temporalWindowSize, |
joeverbout | 0:ea44dc9ed014 | 217 | float h = 3, int templateWindowSize = 7, int searchWindowSize = 21); |
joeverbout | 0:ea44dc9ed014 | 218 | |
joeverbout | 0:ea44dc9ed014 | 219 | /** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been |
joeverbout | 0:ea44dc9ed014 | 220 | captured in small period of time. For example video. This version of the function is for grayscale |
joeverbout | 0:ea44dc9ed014 | 221 | images or for manual manipulation with colorspaces. For more details see |
joeverbout | 0:ea44dc9ed014 | 222 | <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394> |
joeverbout | 0:ea44dc9ed014 | 223 | |
joeverbout | 0:ea44dc9ed014 | 224 | @param srcImgs Input 8-bit or 16-bit (only with NORM_L1) 1-channel, |
joeverbout | 0:ea44dc9ed014 | 225 | 2-channel, 3-channel or 4-channel images sequence. All images should |
joeverbout | 0:ea44dc9ed014 | 226 | have the same type and size. |
joeverbout | 0:ea44dc9ed014 | 227 | @param imgToDenoiseIndex Target image to denoise index in srcImgs sequence |
joeverbout | 0:ea44dc9ed014 | 228 | @param temporalWindowSize Number of surrounding images to use for target image denoising. Should |
joeverbout | 0:ea44dc9ed014 | 229 | be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to |
joeverbout | 0:ea44dc9ed014 | 230 | imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise |
joeverbout | 0:ea44dc9ed014 | 231 | srcImgs[imgToDenoiseIndex] image. |
joeverbout | 0:ea44dc9ed014 | 232 | @param dst Output image with the same size and type as srcImgs images. |
joeverbout | 0:ea44dc9ed014 | 233 | @param templateWindowSize Size in pixels of the template patch that is used to compute weights. |
joeverbout | 0:ea44dc9ed014 | 234 | Should be odd. Recommended value 7 pixels |
joeverbout | 0:ea44dc9ed014 | 235 | @param searchWindowSize Size in pixels of the window that is used to compute weighted average for |
joeverbout | 0:ea44dc9ed014 | 236 | given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater |
joeverbout | 0:ea44dc9ed014 | 237 | denoising time. Recommended value 21 pixels |
joeverbout | 0:ea44dc9ed014 | 238 | @param h Array of parameters regulating filter strength, either one |
joeverbout | 0:ea44dc9ed014 | 239 | parameter applied to all channels or one per channel in dst. Big h value |
joeverbout | 0:ea44dc9ed014 | 240 | perfectly removes noise but also removes image details, smaller h |
joeverbout | 0:ea44dc9ed014 | 241 | value preserves details but also preserves some noise |
joeverbout | 0:ea44dc9ed014 | 242 | @param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1 |
joeverbout | 0:ea44dc9ed014 | 243 | */ |
joeverbout | 0:ea44dc9ed014 | 244 | CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 245 | int imgToDenoiseIndex, int temporalWindowSize, |
joeverbout | 0:ea44dc9ed014 | 246 | const std::vector<float>& h, |
joeverbout | 0:ea44dc9ed014 | 247 | int templateWindowSize = 7, int searchWindowSize = 21, |
joeverbout | 0:ea44dc9ed014 | 248 | int normType = NORM_L2); |
joeverbout | 0:ea44dc9ed014 | 249 | |
joeverbout | 0:ea44dc9ed014 | 250 | /** @brief Modification of fastNlMeansDenoisingMulti function for colored images sequences |
joeverbout | 0:ea44dc9ed014 | 251 | |
joeverbout | 0:ea44dc9ed014 | 252 | @param srcImgs Input 8-bit 3-channel images sequence. All images should have the same type and |
joeverbout | 0:ea44dc9ed014 | 253 | size. |
joeverbout | 0:ea44dc9ed014 | 254 | @param imgToDenoiseIndex Target image to denoise index in srcImgs sequence |
joeverbout | 0:ea44dc9ed014 | 255 | @param temporalWindowSize Number of surrounding images to use for target image denoising. Should |
joeverbout | 0:ea44dc9ed014 | 256 | be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to |
joeverbout | 0:ea44dc9ed014 | 257 | imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise |
joeverbout | 0:ea44dc9ed014 | 258 | srcImgs[imgToDenoiseIndex] image. |
joeverbout | 0:ea44dc9ed014 | 259 | @param dst Output image with the same size and type as srcImgs images. |
joeverbout | 0:ea44dc9ed014 | 260 | @param templateWindowSize Size in pixels of the template patch that is used to compute weights. |
joeverbout | 0:ea44dc9ed014 | 261 | Should be odd. Recommended value 7 pixels |
joeverbout | 0:ea44dc9ed014 | 262 | @param searchWindowSize Size in pixels of the window that is used to compute weighted average for |
joeverbout | 0:ea44dc9ed014 | 263 | given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater |
joeverbout | 0:ea44dc9ed014 | 264 | denoising time. Recommended value 21 pixels |
joeverbout | 0:ea44dc9ed014 | 265 | @param h Parameter regulating filter strength for luminance component. Bigger h value perfectly |
joeverbout | 0:ea44dc9ed014 | 266 | removes noise but also removes image details, smaller h value preserves details but also preserves |
joeverbout | 0:ea44dc9ed014 | 267 | some noise. |
joeverbout | 0:ea44dc9ed014 | 268 | @param hColor The same as h but for color components. |
joeverbout | 0:ea44dc9ed014 | 269 | |
joeverbout | 0:ea44dc9ed014 | 270 | The function converts images to CIELAB colorspace and then separately denoise L and AB components |
joeverbout | 0:ea44dc9ed014 | 271 | with given h parameters using fastNlMeansDenoisingMulti function. |
joeverbout | 0:ea44dc9ed014 | 272 | */ |
joeverbout | 0:ea44dc9ed014 | 273 | CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 274 | int imgToDenoiseIndex, int temporalWindowSize, |
joeverbout | 0:ea44dc9ed014 | 275 | float h = 3, float hColor = 3, |
joeverbout | 0:ea44dc9ed014 | 276 | int templateWindowSize = 7, int searchWindowSize = 21); |
joeverbout | 0:ea44dc9ed014 | 277 | |
joeverbout | 0:ea44dc9ed014 | 278 | /** @brief Primal-dual algorithm is an algorithm for solving special types of variational problems (that is, |
joeverbout | 0:ea44dc9ed014 | 279 | finding a function to minimize some functional). As the image denoising, in particular, may be seen |
joeverbout | 0:ea44dc9ed014 | 280 | as the variational problem, primal-dual algorithm then can be used to perform denoising and this is |
joeverbout | 0:ea44dc9ed014 | 281 | exactly what is implemented. |
joeverbout | 0:ea44dc9ed014 | 282 | |
joeverbout | 0:ea44dc9ed014 | 283 | It should be noted, that this implementation was taken from the July 2013 blog entry |
joeverbout | 0:ea44dc9ed014 | 284 | @cite MA13 , which also contained (slightly more general) ready-to-use source code on Python. |
joeverbout | 0:ea44dc9ed014 | 285 | Subsequently, that code was rewritten on C++ with the usage of openCV by Vadim Pisarevsky at the end |
joeverbout | 0:ea44dc9ed014 | 286 | of July 2013 and finally it was slightly adapted by later authors. |
joeverbout | 0:ea44dc9ed014 | 287 | |
joeverbout | 0:ea44dc9ed014 | 288 | Although the thorough discussion and justification of the algorithm involved may be found in |
joeverbout | 0:ea44dc9ed014 | 289 | @cite ChambolleEtAl, it might make sense to skim over it here, following @cite MA13 . To begin |
joeverbout | 0:ea44dc9ed014 | 290 | with, we consider the 1-byte gray-level images as the functions from the rectangular domain of |
joeverbout | 0:ea44dc9ed014 | 291 | pixels (it may be seen as set |
joeverbout | 0:ea44dc9ed014 | 292 | \f$\left\{(x,y)\in\mathbb{N}\times\mathbb{N}\mid 1\leq x\leq n,\;1\leq y\leq m\right\}\f$ for some |
joeverbout | 0:ea44dc9ed014 | 293 | \f$m,\;n\in\mathbb{N}\f$) into \f$\{0,1,\dots,255\}\f$. We shall denote the noised images as \f$f_i\f$ and with |
joeverbout | 0:ea44dc9ed014 | 294 | this view, given some image \f$x\f$ of the same size, we may measure how bad it is by the formula |
joeverbout | 0:ea44dc9ed014 | 295 | |
joeverbout | 0:ea44dc9ed014 | 296 | \f[\left\|\left\|\nabla x\right\|\right\| + \lambda\sum_i\left\|\left\|x-f_i\right\|\right\|\f] |
joeverbout | 0:ea44dc9ed014 | 297 | |
joeverbout | 0:ea44dc9ed014 | 298 | \f$\|\|\cdot\|\|\f$ here denotes \f$L_2\f$-norm and as you see, the first addend states that we want our |
joeverbout | 0:ea44dc9ed014 | 299 | image to be smooth (ideally, having zero gradient, thus being constant) and the second states that |
joeverbout | 0:ea44dc9ed014 | 300 | we want our result to be close to the observations we've got. If we treat \f$x\f$ as a function, this is |
joeverbout | 0:ea44dc9ed014 | 301 | exactly the functional what we seek to minimize and here the Primal-Dual algorithm comes into play. |
joeverbout | 0:ea44dc9ed014 | 302 | |
joeverbout | 0:ea44dc9ed014 | 303 | @param observations This array should contain one or more noised versions of the image that is to |
joeverbout | 0:ea44dc9ed014 | 304 | be restored. |
joeverbout | 0:ea44dc9ed014 | 305 | @param result Here the denoised image will be stored. There is no need to do pre-allocation of |
joeverbout | 0:ea44dc9ed014 | 306 | storage space, as it will be automatically allocated, if necessary. |
joeverbout | 0:ea44dc9ed014 | 307 | @param lambda Corresponds to \f$\lambda\f$ in the formulas above. As it is enlarged, the smooth |
joeverbout | 0:ea44dc9ed014 | 308 | (blurred) images are treated more favorably than detailed (but maybe more noised) ones. Roughly |
joeverbout | 0:ea44dc9ed014 | 309 | speaking, as it becomes smaller, the result will be more blur but more sever outliers will be |
joeverbout | 0:ea44dc9ed014 | 310 | removed. |
joeverbout | 0:ea44dc9ed014 | 311 | @param niters Number of iterations that the algorithm will run. Of course, as more iterations as |
joeverbout | 0:ea44dc9ed014 | 312 | better, but it is hard to quantitatively refine this statement, so just use the default and |
joeverbout | 0:ea44dc9ed014 | 313 | increase it if the results are poor. |
joeverbout | 0:ea44dc9ed014 | 314 | */ |
joeverbout | 0:ea44dc9ed014 | 315 | CV_EXPORTS_W void denoise_TVL1(const std::vector<Mat>& observations,Mat& result, double lambda=1.0, int niters=30); |
joeverbout | 0:ea44dc9ed014 | 316 | |
joeverbout | 0:ea44dc9ed014 | 317 | //! @} photo_denoise |
joeverbout | 0:ea44dc9ed014 | 318 | |
joeverbout | 0:ea44dc9ed014 | 319 | //! @addtogroup photo_hdr |
joeverbout | 0:ea44dc9ed014 | 320 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 321 | |
joeverbout | 0:ea44dc9ed014 | 322 | enum { LDR_SIZE = 256 }; |
joeverbout | 0:ea44dc9ed014 | 323 | |
joeverbout | 0:ea44dc9ed014 | 324 | /** @brief Base class for tonemapping algorithms - tools that are used to map HDR image to 8-bit range. |
joeverbout | 0:ea44dc9ed014 | 325 | */ |
joeverbout | 0:ea44dc9ed014 | 326 | class CV_EXPORTS_W Tonemap : public Algorithm |
joeverbout | 0:ea44dc9ed014 | 327 | { |
joeverbout | 0:ea44dc9ed014 | 328 | public: |
joeverbout | 0:ea44dc9ed014 | 329 | /** @brief Tonemaps image |
joeverbout | 0:ea44dc9ed014 | 330 | |
joeverbout | 0:ea44dc9ed014 | 331 | @param src source image - 32-bit 3-channel Mat |
joeverbout | 0:ea44dc9ed014 | 332 | @param dst destination image - 32-bit 3-channel Mat with values in [0, 1] range |
joeverbout | 0:ea44dc9ed014 | 333 | */ |
joeverbout | 0:ea44dc9ed014 | 334 | CV_WRAP virtual void process(InputArray src, OutputArray dst) = 0; |
joeverbout | 0:ea44dc9ed014 | 335 | |
joeverbout | 0:ea44dc9ed014 | 336 | CV_WRAP virtual float getGamma() const = 0; |
joeverbout | 0:ea44dc9ed014 | 337 | CV_WRAP virtual void setGamma(float gamma) = 0; |
joeverbout | 0:ea44dc9ed014 | 338 | }; |
joeverbout | 0:ea44dc9ed014 | 339 | |
joeverbout | 0:ea44dc9ed014 | 340 | /** @brief Creates simple linear mapper with gamma correction |
joeverbout | 0:ea44dc9ed014 | 341 | |
joeverbout | 0:ea44dc9ed014 | 342 | @param gamma positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma |
joeverbout | 0:ea44dc9ed014 | 343 | equal to 2.2f is suitable for most displays. |
joeverbout | 0:ea44dc9ed014 | 344 | Generally gamma \> 1 brightens the image and gamma \< 1 darkens it. |
joeverbout | 0:ea44dc9ed014 | 345 | */ |
joeverbout | 0:ea44dc9ed014 | 346 | CV_EXPORTS_W Ptr<Tonemap> createTonemap(float gamma = 1.0f); |
joeverbout | 0:ea44dc9ed014 | 347 | |
joeverbout | 0:ea44dc9ed014 | 348 | /** @brief Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in |
joeverbout | 0:ea44dc9ed014 | 349 | logarithmic domain. |
joeverbout | 0:ea44dc9ed014 | 350 | |
joeverbout | 0:ea44dc9ed014 | 351 | Since it's a global operator the same function is applied to all the pixels, it is controlled by the |
joeverbout | 0:ea44dc9ed014 | 352 | bias parameter. |
joeverbout | 0:ea44dc9ed014 | 353 | |
joeverbout | 0:ea44dc9ed014 | 354 | Optional saturation enhancement is possible as described in @cite FL02 . |
joeverbout | 0:ea44dc9ed014 | 355 | |
joeverbout | 0:ea44dc9ed014 | 356 | For more information see @cite DM03 . |
joeverbout | 0:ea44dc9ed014 | 357 | */ |
joeverbout | 0:ea44dc9ed014 | 358 | class CV_EXPORTS_W TonemapDrago : public Tonemap |
joeverbout | 0:ea44dc9ed014 | 359 | { |
joeverbout | 0:ea44dc9ed014 | 360 | public: |
joeverbout | 0:ea44dc9ed014 | 361 | |
joeverbout | 0:ea44dc9ed014 | 362 | CV_WRAP virtual float getSaturation() const = 0; |
joeverbout | 0:ea44dc9ed014 | 363 | CV_WRAP virtual void setSaturation(float saturation) = 0; |
joeverbout | 0:ea44dc9ed014 | 364 | |
joeverbout | 0:ea44dc9ed014 | 365 | CV_WRAP virtual float getBias() const = 0; |
joeverbout | 0:ea44dc9ed014 | 366 | CV_WRAP virtual void setBias(float bias) = 0; |
joeverbout | 0:ea44dc9ed014 | 367 | }; |
joeverbout | 0:ea44dc9ed014 | 368 | |
joeverbout | 0:ea44dc9ed014 | 369 | /** @brief Creates TonemapDrago object |
joeverbout | 0:ea44dc9ed014 | 370 | |
joeverbout | 0:ea44dc9ed014 | 371 | @param gamma gamma value for gamma correction. See createTonemap |
joeverbout | 0:ea44dc9ed014 | 372 | @param saturation positive saturation enhancement value. 1.0 preserves saturation, values greater |
joeverbout | 0:ea44dc9ed014 | 373 | than 1 increase saturation and values less than 1 decrease it. |
joeverbout | 0:ea44dc9ed014 | 374 | @param bias value for bias function in [0, 1] range. Values from 0.7 to 0.9 usually give best |
joeverbout | 0:ea44dc9ed014 | 375 | results, default value is 0.85. |
joeverbout | 0:ea44dc9ed014 | 376 | */ |
joeverbout | 0:ea44dc9ed014 | 377 | CV_EXPORTS_W Ptr<TonemapDrago> createTonemapDrago(float gamma = 1.0f, float saturation = 1.0f, float bias = 0.85f); |
joeverbout | 0:ea44dc9ed014 | 378 | |
joeverbout | 0:ea44dc9ed014 | 379 | /** @brief This algorithm decomposes image into two layers: base layer and detail layer using bilateral filter |
joeverbout | 0:ea44dc9ed014 | 380 | and compresses contrast of the base layer thus preserving all the details. |
joeverbout | 0:ea44dc9ed014 | 381 | |
joeverbout | 0:ea44dc9ed014 | 382 | This implementation uses regular bilateral filter from opencv. |
joeverbout | 0:ea44dc9ed014 | 383 | |
joeverbout | 0:ea44dc9ed014 | 384 | Saturation enhancement is possible as in ocvTonemapDrago. |
joeverbout | 0:ea44dc9ed014 | 385 | |
joeverbout | 0:ea44dc9ed014 | 386 | For more information see @cite DD02 . |
joeverbout | 0:ea44dc9ed014 | 387 | */ |
joeverbout | 0:ea44dc9ed014 | 388 | class CV_EXPORTS_W TonemapDurand : public Tonemap |
joeverbout | 0:ea44dc9ed014 | 389 | { |
joeverbout | 0:ea44dc9ed014 | 390 | public: |
joeverbout | 0:ea44dc9ed014 | 391 | |
joeverbout | 0:ea44dc9ed014 | 392 | CV_WRAP virtual float getSaturation() const = 0; |
joeverbout | 0:ea44dc9ed014 | 393 | CV_WRAP virtual void setSaturation(float saturation) = 0; |
joeverbout | 0:ea44dc9ed014 | 394 | |
joeverbout | 0:ea44dc9ed014 | 395 | CV_WRAP virtual float getContrast() const = 0; |
joeverbout | 0:ea44dc9ed014 | 396 | CV_WRAP virtual void setContrast(float contrast) = 0; |
joeverbout | 0:ea44dc9ed014 | 397 | |
joeverbout | 0:ea44dc9ed014 | 398 | CV_WRAP virtual float getSigmaSpace() const = 0; |
joeverbout | 0:ea44dc9ed014 | 399 | CV_WRAP virtual void setSigmaSpace(float sigma_space) = 0; |
joeverbout | 0:ea44dc9ed014 | 400 | |
joeverbout | 0:ea44dc9ed014 | 401 | CV_WRAP virtual float getSigmaColor() const = 0; |
joeverbout | 0:ea44dc9ed014 | 402 | CV_WRAP virtual void setSigmaColor(float sigma_color) = 0; |
joeverbout | 0:ea44dc9ed014 | 403 | }; |
joeverbout | 0:ea44dc9ed014 | 404 | |
joeverbout | 0:ea44dc9ed014 | 405 | /** @brief Creates TonemapDurand object |
joeverbout | 0:ea44dc9ed014 | 406 | |
joeverbout | 0:ea44dc9ed014 | 407 | @param gamma gamma value for gamma correction. See createTonemap |
joeverbout | 0:ea44dc9ed014 | 408 | @param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min |
joeverbout | 0:ea44dc9ed014 | 409 | are maximum and minimum luminance values of the resulting image. |
joeverbout | 0:ea44dc9ed014 | 410 | @param saturation saturation enhancement value. See createTonemapDrago |
joeverbout | 0:ea44dc9ed014 | 411 | @param sigma_space bilateral filter sigma in color space |
joeverbout | 0:ea44dc9ed014 | 412 | @param sigma_color bilateral filter sigma in coordinate space |
joeverbout | 0:ea44dc9ed014 | 413 | */ |
joeverbout | 0:ea44dc9ed014 | 414 | CV_EXPORTS_W Ptr<TonemapDurand> |
joeverbout | 0:ea44dc9ed014 | 415 | createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_space = 2.0f, float sigma_color = 2.0f); |
joeverbout | 0:ea44dc9ed014 | 416 | |
joeverbout | 0:ea44dc9ed014 | 417 | /** @brief This is a global tonemapping operator that models human visual system. |
joeverbout | 0:ea44dc9ed014 | 418 | |
joeverbout | 0:ea44dc9ed014 | 419 | Mapping function is controlled by adaptation parameter, that is computed using light adaptation and |
joeverbout | 0:ea44dc9ed014 | 420 | color adaptation. |
joeverbout | 0:ea44dc9ed014 | 421 | |
joeverbout | 0:ea44dc9ed014 | 422 | For more information see @cite RD05 . |
joeverbout | 0:ea44dc9ed014 | 423 | */ |
joeverbout | 0:ea44dc9ed014 | 424 | class CV_EXPORTS_W TonemapReinhard : public Tonemap |
joeverbout | 0:ea44dc9ed014 | 425 | { |
joeverbout | 0:ea44dc9ed014 | 426 | public: |
joeverbout | 0:ea44dc9ed014 | 427 | CV_WRAP virtual float getIntensity() const = 0; |
joeverbout | 0:ea44dc9ed014 | 428 | CV_WRAP virtual void setIntensity(float intensity) = 0; |
joeverbout | 0:ea44dc9ed014 | 429 | |
joeverbout | 0:ea44dc9ed014 | 430 | CV_WRAP virtual float getLightAdaptation() const = 0; |
joeverbout | 0:ea44dc9ed014 | 431 | CV_WRAP virtual void setLightAdaptation(float light_adapt) = 0; |
joeverbout | 0:ea44dc9ed014 | 432 | |
joeverbout | 0:ea44dc9ed014 | 433 | CV_WRAP virtual float getColorAdaptation() const = 0; |
joeverbout | 0:ea44dc9ed014 | 434 | CV_WRAP virtual void setColorAdaptation(float color_adapt) = 0; |
joeverbout | 0:ea44dc9ed014 | 435 | }; |
joeverbout | 0:ea44dc9ed014 | 436 | |
joeverbout | 0:ea44dc9ed014 | 437 | /** @brief Creates TonemapReinhard object |
joeverbout | 0:ea44dc9ed014 | 438 | |
joeverbout | 0:ea44dc9ed014 | 439 | @param gamma gamma value for gamma correction. See createTonemap |
joeverbout | 0:ea44dc9ed014 | 440 | @param intensity result intensity in [-8, 8] range. Greater intensity produces brighter results. |
joeverbout | 0:ea44dc9ed014 | 441 | @param light_adapt light adaptation in [0, 1] range. If 1 adaptation is based only on pixel |
joeverbout | 0:ea44dc9ed014 | 442 | value, if 0 it's global, otherwise it's a weighted mean of this two cases. |
joeverbout | 0:ea44dc9ed014 | 443 | @param color_adapt chromatic adaptation in [0, 1] range. If 1 channels are treated independently, |
joeverbout | 0:ea44dc9ed014 | 444 | if 0 adaptation level is the same for each channel. |
joeverbout | 0:ea44dc9ed014 | 445 | */ |
joeverbout | 0:ea44dc9ed014 | 446 | CV_EXPORTS_W Ptr<TonemapReinhard> |
joeverbout | 0:ea44dc9ed014 | 447 | createTonemapReinhard(float gamma = 1.0f, float intensity = 0.0f, float light_adapt = 1.0f, float color_adapt = 0.0f); |
joeverbout | 0:ea44dc9ed014 | 448 | |
joeverbout | 0:ea44dc9ed014 | 449 | /** @brief This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid, |
joeverbout | 0:ea44dc9ed014 | 450 | transforms contrast values to HVS response and scales the response. After this the image is |
joeverbout | 0:ea44dc9ed014 | 451 | reconstructed from new contrast values. |
joeverbout | 0:ea44dc9ed014 | 452 | |
joeverbout | 0:ea44dc9ed014 | 453 | For more information see @cite MM06 . |
joeverbout | 0:ea44dc9ed014 | 454 | */ |
joeverbout | 0:ea44dc9ed014 | 455 | class CV_EXPORTS_W TonemapMantiuk : public Tonemap |
joeverbout | 0:ea44dc9ed014 | 456 | { |
joeverbout | 0:ea44dc9ed014 | 457 | public: |
joeverbout | 0:ea44dc9ed014 | 458 | CV_WRAP virtual float getScale() const = 0; |
joeverbout | 0:ea44dc9ed014 | 459 | CV_WRAP virtual void setScale(float scale) = 0; |
joeverbout | 0:ea44dc9ed014 | 460 | |
joeverbout | 0:ea44dc9ed014 | 461 | CV_WRAP virtual float getSaturation() const = 0; |
joeverbout | 0:ea44dc9ed014 | 462 | CV_WRAP virtual void setSaturation(float saturation) = 0; |
joeverbout | 0:ea44dc9ed014 | 463 | }; |
joeverbout | 0:ea44dc9ed014 | 464 | |
joeverbout | 0:ea44dc9ed014 | 465 | /** @brief Creates TonemapMantiuk object |
joeverbout | 0:ea44dc9ed014 | 466 | |
joeverbout | 0:ea44dc9ed014 | 467 | @param gamma gamma value for gamma correction. See createTonemap |
joeverbout | 0:ea44dc9ed014 | 468 | @param scale contrast scale factor. HVS response is multiplied by this parameter, thus compressing |
joeverbout | 0:ea44dc9ed014 | 469 | dynamic range. Values from 0.6 to 0.9 produce best results. |
joeverbout | 0:ea44dc9ed014 | 470 | @param saturation saturation enhancement value. See createTonemapDrago |
joeverbout | 0:ea44dc9ed014 | 471 | */ |
joeverbout | 0:ea44dc9ed014 | 472 | CV_EXPORTS_W Ptr<TonemapMantiuk> |
joeverbout | 0:ea44dc9ed014 | 473 | createTonemapMantiuk(float gamma = 1.0f, float scale = 0.7f, float saturation = 1.0f); |
joeverbout | 0:ea44dc9ed014 | 474 | |
joeverbout | 0:ea44dc9ed014 | 475 | /** @brief The base class for algorithms that align images of the same scene with different exposures |
joeverbout | 0:ea44dc9ed014 | 476 | */ |
joeverbout | 0:ea44dc9ed014 | 477 | class CV_EXPORTS_W AlignExposures : public Algorithm |
joeverbout | 0:ea44dc9ed014 | 478 | { |
joeverbout | 0:ea44dc9ed014 | 479 | public: |
joeverbout | 0:ea44dc9ed014 | 480 | /** @brief Aligns images |
joeverbout | 0:ea44dc9ed014 | 481 | |
joeverbout | 0:ea44dc9ed014 | 482 | @param src vector of input images |
joeverbout | 0:ea44dc9ed014 | 483 | @param dst vector of aligned images |
joeverbout | 0:ea44dc9ed014 | 484 | @param times vector of exposure time values for each image |
joeverbout | 0:ea44dc9ed014 | 485 | @param response 256x1 matrix with inverse camera response function for each pixel value, it should |
joeverbout | 0:ea44dc9ed014 | 486 | have the same number of channels as images. |
joeverbout | 0:ea44dc9ed014 | 487 | */ |
joeverbout | 0:ea44dc9ed014 | 488 | CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst, |
joeverbout | 0:ea44dc9ed014 | 489 | InputArray times, InputArray response) = 0; |
joeverbout | 0:ea44dc9ed014 | 490 | }; |
joeverbout | 0:ea44dc9ed014 | 491 | |
joeverbout | 0:ea44dc9ed014 | 492 | /** @brief This algorithm converts images to median threshold bitmaps (1 for pixels brighter than median |
joeverbout | 0:ea44dc9ed014 | 493 | luminance and 0 otherwise) and than aligns the resulting bitmaps using bit operations. |
joeverbout | 0:ea44dc9ed014 | 494 | |
joeverbout | 0:ea44dc9ed014 | 495 | It is invariant to exposure, so exposure values and camera response are not necessary. |
joeverbout | 0:ea44dc9ed014 | 496 | |
joeverbout | 0:ea44dc9ed014 | 497 | In this implementation new image regions are filled with zeros. |
joeverbout | 0:ea44dc9ed014 | 498 | |
joeverbout | 0:ea44dc9ed014 | 499 | For more information see @cite GW03 . |
joeverbout | 0:ea44dc9ed014 | 500 | */ |
joeverbout | 0:ea44dc9ed014 | 501 | class CV_EXPORTS_W AlignMTB : public AlignExposures |
joeverbout | 0:ea44dc9ed014 | 502 | { |
joeverbout | 0:ea44dc9ed014 | 503 | public: |
joeverbout | 0:ea44dc9ed014 | 504 | CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst, |
joeverbout | 0:ea44dc9ed014 | 505 | InputArray times, InputArray response) = 0; |
joeverbout | 0:ea44dc9ed014 | 506 | |
joeverbout | 0:ea44dc9ed014 | 507 | /** @brief Short version of process, that doesn't take extra arguments. |
joeverbout | 0:ea44dc9ed014 | 508 | |
joeverbout | 0:ea44dc9ed014 | 509 | @param src vector of input images |
joeverbout | 0:ea44dc9ed014 | 510 | @param dst vector of aligned images |
joeverbout | 0:ea44dc9ed014 | 511 | */ |
joeverbout | 0:ea44dc9ed014 | 512 | CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst) = 0; |
joeverbout | 0:ea44dc9ed014 | 513 | |
joeverbout | 0:ea44dc9ed014 | 514 | /** @brief Calculates shift between two images, i. e. how to shift the second image to correspond it with the |
joeverbout | 0:ea44dc9ed014 | 515 | first. |
joeverbout | 0:ea44dc9ed014 | 516 | |
joeverbout | 0:ea44dc9ed014 | 517 | @param img0 first image |
joeverbout | 0:ea44dc9ed014 | 518 | @param img1 second image |
joeverbout | 0:ea44dc9ed014 | 519 | */ |
joeverbout | 0:ea44dc9ed014 | 520 | CV_WRAP virtual Point calculateShift(InputArray img0, InputArray img1) = 0; |
joeverbout | 0:ea44dc9ed014 | 521 | /** @brief Helper function, that shift Mat filling new regions with zeros. |
joeverbout | 0:ea44dc9ed014 | 522 | |
joeverbout | 0:ea44dc9ed014 | 523 | @param src input image |
joeverbout | 0:ea44dc9ed014 | 524 | @param dst result image |
joeverbout | 0:ea44dc9ed014 | 525 | @param shift shift value |
joeverbout | 0:ea44dc9ed014 | 526 | */ |
joeverbout | 0:ea44dc9ed014 | 527 | CV_WRAP virtual void shiftMat(InputArray src, OutputArray dst, const Point shift) = 0; |
joeverbout | 0:ea44dc9ed014 | 528 | /** @brief Computes median threshold and exclude bitmaps of given image. |
joeverbout | 0:ea44dc9ed014 | 529 | |
joeverbout | 0:ea44dc9ed014 | 530 | @param img input image |
joeverbout | 0:ea44dc9ed014 | 531 | @param tb median threshold bitmap |
joeverbout | 0:ea44dc9ed014 | 532 | @param eb exclude bitmap |
joeverbout | 0:ea44dc9ed014 | 533 | */ |
joeverbout | 0:ea44dc9ed014 | 534 | CV_WRAP virtual void computeBitmaps(InputArray img, OutputArray tb, OutputArray eb) = 0; |
joeverbout | 0:ea44dc9ed014 | 535 | |
joeverbout | 0:ea44dc9ed014 | 536 | CV_WRAP virtual int getMaxBits() const = 0; |
joeverbout | 0:ea44dc9ed014 | 537 | CV_WRAP virtual void setMaxBits(int max_bits) = 0; |
joeverbout | 0:ea44dc9ed014 | 538 | |
joeverbout | 0:ea44dc9ed014 | 539 | CV_WRAP virtual int getExcludeRange() const = 0; |
joeverbout | 0:ea44dc9ed014 | 540 | CV_WRAP virtual void setExcludeRange(int exclude_range) = 0; |
joeverbout | 0:ea44dc9ed014 | 541 | |
joeverbout | 0:ea44dc9ed014 | 542 | CV_WRAP virtual bool getCut() const = 0; |
joeverbout | 0:ea44dc9ed014 | 543 | CV_WRAP virtual void setCut(bool value) = 0; |
joeverbout | 0:ea44dc9ed014 | 544 | }; |
joeverbout | 0:ea44dc9ed014 | 545 | |
joeverbout | 0:ea44dc9ed014 | 546 | /** @brief Creates AlignMTB object |
joeverbout | 0:ea44dc9ed014 | 547 | |
joeverbout | 0:ea44dc9ed014 | 548 | @param max_bits logarithm to the base 2 of maximal shift in each dimension. Values of 5 and 6 are |
joeverbout | 0:ea44dc9ed014 | 549 | usually good enough (31 and 63 pixels shift respectively). |
joeverbout | 0:ea44dc9ed014 | 550 | @param exclude_range range for exclusion bitmap that is constructed to suppress noise around the |
joeverbout | 0:ea44dc9ed014 | 551 | median value. |
joeverbout | 0:ea44dc9ed014 | 552 | @param cut if true cuts images, otherwise fills the new regions with zeros. |
joeverbout | 0:ea44dc9ed014 | 553 | */ |
joeverbout | 0:ea44dc9ed014 | 554 | CV_EXPORTS_W Ptr<AlignMTB> createAlignMTB(int max_bits = 6, int exclude_range = 4, bool cut = true); |
joeverbout | 0:ea44dc9ed014 | 555 | |
joeverbout | 0:ea44dc9ed014 | 556 | /** @brief The base class for camera response calibration algorithms. |
joeverbout | 0:ea44dc9ed014 | 557 | */ |
joeverbout | 0:ea44dc9ed014 | 558 | class CV_EXPORTS_W CalibrateCRF : public Algorithm |
joeverbout | 0:ea44dc9ed014 | 559 | { |
joeverbout | 0:ea44dc9ed014 | 560 | public: |
joeverbout | 0:ea44dc9ed014 | 561 | /** @brief Recovers inverse camera response. |
joeverbout | 0:ea44dc9ed014 | 562 | |
joeverbout | 0:ea44dc9ed014 | 563 | @param src vector of input images |
joeverbout | 0:ea44dc9ed014 | 564 | @param dst 256x1 matrix with inverse camera response function |
joeverbout | 0:ea44dc9ed014 | 565 | @param times vector of exposure time values for each image |
joeverbout | 0:ea44dc9ed014 | 566 | */ |
joeverbout | 0:ea44dc9ed014 | 567 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0; |
joeverbout | 0:ea44dc9ed014 | 568 | }; |
joeverbout | 0:ea44dc9ed014 | 569 | |
joeverbout | 0:ea44dc9ed014 | 570 | /** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective |
joeverbout | 0:ea44dc9ed014 | 571 | function as linear system. Objective function is constructed using pixel values on the same position |
joeverbout | 0:ea44dc9ed014 | 572 | in all images, extra term is added to make the result smoother. |
joeverbout | 0:ea44dc9ed014 | 573 | |
joeverbout | 0:ea44dc9ed014 | 574 | For more information see @cite DM97 . |
joeverbout | 0:ea44dc9ed014 | 575 | */ |
joeverbout | 0:ea44dc9ed014 | 576 | class CV_EXPORTS_W CalibrateDebevec : public CalibrateCRF |
joeverbout | 0:ea44dc9ed014 | 577 | { |
joeverbout | 0:ea44dc9ed014 | 578 | public: |
joeverbout | 0:ea44dc9ed014 | 579 | CV_WRAP virtual float getLambda() const = 0; |
joeverbout | 0:ea44dc9ed014 | 580 | CV_WRAP virtual void setLambda(float lambda) = 0; |
joeverbout | 0:ea44dc9ed014 | 581 | |
joeverbout | 0:ea44dc9ed014 | 582 | CV_WRAP virtual int getSamples() const = 0; |
joeverbout | 0:ea44dc9ed014 | 583 | CV_WRAP virtual void setSamples(int samples) = 0; |
joeverbout | 0:ea44dc9ed014 | 584 | |
joeverbout | 0:ea44dc9ed014 | 585 | CV_WRAP virtual bool getRandom() const = 0; |
joeverbout | 0:ea44dc9ed014 | 586 | CV_WRAP virtual void setRandom(bool random) = 0; |
joeverbout | 0:ea44dc9ed014 | 587 | }; |
joeverbout | 0:ea44dc9ed014 | 588 | |
joeverbout | 0:ea44dc9ed014 | 589 | /** @brief Creates CalibrateDebevec object |
joeverbout | 0:ea44dc9ed014 | 590 | |
joeverbout | 0:ea44dc9ed014 | 591 | @param samples number of pixel locations to use |
joeverbout | 0:ea44dc9ed014 | 592 | @param lambda smoothness term weight. Greater values produce smoother results, but can alter the |
joeverbout | 0:ea44dc9ed014 | 593 | response. |
joeverbout | 0:ea44dc9ed014 | 594 | @param random if true sample pixel locations are chosen at random, otherwise the form a |
joeverbout | 0:ea44dc9ed014 | 595 | rectangular grid. |
joeverbout | 0:ea44dc9ed014 | 596 | */ |
joeverbout | 0:ea44dc9ed014 | 597 | CV_EXPORTS_W Ptr<CalibrateDebevec> createCalibrateDebevec(int samples = 70, float lambda = 10.0f, bool random = false); |
joeverbout | 0:ea44dc9ed014 | 598 | |
joeverbout | 0:ea44dc9ed014 | 599 | /** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective |
joeverbout | 0:ea44dc9ed014 | 600 | function as linear system. This algorithm uses all image pixels. |
joeverbout | 0:ea44dc9ed014 | 601 | |
joeverbout | 0:ea44dc9ed014 | 602 | For more information see @cite RB99 . |
joeverbout | 0:ea44dc9ed014 | 603 | */ |
joeverbout | 0:ea44dc9ed014 | 604 | class CV_EXPORTS_W CalibrateRobertson : public CalibrateCRF |
joeverbout | 0:ea44dc9ed014 | 605 | { |
joeverbout | 0:ea44dc9ed014 | 606 | public: |
joeverbout | 0:ea44dc9ed014 | 607 | CV_WRAP virtual int getMaxIter() const = 0; |
joeverbout | 0:ea44dc9ed014 | 608 | CV_WRAP virtual void setMaxIter(int max_iter) = 0; |
joeverbout | 0:ea44dc9ed014 | 609 | |
joeverbout | 0:ea44dc9ed014 | 610 | CV_WRAP virtual float getThreshold() const = 0; |
joeverbout | 0:ea44dc9ed014 | 611 | CV_WRAP virtual void setThreshold(float threshold) = 0; |
joeverbout | 0:ea44dc9ed014 | 612 | |
joeverbout | 0:ea44dc9ed014 | 613 | CV_WRAP virtual Mat getRadiance() const = 0; |
joeverbout | 0:ea44dc9ed014 | 614 | }; |
joeverbout | 0:ea44dc9ed014 | 615 | |
joeverbout | 0:ea44dc9ed014 | 616 | /** @brief Creates CalibrateRobertson object |
joeverbout | 0:ea44dc9ed014 | 617 | |
joeverbout | 0:ea44dc9ed014 | 618 | @param max_iter maximal number of Gauss-Seidel solver iterations. |
joeverbout | 0:ea44dc9ed014 | 619 | @param threshold target difference between results of two successive steps of the minimization. |
joeverbout | 0:ea44dc9ed014 | 620 | */ |
joeverbout | 0:ea44dc9ed014 | 621 | CV_EXPORTS_W Ptr<CalibrateRobertson> createCalibrateRobertson(int max_iter = 30, float threshold = 0.01f); |
joeverbout | 0:ea44dc9ed014 | 622 | |
joeverbout | 0:ea44dc9ed014 | 623 | /** @brief The base class algorithms that can merge exposure sequence to a single image. |
joeverbout | 0:ea44dc9ed014 | 624 | */ |
joeverbout | 0:ea44dc9ed014 | 625 | class CV_EXPORTS_W MergeExposures : public Algorithm |
joeverbout | 0:ea44dc9ed014 | 626 | { |
joeverbout | 0:ea44dc9ed014 | 627 | public: |
joeverbout | 0:ea44dc9ed014 | 628 | /** @brief Merges images. |
joeverbout | 0:ea44dc9ed014 | 629 | |
joeverbout | 0:ea44dc9ed014 | 630 | @param src vector of input images |
joeverbout | 0:ea44dc9ed014 | 631 | @param dst result image |
joeverbout | 0:ea44dc9ed014 | 632 | @param times vector of exposure time values for each image |
joeverbout | 0:ea44dc9ed014 | 633 | @param response 256x1 matrix with inverse camera response function for each pixel value, it should |
joeverbout | 0:ea44dc9ed014 | 634 | have the same number of channels as images. |
joeverbout | 0:ea44dc9ed014 | 635 | */ |
joeverbout | 0:ea44dc9ed014 | 636 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 637 | InputArray times, InputArray response) = 0; |
joeverbout | 0:ea44dc9ed014 | 638 | }; |
joeverbout | 0:ea44dc9ed014 | 639 | |
joeverbout | 0:ea44dc9ed014 | 640 | /** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure |
joeverbout | 0:ea44dc9ed014 | 641 | values and camera response. |
joeverbout | 0:ea44dc9ed014 | 642 | |
joeverbout | 0:ea44dc9ed014 | 643 | For more information see @cite DM97 . |
joeverbout | 0:ea44dc9ed014 | 644 | */ |
joeverbout | 0:ea44dc9ed014 | 645 | class CV_EXPORTS_W MergeDebevec : public MergeExposures |
joeverbout | 0:ea44dc9ed014 | 646 | { |
joeverbout | 0:ea44dc9ed014 | 647 | public: |
joeverbout | 0:ea44dc9ed014 | 648 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 649 | InputArray times, InputArray response) = 0; |
joeverbout | 0:ea44dc9ed014 | 650 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0; |
joeverbout | 0:ea44dc9ed014 | 651 | }; |
joeverbout | 0:ea44dc9ed014 | 652 | |
joeverbout | 0:ea44dc9ed014 | 653 | /** @brief Creates MergeDebevec object |
joeverbout | 0:ea44dc9ed014 | 654 | */ |
joeverbout | 0:ea44dc9ed014 | 655 | CV_EXPORTS_W Ptr<MergeDebevec> createMergeDebevec(); |
joeverbout | 0:ea44dc9ed014 | 656 | |
joeverbout | 0:ea44dc9ed014 | 657 | /** @brief Pixels are weighted using contrast, saturation and well-exposedness measures, than images are |
joeverbout | 0:ea44dc9ed014 | 658 | combined using laplacian pyramids. |
joeverbout | 0:ea44dc9ed014 | 659 | |
joeverbout | 0:ea44dc9ed014 | 660 | The resulting image weight is constructed as weighted average of contrast, saturation and |
joeverbout | 0:ea44dc9ed014 | 661 | well-exposedness measures. |
joeverbout | 0:ea44dc9ed014 | 662 | |
joeverbout | 0:ea44dc9ed014 | 663 | The resulting image doesn't require tonemapping and can be converted to 8-bit image by multiplying |
joeverbout | 0:ea44dc9ed014 | 664 | by 255, but it's recommended to apply gamma correction and/or linear tonemapping. |
joeverbout | 0:ea44dc9ed014 | 665 | |
joeverbout | 0:ea44dc9ed014 | 666 | For more information see @cite MK07 . |
joeverbout | 0:ea44dc9ed014 | 667 | */ |
joeverbout | 0:ea44dc9ed014 | 668 | class CV_EXPORTS_W MergeMertens : public MergeExposures |
joeverbout | 0:ea44dc9ed014 | 669 | { |
joeverbout | 0:ea44dc9ed014 | 670 | public: |
joeverbout | 0:ea44dc9ed014 | 671 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 672 | InputArray times, InputArray response) = 0; |
joeverbout | 0:ea44dc9ed014 | 673 | /** @brief Short version of process, that doesn't take extra arguments. |
joeverbout | 0:ea44dc9ed014 | 674 | |
joeverbout | 0:ea44dc9ed014 | 675 | @param src vector of input images |
joeverbout | 0:ea44dc9ed014 | 676 | @param dst result image |
joeverbout | 0:ea44dc9ed014 | 677 | */ |
joeverbout | 0:ea44dc9ed014 | 678 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst) = 0; |
joeverbout | 0:ea44dc9ed014 | 679 | |
joeverbout | 0:ea44dc9ed014 | 680 | CV_WRAP virtual float getContrastWeight() const = 0; |
joeverbout | 0:ea44dc9ed014 | 681 | CV_WRAP virtual void setContrastWeight(float contrast_weiht) = 0; |
joeverbout | 0:ea44dc9ed014 | 682 | |
joeverbout | 0:ea44dc9ed014 | 683 | CV_WRAP virtual float getSaturationWeight() const = 0; |
joeverbout | 0:ea44dc9ed014 | 684 | CV_WRAP virtual void setSaturationWeight(float saturation_weight) = 0; |
joeverbout | 0:ea44dc9ed014 | 685 | |
joeverbout | 0:ea44dc9ed014 | 686 | CV_WRAP virtual float getExposureWeight() const = 0; |
joeverbout | 0:ea44dc9ed014 | 687 | CV_WRAP virtual void setExposureWeight(float exposure_weight) = 0; |
joeverbout | 0:ea44dc9ed014 | 688 | }; |
joeverbout | 0:ea44dc9ed014 | 689 | |
joeverbout | 0:ea44dc9ed014 | 690 | /** @brief Creates MergeMertens object |
joeverbout | 0:ea44dc9ed014 | 691 | |
joeverbout | 0:ea44dc9ed014 | 692 | @param contrast_weight contrast measure weight. See MergeMertens. |
joeverbout | 0:ea44dc9ed014 | 693 | @param saturation_weight saturation measure weight |
joeverbout | 0:ea44dc9ed014 | 694 | @param exposure_weight well-exposedness measure weight |
joeverbout | 0:ea44dc9ed014 | 695 | */ |
joeverbout | 0:ea44dc9ed014 | 696 | CV_EXPORTS_W Ptr<MergeMertens> |
joeverbout | 0:ea44dc9ed014 | 697 | createMergeMertens(float contrast_weight = 1.0f, float saturation_weight = 1.0f, float exposure_weight = 0.0f); |
joeverbout | 0:ea44dc9ed014 | 698 | |
joeverbout | 0:ea44dc9ed014 | 699 | /** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure |
joeverbout | 0:ea44dc9ed014 | 700 | values and camera response. |
joeverbout | 0:ea44dc9ed014 | 701 | |
joeverbout | 0:ea44dc9ed014 | 702 | For more information see @cite RB99 . |
joeverbout | 0:ea44dc9ed014 | 703 | */ |
joeverbout | 0:ea44dc9ed014 | 704 | class CV_EXPORTS_W MergeRobertson : public MergeExposures |
joeverbout | 0:ea44dc9ed014 | 705 | { |
joeverbout | 0:ea44dc9ed014 | 706 | public: |
joeverbout | 0:ea44dc9ed014 | 707 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 708 | InputArray times, InputArray response) = 0; |
joeverbout | 0:ea44dc9ed014 | 709 | CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0; |
joeverbout | 0:ea44dc9ed014 | 710 | }; |
joeverbout | 0:ea44dc9ed014 | 711 | |
joeverbout | 0:ea44dc9ed014 | 712 | /** @brief Creates MergeRobertson object |
joeverbout | 0:ea44dc9ed014 | 713 | */ |
joeverbout | 0:ea44dc9ed014 | 714 | CV_EXPORTS_W Ptr<MergeRobertson> createMergeRobertson(); |
joeverbout | 0:ea44dc9ed014 | 715 | |
joeverbout | 0:ea44dc9ed014 | 716 | //! @} photo_hdr |
joeverbout | 0:ea44dc9ed014 | 717 | |
joeverbout | 0:ea44dc9ed014 | 718 | /** @brief Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized |
joeverbout | 0:ea44dc9ed014 | 719 | black-and-white photograph rendering, and in many single channel image processing applications |
joeverbout | 0:ea44dc9ed014 | 720 | @cite CL12 . |
joeverbout | 0:ea44dc9ed014 | 721 | |
joeverbout | 0:ea44dc9ed014 | 722 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 723 | @param grayscale Output 8-bit 1-channel image. |
joeverbout | 0:ea44dc9ed014 | 724 | @param color_boost Output 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 725 | |
joeverbout | 0:ea44dc9ed014 | 726 | This function is to be applied on color images. |
joeverbout | 0:ea44dc9ed014 | 727 | */ |
joeverbout | 0:ea44dc9ed014 | 728 | CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray color_boost); |
joeverbout | 0:ea44dc9ed014 | 729 | |
joeverbout | 0:ea44dc9ed014 | 730 | //! @addtogroup photo_clone |
joeverbout | 0:ea44dc9ed014 | 731 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 732 | |
joeverbout | 0:ea44dc9ed014 | 733 | /** @brief Image editing tasks concern either global changes (color/intensity corrections, filters, |
joeverbout | 0:ea44dc9ed014 | 734 | deformations) or local changes concerned to a selection. Here we are interested in achieving local |
joeverbout | 0:ea44dc9ed014 | 735 | changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless |
joeverbout | 0:ea44dc9ed014 | 736 | manner. The extent of the changes ranges from slight distortions to complete replacement by novel |
joeverbout | 0:ea44dc9ed014 | 737 | content @cite PM03 . |
joeverbout | 0:ea44dc9ed014 | 738 | |
joeverbout | 0:ea44dc9ed014 | 739 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 740 | @param dst Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 741 | @param mask Input 8-bit 1 or 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 742 | @param p Point in dst image where object is placed. |
joeverbout | 0:ea44dc9ed014 | 743 | @param blend Output image with the same size and type as dst. |
joeverbout | 0:ea44dc9ed014 | 744 | @param flags Cloning method that could be one of the following: |
joeverbout | 0:ea44dc9ed014 | 745 | - **NORMAL_CLONE** The power of the method is fully expressed when inserting objects with |
joeverbout | 0:ea44dc9ed014 | 746 | complex outlines into a new background |
joeverbout | 0:ea44dc9ed014 | 747 | - **MIXED_CLONE** The classic method, color-based selection and alpha masking might be time |
joeverbout | 0:ea44dc9ed014 | 748 | consuming and often leaves an undesirable halo. Seamless cloning, even averaged with the |
joeverbout | 0:ea44dc9ed014 | 749 | original image, is not effective. Mixed seamless cloning based on a loose selection proves |
joeverbout | 0:ea44dc9ed014 | 750 | effective. |
joeverbout | 0:ea44dc9ed014 | 751 | - **FEATURE_EXCHANGE** Feature exchange allows the user to easily replace certain features of |
joeverbout | 0:ea44dc9ed014 | 752 | one object by alternative features. |
joeverbout | 0:ea44dc9ed014 | 753 | */ |
joeverbout | 0:ea44dc9ed014 | 754 | CV_EXPORTS_W void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p, |
joeverbout | 0:ea44dc9ed014 | 755 | OutputArray blend, int flags); |
joeverbout | 0:ea44dc9ed014 | 756 | |
joeverbout | 0:ea44dc9ed014 | 757 | /** @brief Given an original color image, two differently colored versions of this image can be mixed |
joeverbout | 0:ea44dc9ed014 | 758 | seamlessly. |
joeverbout | 0:ea44dc9ed014 | 759 | |
joeverbout | 0:ea44dc9ed014 | 760 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 761 | @param mask Input 8-bit 1 or 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 762 | @param dst Output image with the same size and type as src . |
joeverbout | 0:ea44dc9ed014 | 763 | @param red_mul R-channel multiply factor. |
joeverbout | 0:ea44dc9ed014 | 764 | @param green_mul G-channel multiply factor. |
joeverbout | 0:ea44dc9ed014 | 765 | @param blue_mul B-channel multiply factor. |
joeverbout | 0:ea44dc9ed014 | 766 | |
joeverbout | 0:ea44dc9ed014 | 767 | Multiplication factor is between .5 to 2.5. |
joeverbout | 0:ea44dc9ed014 | 768 | */ |
joeverbout | 0:ea44dc9ed014 | 769 | CV_EXPORTS_W void colorChange(InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0f, |
joeverbout | 0:ea44dc9ed014 | 770 | float green_mul = 1.0f, float blue_mul = 1.0f); |
joeverbout | 0:ea44dc9ed014 | 771 | |
joeverbout | 0:ea44dc9ed014 | 772 | /** @brief Applying an appropriate non-linear transformation to the gradient field inside the selection and |
joeverbout | 0:ea44dc9ed014 | 773 | then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. |
joeverbout | 0:ea44dc9ed014 | 774 | |
joeverbout | 0:ea44dc9ed014 | 775 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 776 | @param mask Input 8-bit 1 or 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 777 | @param dst Output image with the same size and type as src. |
joeverbout | 0:ea44dc9ed014 | 778 | @param alpha Value ranges between 0-2. |
joeverbout | 0:ea44dc9ed014 | 779 | @param beta Value ranges between 0-2. |
joeverbout | 0:ea44dc9ed014 | 780 | |
joeverbout | 0:ea44dc9ed014 | 781 | This is useful to highlight under-exposed foreground objects or to reduce specular reflections. |
joeverbout | 0:ea44dc9ed014 | 782 | */ |
joeverbout | 0:ea44dc9ed014 | 783 | CV_EXPORTS_W void illuminationChange(InputArray src, InputArray mask, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 784 | float alpha = 0.2f, float beta = 0.4f); |
joeverbout | 0:ea44dc9ed014 | 785 | |
joeverbout | 0:ea44dc9ed014 | 786 | /** @brief By retaining only the gradients at edge locations, before integrating with the Poisson solver, one |
joeverbout | 0:ea44dc9ed014 | 787 | washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge |
joeverbout | 0:ea44dc9ed014 | 788 | Detector is used. |
joeverbout | 0:ea44dc9ed014 | 789 | |
joeverbout | 0:ea44dc9ed014 | 790 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 791 | @param mask Input 8-bit 1 or 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 792 | @param dst Output image with the same size and type as src. |
joeverbout | 0:ea44dc9ed014 | 793 | @param low_threshold Range from 0 to 100. |
joeverbout | 0:ea44dc9ed014 | 794 | @param high_threshold Value \> 100. |
joeverbout | 0:ea44dc9ed014 | 795 | @param kernel_size The size of the Sobel kernel to be used. |
joeverbout | 0:ea44dc9ed014 | 796 | |
joeverbout | 0:ea44dc9ed014 | 797 | **NOTE:** |
joeverbout | 0:ea44dc9ed014 | 798 | |
joeverbout | 0:ea44dc9ed014 | 799 | The algorithm assumes that the color of the source image is close to that of the destination. This |
joeverbout | 0:ea44dc9ed014 | 800 | assumption means that when the colors don't match, the source image color gets tinted toward the |
joeverbout | 0:ea44dc9ed014 | 801 | color of the destination image. |
joeverbout | 0:ea44dc9ed014 | 802 | */ |
joeverbout | 0:ea44dc9ed014 | 803 | CV_EXPORTS_W void textureFlattening(InputArray src, InputArray mask, OutputArray dst, |
joeverbout | 0:ea44dc9ed014 | 804 | float low_threshold = 30, float high_threshold = 45, |
joeverbout | 0:ea44dc9ed014 | 805 | int kernel_size = 3); |
joeverbout | 0:ea44dc9ed014 | 806 | |
joeverbout | 0:ea44dc9ed014 | 807 | //! @} photo_clone |
joeverbout | 0:ea44dc9ed014 | 808 | |
joeverbout | 0:ea44dc9ed014 | 809 | //! @addtogroup photo_render |
joeverbout | 0:ea44dc9ed014 | 810 | //! @{ |
joeverbout | 0:ea44dc9ed014 | 811 | |
joeverbout | 0:ea44dc9ed014 | 812 | /** @brief Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing |
joeverbout | 0:ea44dc9ed014 | 813 | filters are used in many different applications @cite EM11 . |
joeverbout | 0:ea44dc9ed014 | 814 | |
joeverbout | 0:ea44dc9ed014 | 815 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 816 | @param dst Output 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 817 | @param flags Edge preserving filters: |
joeverbout | 0:ea44dc9ed014 | 818 | - **RECURS_FILTER** = 1 |
joeverbout | 0:ea44dc9ed014 | 819 | - **NORMCONV_FILTER** = 2 |
joeverbout | 0:ea44dc9ed014 | 820 | @param sigma_s Range between 0 to 200. |
joeverbout | 0:ea44dc9ed014 | 821 | @param sigma_r Range between 0 to 1. |
joeverbout | 0:ea44dc9ed014 | 822 | */ |
joeverbout | 0:ea44dc9ed014 | 823 | CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1, |
joeverbout | 0:ea44dc9ed014 | 824 | float sigma_s = 60, float sigma_r = 0.4f); |
joeverbout | 0:ea44dc9ed014 | 825 | |
joeverbout | 0:ea44dc9ed014 | 826 | /** @brief This filter enhances the details of a particular image. |
joeverbout | 0:ea44dc9ed014 | 827 | |
joeverbout | 0:ea44dc9ed014 | 828 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 829 | @param dst Output image with the same size and type as src. |
joeverbout | 0:ea44dc9ed014 | 830 | @param sigma_s Range between 0 to 200. |
joeverbout | 0:ea44dc9ed014 | 831 | @param sigma_r Range between 0 to 1. |
joeverbout | 0:ea44dc9ed014 | 832 | */ |
joeverbout | 0:ea44dc9ed014 | 833 | CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10, |
joeverbout | 0:ea44dc9ed014 | 834 | float sigma_r = 0.15f); |
joeverbout | 0:ea44dc9ed014 | 835 | |
joeverbout | 0:ea44dc9ed014 | 836 | /** @brief Pencil-like non-photorealistic line drawing |
joeverbout | 0:ea44dc9ed014 | 837 | |
joeverbout | 0:ea44dc9ed014 | 838 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 839 | @param dst1 Output 8-bit 1-channel image. |
joeverbout | 0:ea44dc9ed014 | 840 | @param dst2 Output image with the same size and type as src. |
joeverbout | 0:ea44dc9ed014 | 841 | @param sigma_s Range between 0 to 200. |
joeverbout | 0:ea44dc9ed014 | 842 | @param sigma_r Range between 0 to 1. |
joeverbout | 0:ea44dc9ed014 | 843 | @param shade_factor Range between 0 to 0.1. |
joeverbout | 0:ea44dc9ed014 | 844 | */ |
joeverbout | 0:ea44dc9ed014 | 845 | CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2, |
joeverbout | 0:ea44dc9ed014 | 846 | float sigma_s = 60, float sigma_r = 0.07f, float shade_factor = 0.02f); |
joeverbout | 0:ea44dc9ed014 | 847 | |
joeverbout | 0:ea44dc9ed014 | 848 | /** @brief Stylization aims to produce digital imagery with a wide variety of effects not focused on |
joeverbout | 0:ea44dc9ed014 | 849 | photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low |
joeverbout | 0:ea44dc9ed014 | 850 | contrast while preserving, or enhancing, high-contrast features. |
joeverbout | 0:ea44dc9ed014 | 851 | |
joeverbout | 0:ea44dc9ed014 | 852 | @param src Input 8-bit 3-channel image. |
joeverbout | 0:ea44dc9ed014 | 853 | @param dst Output image with the same size and type as src. |
joeverbout | 0:ea44dc9ed014 | 854 | @param sigma_s Range between 0 to 200. |
joeverbout | 0:ea44dc9ed014 | 855 | @param sigma_r Range between 0 to 1. |
joeverbout | 0:ea44dc9ed014 | 856 | */ |
joeverbout | 0:ea44dc9ed014 | 857 | CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 60, |
joeverbout | 0:ea44dc9ed014 | 858 | float sigma_r = 0.45f); |
joeverbout | 0:ea44dc9ed014 | 859 | |
joeverbout | 0:ea44dc9ed014 | 860 | //! @} photo_render |
joeverbout | 0:ea44dc9ed014 | 861 | |
joeverbout | 0:ea44dc9ed014 | 862 | //! @} photo |
joeverbout | 0:ea44dc9ed014 | 863 | |
joeverbout | 0:ea44dc9ed014 | 864 | } // cv |
joeverbout | 0:ea44dc9ed014 | 865 | |
joeverbout | 0:ea44dc9ed014 | 866 | #ifndef DISABLE_OPENCV_24_COMPATIBILITY |
joeverbout | 0:ea44dc9ed014 | 867 | #include "opencv2/photo/photo_c.h" |
joeverbout | 0:ea44dc9ed014 | 868 | #endif |
joeverbout | 0:ea44dc9ed014 | 869 | |
joeverbout | 0:ea44dc9ed014 | 870 | #endif |
joeverbout | 0:ea44dc9ed014 | 871 |