ximgproc.hpp 7.27 KB
Newer Older
1
/*
vludv's avatar
vludv committed
2 3 4
 *  By downloading, copying, installing or using the software you agree to this license.
 *  If you do not agree to this license, do not download, install,
 *  copy or use the software.
5 6
 *
 *
vludv's avatar
vludv committed
7 8 9
 *  License Agreement
 *  For Open Source Computer Vision Library
 *  (3 - clause BSD License)
10
 *
vludv's avatar
vludv committed
11 12
 *  Redistribution and use in source and binary forms, with or without modification,
 *  are permitted provided that the following conditions are met :
13
 *
14
 *  * Redistributions of source code must retain the above copyright notice,
vludv's avatar
vludv committed
15
 *  this list of conditions and the following disclaimer.
16
 *
vludv's avatar
vludv committed
17 18 19
 *  * Redistributions in binary form must reproduce the above copyright notice,
 *  this list of conditions and the following disclaimer in the documentation
 *  and / or other materials provided with the distribution.
20
 *
vludv's avatar
vludv committed
21 22 23
 *  * Neither the names of the copyright holders nor the names of the contributors
 *  may be used to endorse or promote products derived from this software
 *  without specific prior written permission.
24
 *
vludv's avatar
vludv committed
25 26 27 28 29 30 31 32 33 34
 *  This software is provided by the copyright holders and contributors "as is" and
 *  any express or implied warranties, including, but not limited to, the implied
 *  warranties of merchantability and fitness for a particular purpose are disclaimed.
 *  In no event shall copyright holders or contributors be liable for any direct,
 *  indirect, incidental, special, exemplary, or consequential damages
 *  (including, but not limited to, procurement of substitute goods or services;
 *  loss of use, data, or profits; or business interruption) however caused
 *  and on any theory of liability, whether in contract, strict liability,
 *  or tort(including negligence or otherwise) arising in any way out of
 *  the use of this software, even if advised of the possibility of such damage.
35 36 37 38 39 40
 */

#ifndef __OPENCV_XIMGPROC_HPP__
#define __OPENCV_XIMGPROC_HPP__

#include "ximgproc/edge_filter.hpp"
41
#include "ximgproc/disparity_filter.hpp"
42
#include "ximgproc/sparse_match_interpolator.hpp"
43
#include "ximgproc/structured_edge_detection.hpp"
44
#include "ximgproc/edgeboxes.hpp"
45
#include "ximgproc/seeds.hpp"
46
#include "ximgproc/segmentation.hpp"
47
#include "ximgproc/fast_hough_transform.hpp"
48
#include "ximgproc/estimated_covariance.hpp"
Zhou Chao's avatar
Zhou Chao committed
49
#include "ximgproc/weighted_median_filter.hpp"
50
#include "ximgproc/slic.hpp"
51
#include "ximgproc/lsc.hpp"
LaurentBerger's avatar
LaurentBerger committed
52
#include "ximgproc/paillou_filter.hpp"
53
#include "ximgproc/fast_line_detector.hpp"
54
#include "ximgproc/deriche_filter.hpp"
55
#include "ximgproc/peilin.hpp"
LaurentBerger's avatar
LaurentBerger committed
56
#include "ximgproc/fourier_descriptors.hpp"
kushalvyaskv's avatar
kushalvyaskv committed
57
#include "ximgproc/ridgefilter.hpp"
58
#include "ximgproc/brightedges.hpp"
LaurentBerger's avatar
LaurentBerger committed
59

60

61 62 63 64
/** @defgroup ximgproc Extended Image Processing
  @{
    @defgroup ximgproc_edge Structured forests for fast edge detection

65 66
This module contains implementations of modern structured edge detection algorithms,
i.e. algorithms which somehow takes into account pixel affinities in natural images.
67

68 69
    @defgroup ximgproc_edgeboxes EdgeBoxes

70 71 72
    @defgroup ximgproc_filters Filters

    @defgroup ximgproc_superpixel Superpixels
73 74

    @defgroup ximgproc_segmentation Image segmentation
75 76

    @defgroup ximgproc_fast_line_detector Fast line detector
LaurentBerger's avatar
LaurentBerger committed
77

LaurentBerger's avatar
LaurentBerger committed
78
    @defgroup ximgproc_fourier Fourier descriptors
LaurentBerger's avatar
LaurentBerger committed
79
    @}
80 81
*/

82 83 84 85
namespace cv
{
namespace ximgproc
{
86

87 88 89 90 91
enum ThinningTypes{
    THINNING_ZHANGSUEN    = 0, // Thinning technique of Zhang-Suen
    THINNING_GUOHALL      = 1  // Thinning technique of Guo-Hall
};

92 93 94 95 96 97 98 99 100 101
/**
* @brief Specifies the binarization method to use in cv::ximgproc::niBlackThreshold
*/
enum LocalBinarizationMethods{
	BINARIZATION_NIBLACK = 0, //!< Classic Niblack binarization. See @cite Niblack1985 .
	BINARIZATION_SAUVOLA = 1, //!< Sauvola's technique. See @cite Sauvola1997 .
	BINARIZATION_WOLF = 2,    //!< Wolf's technique. See @cite Wolf2004 .
	BINARIZATION_NICK = 3     //!< NICK technique. See @cite Khurshid2009 .
};

102 103
//! @addtogroup ximgproc
//! @{
104

105 106
/** @brief Performs thresholding on input images using Niblack's technique or some of the
popular variations it inspired.
107 108 109 110 111 112 113 114

The function transforms a grayscale image to a binary image according to the formulae:
-   **THRESH_BINARY**
    \f[dst(x,y) =  \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}\f]
-   **THRESH_BINARY_INV**
    \f[dst(x,y) =  \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}\f]
where \f$T(x,y)\f$ is a threshold calculated individually for each pixel.

115 116 117
The threshold value \f$T(x, y)\f$ is determined based on the binarization method chosen. For
classic Niblack, it is the mean minus \f$ k \f$ times standard deviation of
\f$\texttt{blockSize} \times\texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$.
118 119 120 121 122 123 124 125 126 127

The function can't process the image in-place.

@param _src Source 8-bit single-channel image.
@param _dst Destination image of the same size and the same type as src.
@param maxValue Non-zero value assigned to the pixels for which the condition is satisfied,
used with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
@param type Thresholding type, see cv::ThresholdTypes.
@param blockSize Size of a pixel neighborhood that is used to calculate a threshold value
for the pixel: 3, 5, 7, and so on.
128 129 130 131 132
@param k The user-adjustable parameter used by Niblack and inspired techniques. For Niblack, this is
normally a value between 0 and 1 that is multiplied with the standard deviation and subtracted from
the mean.
@param binarizationMethod Binarization method to use. By default, Niblack's technique is used.
Other techniques can be specified, see cv::ximgproc::LocalBinarizationMethods.
133 134 135 136 137

@sa  threshold, adaptiveThreshold
 */
CV_EXPORTS_W void niBlackThreshold( InputArray _src, OutputArray _dst,
                                    double maxValue, int type,
138
                                    int blockSize, double k, int binarizationMethod = BINARIZATION_NIBLACK );
139

StevenPuttemans's avatar
StevenPuttemans committed
140 141 142 143 144 145
/** @brief Applies a binary blob thinning operation, to achieve a skeletization of the input image.

The function transforms a binary blob image into a skeletized form using the technique of Zhang-Suen.

@param src Source 8-bit single-channel image, containing binary blobs, with blobs having 255 pixel values.
@param dst Destination image of the same size and the same type as src. The function can work in-place.
146
@param thinningType Value that defines which thinning algorithm should be used. See cv::ximgproc::ThinningTypes
StevenPuttemans's avatar
StevenPuttemans committed
147
 */
148
CV_EXPORTS_W void thinning( InputArray src, OutputArray dst, int thinningType = THINNING_ZHANGSUEN);
StevenPuttemans's avatar
StevenPuttemans committed
149

150
/** @brief Performs anisotropic diffusian on an image.
151

152
 The function applies Perona-Malik anisotropic diffusion to an image. This is the solution to the partial differential equation:
153

154
 \f[{\frac  {\partial I}{\partial t}}={\mathrm  {div}}\left(c(x,y,t)\nabla I\right)=\nabla c\cdot \nabla I+c(x,y,t)\Delta I\f]
155

156
 Suggested functions for c(x,y,t) are:
157

158
 \f[c\left(\|\nabla I\|\right)=e^{{-\left(\|\nabla I\|/K\right)^{2}}}\f]
159

160
 or
161

162
 \f[ c\left(\|\nabla I\|\right)={\frac {1}{1+\left({\frac  {\|\nabla I\|}{K}}\right)^{2}}} \f]
163

164 165 166 167 168 169 170
 @param src Grayscale Source image.
 @param dst Destination image of the same size and the same number of channels as src .
 @param alpha The amount of time to step forward by on each iteration (normally, it's between 0 and 1).
 @param K sensitivity to the edges
 @param niters The number of iterations
*/
CV_EXPORTS_W void anisotropicDiffusion(InputArray src, OutputArray dst, float alpha, float K, int niters );
StevenPuttemans's avatar
StevenPuttemans committed
171

172 173 174 175 176 177
//! @}

}
}

#endif // __OPENCV_XIMGPROC_HPP__