openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

Committer:
RyoheiHagimoto
Date:
Fri Jan 29 04:53:38 2021 +0000
Revision:
0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.

Who changed what in which revision?

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