Home | History | Annotate | Download | only in opencv2
      1 /*M///////////////////////////////////////////////////////////////////////////////////////
      2 //
      3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
      4 //
      5 //  By downloading, copying, installing or using the software you agree to this license.
      6 //  If you do not agree to this license, do not download, install,
      7 //  copy or use the software.
      8 //
      9 //
     10 //                           License Agreement
     11 //                For Open Source Computer Vision Library
     12 //
     13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
     14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
     15 // Third party copyrights are property of their respective owners.
     16 //
     17 // Redistribution and use in source and binary forms, with or without modification,
     18 // are permitted provided that the following conditions are met:
     19 //
     20 //   * Redistribution's of source code must retain the above copyright notice,
     21 //     this list of conditions and the following disclaimer.
     22 //
     23 //   * Redistribution's in binary form must reproduce the above copyright notice,
     24 //     this list of conditions and the following disclaimer in the documentation
     25 //     and/or other materials provided with the distribution.
     26 //
     27 //   * The name of the copyright holders may not be used to endorse or promote products
     28 //     derived from this software without specific prior written permission.
     29 //
     30 // This software is provided by the copyright holders and contributors "as is" and
     31 // any express or implied warranties, including, but not limited to, the implied
     32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
     33 // In no event shall the Intel Corporation or contributors be liable for any direct,
     34 // indirect, incidental, special, exemplary, or consequential damages
     35 // (including, but not limited to, procurement of substitute goods or services;
     36 // loss of use, data, or profits; or business interruption) however caused
     37 // and on any theory of liability, whether in contract, strict liability,
     38 // or tort (including negligence or otherwise) arising in any way out of
     39 // the use of this software, even if advised of the possibility of such damage.
     40 //
     41 //M*/
     42 
     43 #ifndef __OPENCV_CUDAIMGPROC_HPP__
     44 #define __OPENCV_CUDAIMGPROC_HPP__
     45 
     46 #ifndef __cplusplus
     47 #  error cudaimgproc.hpp header must be compiled as C++
     48 #endif
     49 
     50 #include "opencv2/core/cuda.hpp"
     51 #include "opencv2/imgproc.hpp"
     52 
     53 /**
     54   @addtogroup cuda
     55   @{
     56     @defgroup cudaimgproc Image Processing
     57     @{
     58       @defgroup cudaimgproc_color Color space processing
     59       @defgroup cudaimgproc_hist Histogram Calculation
     60       @defgroup cudaimgproc_hough Hough Transform
     61       @defgroup cudaimgproc_feature Feature Detection
     62     @}
     63   @}
     64 */
     65 
     66 namespace cv { namespace cuda {
     67 
     68 //! @addtogroup cudaimgproc
     69 //! @{
     70 
     71 /////////////////////////// Color Processing ///////////////////////////
     72 
     73 //! @addtogroup cudaimgproc_color
     74 //! @{
     75 
     76 /** @brief Converts an image from one color space to another.
     77 
     78 @param src Source image with CV_8U , CV_16U , or CV_32F depth and 1, 3, or 4 channels.
     79 @param dst Destination image.
     80 @param code Color space conversion code. For details, see cvtColor .
     81 @param dcn Number of channels in the destination image. If the parameter is 0, the number of the
     82 channels is derived automatically from src and the code .
     83 @param stream Stream for the asynchronous version.
     84 
     85 3-channel color spaces (like HSV, XYZ, and so on) can be stored in a 4-channel image for better
     86 performance.
     87 
     88 @sa cvtColor
     89  */
     90 CV_EXPORTS void cvtColor(InputArray src, OutputArray dst, int code, int dcn = 0, Stream& stream = Stream::Null());
     91 
     92 enum DemosaicTypes
     93 {
     94     //! Bayer Demosaicing (Malvar, He, and Cutler)
     95     COLOR_BayerBG2BGR_MHT = 256,
     96     COLOR_BayerGB2BGR_MHT = 257,
     97     COLOR_BayerRG2BGR_MHT = 258,
     98     COLOR_BayerGR2BGR_MHT = 259,
     99 
    100     COLOR_BayerBG2RGB_MHT = COLOR_BayerRG2BGR_MHT,
    101     COLOR_BayerGB2RGB_MHT = COLOR_BayerGR2BGR_MHT,
    102     COLOR_BayerRG2RGB_MHT = COLOR_BayerBG2BGR_MHT,
    103     COLOR_BayerGR2RGB_MHT = COLOR_BayerGB2BGR_MHT,
    104 
    105     COLOR_BayerBG2GRAY_MHT = 260,
    106     COLOR_BayerGB2GRAY_MHT = 261,
    107     COLOR_BayerRG2GRAY_MHT = 262,
    108     COLOR_BayerGR2GRAY_MHT = 263
    109 };
    110 
    111 /** @brief Converts an image from Bayer pattern to RGB or grayscale.
    112 
    113 @param src Source image (8-bit or 16-bit single channel).
    114 @param dst Destination image.
    115 @param code Color space conversion code (see the description below).
    116 @param dcn Number of channels in the destination image. If the parameter is 0, the number of the
    117 channels is derived automatically from src and the code .
    118 @param stream Stream for the asynchronous version.
    119 
    120 The function can do the following transformations:
    121 
    122 -   Demosaicing using bilinear interpolation
    123 
    124     > -   COLOR_BayerBG2GRAY , COLOR_BayerGB2GRAY , COLOR_BayerRG2GRAY , COLOR_BayerGR2GRAY
    125     > -   COLOR_BayerBG2BGR , COLOR_BayerGB2BGR , COLOR_BayerRG2BGR , COLOR_BayerGR2BGR
    126 
    127 -   Demosaicing using Malvar-He-Cutler algorithm (@cite MHT2011)
    128 
    129     > -   COLOR_BayerBG2GRAY_MHT , COLOR_BayerGB2GRAY_MHT , COLOR_BayerRG2GRAY_MHT ,
    130     >     COLOR_BayerGR2GRAY_MHT
    131     > -   COLOR_BayerBG2BGR_MHT , COLOR_BayerGB2BGR_MHT , COLOR_BayerRG2BGR_MHT ,
    132     >     COLOR_BayerGR2BGR_MHT
    133 
    134 @sa cvtColor
    135  */
    136 CV_EXPORTS void demosaicing(InputArray src, OutputArray dst, int code, int dcn = -1, Stream& stream = Stream::Null());
    137 
    138 /** @brief Exchanges the color channels of an image in-place.
    139 
    140 @param image Source image. Supports only CV_8UC4 type.
    141 @param dstOrder Integer array describing how channel values are permutated. The n-th entry of the
    142 array contains the number of the channel that is stored in the n-th channel of the output image.
    143 E.g. Given an RGBA image, aDstOrder = [3,2,1,0] converts this to ABGR channel order.
    144 @param stream Stream for the asynchronous version.
    145 
    146 The methods support arbitrary permutations of the original channels, including replication.
    147  */
    148 CV_EXPORTS void swapChannels(InputOutputArray image, const int dstOrder[4], Stream& stream = Stream::Null());
    149 
    150 /** @brief Routines for correcting image color gamma.
    151 
    152 @param src Source image (3- or 4-channel 8 bit).
    153 @param dst Destination image.
    154 @param forward true for forward gamma correction or false for inverse gamma correction.
    155 @param stream Stream for the asynchronous version.
    156  */
    157 CV_EXPORTS void gammaCorrection(InputArray src, OutputArray dst, bool forward = true, Stream& stream = Stream::Null());
    158 
    159 enum AlphaCompTypes { ALPHA_OVER, ALPHA_IN, ALPHA_OUT, ALPHA_ATOP, ALPHA_XOR, ALPHA_PLUS, ALPHA_OVER_PREMUL, ALPHA_IN_PREMUL, ALPHA_OUT_PREMUL,
    160        ALPHA_ATOP_PREMUL, ALPHA_XOR_PREMUL, ALPHA_PLUS_PREMUL, ALPHA_PREMUL};
    161 
    162 /** @brief Composites two images using alpha opacity values contained in each image.
    163 
    164 @param img1 First image. Supports CV_8UC4 , CV_16UC4 , CV_32SC4 and CV_32FC4 types.
    165 @param img2 Second image. Must have the same size and the same type as img1 .
    166 @param dst Destination image.
    167 @param alpha_op Flag specifying the alpha-blending operation:
    168 -   **ALPHA_OVER**
    169 -   **ALPHA_IN**
    170 -   **ALPHA_OUT**
    171 -   **ALPHA_ATOP**
    172 -   **ALPHA_XOR**
    173 -   **ALPHA_PLUS**
    174 -   **ALPHA_OVER_PREMUL**
    175 -   **ALPHA_IN_PREMUL**
    176 -   **ALPHA_OUT_PREMUL**
    177 -   **ALPHA_ATOP_PREMUL**
    178 -   **ALPHA_XOR_PREMUL**
    179 -   **ALPHA_PLUS_PREMUL**
    180 -   **ALPHA_PREMUL**
    181 @param stream Stream for the asynchronous version.
    182 
    183 @note
    184    -   An example demonstrating the use of alphaComp can be found at
    185         opencv_source_code/samples/gpu/alpha_comp.cpp
    186  */
    187 CV_EXPORTS void alphaComp(InputArray img1, InputArray img2, OutputArray dst, int alpha_op, Stream& stream = Stream::Null());
    188 
    189 //! @} cudaimgproc_color
    190 
    191 ////////////////////////////// Histogram ///////////////////////////////
    192 
    193 //! @addtogroup cudaimgproc_hist
    194 //! @{
    195 
    196 /** @brief Calculates histogram for one channel 8-bit image.
    197 
    198 @param src Source image with CV_8UC1 type.
    199 @param hist Destination histogram with one row, 256 columns, and the CV_32SC1 type.
    200 @param stream Stream for the asynchronous version.
    201  */
    202 CV_EXPORTS void calcHist(InputArray src, OutputArray hist, Stream& stream = Stream::Null());
    203 
    204 /** @brief Equalizes the histogram of a grayscale image.
    205 
    206 @param src Source image with CV_8UC1 type.
    207 @param dst Destination image.
    208 @param stream Stream for the asynchronous version.
    209 
    210 @sa equalizeHist
    211  */
    212 CV_EXPORTS void equalizeHist(InputArray src, OutputArray dst, Stream& stream = Stream::Null());
    213 
    214 /** @brief Base class for Contrast Limited Adaptive Histogram Equalization. :
    215  */
    216 class CV_EXPORTS CLAHE : public cv::CLAHE
    217 {
    218 public:
    219     using cv::CLAHE::apply;
    220     /** @brief Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
    221 
    222     @param src Source image with CV_8UC1 type.
    223     @param dst Destination image.
    224     @param stream Stream for the asynchronous version.
    225      */
    226     virtual void apply(InputArray src, OutputArray dst, Stream& stream) = 0;
    227 };
    228 
    229 /** @brief Creates implementation for cuda::CLAHE .
    230 
    231 @param clipLimit Threshold for contrast limiting.
    232 @param tileGridSize Size of grid for histogram equalization. Input image will be divided into
    233 equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
    234  */
    235 CV_EXPORTS Ptr<cuda::CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
    236 
    237 /** @brief Computes levels with even distribution.
    238 
    239 @param levels Destination array. levels has 1 row, nLevels columns, and the CV_32SC1 type.
    240 @param nLevels Number of computed levels. nLevels must be at least 2.
    241 @param lowerLevel Lower boundary value of the lowest level.
    242 @param upperLevel Upper boundary value of the greatest level.
    243 @param stream Stream for the asynchronous version.
    244  */
    245 CV_EXPORTS void evenLevels(OutputArray levels, int nLevels, int lowerLevel, int upperLevel, Stream& stream = Stream::Null());
    246 
    247 /** @brief Calculates a histogram with evenly distributed bins.
    248 
    249 @param src Source image. CV_8U, CV_16U, or CV_16S depth and 1 or 4 channels are supported. For
    250 a four-channel image, all channels are processed separately.
    251 @param hist Destination histogram with one row, histSize columns, and the CV_32S type.
    252 @param histSize Size of the histogram.
    253 @param lowerLevel Lower boundary of lowest-level bin.
    254 @param upperLevel Upper boundary of highest-level bin.
    255 @param stream Stream for the asynchronous version.
    256  */
    257 CV_EXPORTS void histEven(InputArray src, OutputArray hist, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null());
    258 /** @overload */
    259 CV_EXPORTS void histEven(InputArray src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null());
    260 
    261 /** @brief Calculates a histogram with bins determined by the levels array.
    262 
    263 @param src Source image. CV_8U , CV_16U , or CV_16S depth and 1 or 4 channels are supported.
    264 For a four-channel image, all channels are processed separately.
    265 @param hist Destination histogram with one row, (levels.cols-1) columns, and the CV_32SC1 type.
    266 @param levels Number of levels in the histogram.
    267 @param stream Stream for the asynchronous version.
    268  */
    269 CV_EXPORTS void histRange(InputArray src, OutputArray hist, InputArray levels, Stream& stream = Stream::Null());
    270 /** @overload */
    271 CV_EXPORTS void histRange(InputArray src, GpuMat hist[4], const GpuMat levels[4], Stream& stream = Stream::Null());
    272 
    273 //! @} cudaimgproc_hist
    274 
    275 //////////////////////////////// Canny ////////////////////////////////
    276 
    277 /** @brief Base class for Canny Edge Detector. :
    278  */
    279 class CV_EXPORTS CannyEdgeDetector : public Algorithm
    280 {
    281 public:
    282     /** @brief Finds edges in an image using the @cite Canny86 algorithm.
    283 
    284     @param image Single-channel 8-bit input image.
    285     @param edges Output edge map. It has the same size and type as image.
    286     @param stream Stream for the asynchronous version.
    287      */
    288     virtual void detect(InputArray image, OutputArray edges, Stream& stream = Stream::Null()) = 0;
    289     /** @overload
    290     @param dx First derivative of image in the vertical direction. Support only CV_32S type.
    291     @param dy First derivative of image in the horizontal direction. Support only CV_32S type.
    292     @param edges Output edge map. It has the same size and type as image.
    293     @param stream Stream for the asynchronous version.
    294     */
    295     virtual void detect(InputArray dx, InputArray dy, OutputArray edges, Stream& stream = Stream::Null()) = 0;
    296 
    297     virtual void setLowThreshold(double low_thresh) = 0;
    298     virtual double getLowThreshold() const = 0;
    299 
    300     virtual void setHighThreshold(double high_thresh) = 0;
    301     virtual double getHighThreshold() const = 0;
    302 
    303     virtual void setAppertureSize(int apperture_size) = 0;
    304     virtual int getAppertureSize() const = 0;
    305 
    306     virtual void setL2Gradient(bool L2gradient) = 0;
    307     virtual bool getL2Gradient() const = 0;
    308 };
    309 
    310 /** @brief Creates implementation for cuda::CannyEdgeDetector .
    311 
    312 @param low_thresh First threshold for the hysteresis procedure.
    313 @param high_thresh Second threshold for the hysteresis procedure.
    314 @param apperture_size Aperture size for the Sobel operator.
    315 @param L2gradient Flag indicating whether a more accurate \f$L_2\f$ norm
    316 \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to compute the image gradient magnitude (
    317 L2gradient=true ), or a faster default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( L2gradient=false
    318 ).
    319  */
    320 CV_EXPORTS Ptr<CannyEdgeDetector> createCannyEdgeDetector(double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false);
    321 
    322 /////////////////////////// Hough Transform ////////////////////////////
    323 
    324 //////////////////////////////////////
    325 // HoughLines
    326 
    327 //! @addtogroup cudaimgproc_hough
    328 //! @{
    329 
    330 /** @brief Base class for lines detector algorithm. :
    331  */
    332 class CV_EXPORTS HoughLinesDetector : public Algorithm
    333 {
    334 public:
    335     /** @brief Finds lines in a binary image using the classical Hough transform.
    336 
    337     @param src 8-bit, single-channel binary source image.
    338     @param lines Output vector of lines. Each line is represented by a two-element vector
    339     \f$(\rho, \theta)\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of
    340     the image). \f$\theta\f$ is the line rotation angle in radians (
    341     \f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ).
    342     @param stream Stream for the asynchronous version.
    343 
    344     @sa HoughLines
    345      */
    346     virtual void detect(InputArray src, OutputArray lines, Stream& stream = Stream::Null()) = 0;
    347 
    348     /** @brief Downloads results from cuda::HoughLinesDetector::detect to host memory.
    349 
    350     @param d_lines Result of cuda::HoughLinesDetector::detect .
    351     @param h_lines Output host array.
    352     @param h_votes Optional output array for line's votes.
    353     @param stream Stream for the asynchronous version.
    354      */
    355     virtual void downloadResults(InputArray d_lines, OutputArray h_lines, OutputArray h_votes = noArray(), Stream& stream = Stream::Null()) = 0;
    356 
    357     virtual void setRho(float rho) = 0;
    358     virtual float getRho() const = 0;
    359 
    360     virtual void setTheta(float theta) = 0;
    361     virtual float getTheta() const = 0;
    362 
    363     virtual void setThreshold(int threshold) = 0;
    364     virtual int getThreshold() const = 0;
    365 
    366     virtual void setDoSort(bool doSort) = 0;
    367     virtual bool getDoSort() const = 0;
    368 
    369     virtual void setMaxLines(int maxLines) = 0;
    370     virtual int getMaxLines() const = 0;
    371 };
    372 
    373 /** @brief Creates implementation for cuda::HoughLinesDetector .
    374 
    375 @param rho Distance resolution of the accumulator in pixels.
    376 @param theta Angle resolution of the accumulator in radians.
    377 @param threshold Accumulator threshold parameter. Only those lines are returned that get enough
    378 votes ( \f$>\texttt{threshold}\f$ ).
    379 @param doSort Performs lines sort by votes.
    380 @param maxLines Maximum number of output lines.
    381  */
    382 CV_EXPORTS Ptr<HoughLinesDetector> createHoughLinesDetector(float rho, float theta, int threshold, bool doSort = false, int maxLines = 4096);
    383 
    384 
    385 //////////////////////////////////////
    386 // HoughLinesP
    387 
    388 /** @brief Base class for line segments detector algorithm. :
    389  */
    390 class CV_EXPORTS HoughSegmentDetector : public Algorithm
    391 {
    392 public:
    393     /** @brief Finds line segments in a binary image using the probabilistic Hough transform.
    394 
    395     @param src 8-bit, single-channel binary source image.
    396     @param lines Output vector of lines. Each line is represented by a 4-element vector
    397     \f$(x_1, y_1, x_2, y_2)\f$ , where \f$(x_1,y_1)\f$ and \f$(x_2, y_2)\f$ are the ending points of each detected
    398     line segment.
    399     @param stream Stream for the asynchronous version.
    400 
    401     @sa HoughLinesP
    402      */
    403     virtual void detect(InputArray src, OutputArray lines, Stream& stream = Stream::Null()) = 0;
    404 
    405     virtual void setRho(float rho) = 0;
    406     virtual float getRho() const = 0;
    407 
    408     virtual void setTheta(float theta) = 0;
    409     virtual float getTheta() const = 0;
    410 
    411     virtual void setMinLineLength(int minLineLength) = 0;
    412     virtual int getMinLineLength() const = 0;
    413 
    414     virtual void setMaxLineGap(int maxLineGap) = 0;
    415     virtual int getMaxLineGap() const = 0;
    416 
    417     virtual void setMaxLines(int maxLines) = 0;
    418     virtual int getMaxLines() const = 0;
    419 };
    420 
    421 /** @brief Creates implementation for cuda::HoughSegmentDetector .
    422 
    423 @param rho Distance resolution of the accumulator in pixels.
    424 @param theta Angle resolution of the accumulator in radians.
    425 @param minLineLength Minimum line length. Line segments shorter than that are rejected.
    426 @param maxLineGap Maximum allowed gap between points on the same line to link them.
    427 @param maxLines Maximum number of output lines.
    428  */
    429 CV_EXPORTS Ptr<HoughSegmentDetector> createHoughSegmentDetector(float rho, float theta, int minLineLength, int maxLineGap, int maxLines = 4096);
    430 
    431 //////////////////////////////////////
    432 // HoughCircles
    433 
    434 /** @brief Base class for circles detector algorithm. :
    435  */
    436 class CV_EXPORTS HoughCirclesDetector : public Algorithm
    437 {
    438 public:
    439     /** @brief Finds circles in a grayscale image using the Hough transform.
    440 
    441     @param src 8-bit, single-channel grayscale input image.
    442     @param circles Output vector of found circles. Each vector is encoded as a 3-element
    443     floating-point vector \f$(x, y, radius)\f$ .
    444     @param stream Stream for the asynchronous version.
    445 
    446     @sa HoughCircles
    447      */
    448     virtual void detect(InputArray src, OutputArray circles, Stream& stream = Stream::Null()) = 0;
    449 
    450     virtual void setDp(float dp) = 0;
    451     virtual float getDp() const = 0;
    452 
    453     virtual void setMinDist(float minDist) = 0;
    454     virtual float getMinDist() const = 0;
    455 
    456     virtual void setCannyThreshold(int cannyThreshold) = 0;
    457     virtual int getCannyThreshold() const = 0;
    458 
    459     virtual void setVotesThreshold(int votesThreshold) = 0;
    460     virtual int getVotesThreshold() const = 0;
    461 
    462     virtual void setMinRadius(int minRadius) = 0;
    463     virtual int getMinRadius() const = 0;
    464 
    465     virtual void setMaxRadius(int maxRadius) = 0;
    466     virtual int getMaxRadius() const = 0;
    467 
    468     virtual void setMaxCircles(int maxCircles) = 0;
    469     virtual int getMaxCircles() const = 0;
    470 };
    471 
    472 /** @brief Creates implementation for cuda::HoughCirclesDetector .
    473 
    474 @param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
    475 dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
    476 half as big width and height.
    477 @param minDist Minimum distance between the centers of the detected circles. If the parameter is
    478 too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
    479 too large, some circles may be missed.
    480 @param cannyThreshold The higher threshold of the two passed to Canny edge detector (the lower one
    481 is twice smaller).
    482 @param votesThreshold The accumulator threshold for the circle centers at the detection stage. The
    483 smaller it is, the more false circles may be detected.
    484 @param minRadius Minimum circle radius.
    485 @param maxRadius Maximum circle radius.
    486 @param maxCircles Maximum number of output circles.
    487  */
    488 CV_EXPORTS Ptr<HoughCirclesDetector> createHoughCirclesDetector(float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096);
    489 
    490 //////////////////////////////////////
    491 // GeneralizedHough
    492 
    493 /** @brief Creates implementation for generalized hough transform from @cite Ballard1981 .
    494  */
    495 CV_EXPORTS Ptr<GeneralizedHoughBallard> createGeneralizedHoughBallard();
    496 
    497 /** @brief Creates implementation for generalized hough transform from @cite Guil1999 .
    498  */
    499 CV_EXPORTS Ptr<GeneralizedHoughGuil> createGeneralizedHoughGuil();
    500 
    501 //! @} cudaimgproc_hough
    502 
    503 ////////////////////////// Corners Detection ///////////////////////////
    504 
    505 //! @addtogroup cudaimgproc_feature
    506 //! @{
    507 
    508 /** @brief Base class for Cornerness Criteria computation. :
    509  */
    510 class CV_EXPORTS CornernessCriteria : public Algorithm
    511 {
    512 public:
    513     /** @brief Computes the cornerness criteria at each image pixel.
    514 
    515     @param src Source image.
    516     @param dst Destination image containing cornerness values. It will have the same size as src and
    517     CV_32FC1 type.
    518     @param stream Stream for the asynchronous version.
    519      */
    520     virtual void compute(InputArray src, OutputArray dst, Stream& stream = Stream::Null()) = 0;
    521 };
    522 
    523 /** @brief Creates implementation for Harris cornerness criteria.
    524 
    525 @param srcType Input source type. Only CV_8UC1 and CV_32FC1 are supported for now.
    526 @param blockSize Neighborhood size.
    527 @param ksize Aperture parameter for the Sobel operator.
    528 @param k Harris detector free parameter.
    529 @param borderType Pixel extrapolation method. Only BORDER_REFLECT101 and BORDER_REPLICATE are
    530 supported for now.
    531 
    532 @sa cornerHarris
    533  */
    534 CV_EXPORTS Ptr<CornernessCriteria> createHarrisCorner(int srcType, int blockSize, int ksize, double k, int borderType = BORDER_REFLECT101);
    535 
    536 /** @brief Creates implementation for the minimum eigen value of a 2x2 derivative covariation matrix (the
    537 cornerness criteria).
    538 
    539 @param srcType Input source type. Only CV_8UC1 and CV_32FC1 are supported for now.
    540 @param blockSize Neighborhood size.
    541 @param ksize Aperture parameter for the Sobel operator.
    542 @param borderType Pixel extrapolation method. Only BORDER_REFLECT101 and BORDER_REPLICATE are
    543 supported for now.
    544 
    545 @sa cornerMinEigenVal
    546  */
    547 CV_EXPORTS Ptr<CornernessCriteria> createMinEigenValCorner(int srcType, int blockSize, int ksize, int borderType = BORDER_REFLECT101);
    548 
    549 ////////////////////////// Corners Detection ///////////////////////////
    550 
    551 /** @brief Base class for Corners Detector. :
    552  */
    553 class CV_EXPORTS CornersDetector : public Algorithm
    554 {
    555 public:
    556     /** @brief Determines strong corners on an image.
    557 
    558     @param image Input 8-bit or floating-point 32-bit, single-channel image.
    559     @param corners Output vector of detected corners (1-row matrix with CV_32FC2 type with corners
    560     positions).
    561     @param mask Optional region of interest. If the image is not empty (it needs to have the type
    562     CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
    563     @param stream Stream for the asynchronous version.
    564      */
    565     virtual void detect(InputArray image, OutputArray corners, InputArray mask = noArray(), Stream& stream = Stream::Null()) = 0;
    566 };
    567 
    568 /** @brief Creates implementation for cuda::CornersDetector .
    569 
    570 @param srcType Input source type. Only CV_8UC1 and CV_32FC1 are supported for now.
    571 @param maxCorners Maximum number of corners to return. If there are more corners than are found,
    572 the strongest of them is returned.
    573 @param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
    574 parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
    575 (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the
    576 quality measure less than the product are rejected. For example, if the best corner has the
    577 quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
    578 less than 15 are rejected.
    579 @param minDistance Minimum possible Euclidean distance between the returned corners.
    580 @param blockSize Size of an average block for computing a derivative covariation matrix over each
    581 pixel neighborhood. See cornerEigenValsAndVecs .
    582 @param useHarrisDetector Parameter indicating whether to use a Harris detector (see cornerHarris)
    583 or cornerMinEigenVal.
    584 @param harrisK Free parameter of the Harris detector.
    585  */
    586 CV_EXPORTS Ptr<CornersDetector> createGoodFeaturesToTrackDetector(int srcType, int maxCorners = 1000, double qualityLevel = 0.01, double minDistance = 0.0,
    587                                                                   int blockSize = 3, bool useHarrisDetector = false, double harrisK = 0.04);
    588 
    589 //! @} cudaimgproc_feature
    590 
    591 ///////////////////////////// Mean Shift //////////////////////////////
    592 
    593 /** @brief Performs mean-shift filtering for each point of the source image.
    594 
    595 @param src Source image. Only CV_8UC4 images are supported for now.
    596 @param dst Destination image containing the color of mapped points. It has the same size and type
    597 as src .
    598 @param sp Spatial window radius.
    599 @param sr Color window radius.
    600 @param criteria Termination criteria. See TermCriteria.
    601 @param stream Stream for the asynchronous version.
    602 
    603 It maps each point of the source image into another point. As a result, you have a new color and new
    604 position of each point.
    605  */
    606 CV_EXPORTS void meanShiftFiltering(InputArray src, OutputArray dst, int sp, int sr,
    607                                    TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1),
    608                                    Stream& stream = Stream::Null());
    609 
    610 /** @brief Performs a mean-shift procedure and stores information about processed points (their colors and
    611 positions) in two images.
    612 
    613 @param src Source image. Only CV_8UC4 images are supported for now.
    614 @param dstr Destination image containing the color of mapped points. The size and type is the same
    615 as src .
    616 @param dstsp Destination image containing the position of mapped points. The size is the same as
    617 src size. The type is CV_16SC2 .
    618 @param sp Spatial window radius.
    619 @param sr Color window radius.
    620 @param criteria Termination criteria. See TermCriteria.
    621 @param stream Stream for the asynchronous version.
    622 
    623 @sa cuda::meanShiftFiltering
    624  */
    625 CV_EXPORTS void meanShiftProc(InputArray src, OutputArray dstr, OutputArray dstsp, int sp, int sr,
    626                               TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1),
    627                               Stream& stream = Stream::Null());
    628 
    629 /** @brief Performs a mean-shift segmentation of the source image and eliminates small segments.
    630 
    631 @param src Source image. Only CV_8UC4 images are supported for now.
    632 @param dst Segmented image with the same size and type as src (host memory).
    633 @param sp Spatial window radius.
    634 @param sr Color window radius.
    635 @param minsize Minimum segment size. Smaller segments are merged.
    636 @param criteria Termination criteria. See TermCriteria.
    637 @param stream Stream for the asynchronous version.
    638  */
    639 CV_EXPORTS void meanShiftSegmentation(InputArray src, OutputArray dst, int sp, int sr, int minsize,
    640                                       TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1),
    641                                       Stream& stream = Stream::Null());
    642 
    643 /////////////////////////// Match Template ////////////////////////////
    644 
    645 /** @brief Base class for Template Matching. :
    646  */
    647 class CV_EXPORTS TemplateMatching : public Algorithm
    648 {
    649 public:
    650     /** @brief Computes a proximity map for a raster template and an image where the template is searched for.
    651 
    652     @param image Source image.
    653     @param templ Template image with the size and type the same as image .
    654     @param result Map containing comparison results ( CV_32FC1 ). If image is *W x H* and templ is *w
    655     x h*, then result must be *W-w+1 x H-h+1*.
    656     @param stream Stream for the asynchronous version.
    657      */
    658     virtual void match(InputArray image, InputArray templ, OutputArray result, Stream& stream = Stream::Null()) = 0;
    659 };
    660 
    661 /** @brief Creates implementation for cuda::TemplateMatching .
    662 
    663 @param srcType Input source type. CV_32F and CV_8U depth images (1..4 channels) are supported
    664 for now.
    665 @param method Specifies the way to compare the template with the image.
    666 @param user_block_size You can use field user_block_size to set specific block size. If you
    667 leave its default value Size(0,0) then automatic estimation of block size will be used (which is
    668 optimized for speed). By varying user_block_size you can reduce memory requirements at the cost
    669 of speed.
    670 
    671 The following methods are supported for the CV_8U depth images for now:
    672 
    673 -   CV_TM_SQDIFF
    674 -   CV_TM_SQDIFF_NORMED
    675 -   CV_TM_CCORR
    676 -   CV_TM_CCORR_NORMED
    677 -   CV_TM_CCOEFF
    678 -   CV_TM_CCOEFF_NORMED
    679 
    680 The following methods are supported for the CV_32F images for now:
    681 
    682 -   CV_TM_SQDIFF
    683 -   CV_TM_CCORR
    684 
    685 @sa matchTemplate
    686  */
    687 CV_EXPORTS Ptr<TemplateMatching> createTemplateMatching(int srcType, int method, Size user_block_size = Size());
    688 
    689 ////////////////////////// Bilateral Filter ///////////////////////////
    690 
    691 /** @brief Performs bilateral filtering of passed image
    692 
    693 @param src Source image. Supports only (channles != 2 && depth() != CV_8S && depth() != CV_32S
    694 && depth() != CV_64F).
    695 @param dst Destination imagwe.
    696 @param kernel_size Kernel window size.
    697 @param sigma_color Filter sigma in the color space.
    698 @param sigma_spatial Filter sigma in the coordinate space.
    699 @param borderMode Border type. See borderInterpolate for details. BORDER_REFLECT101 ,
    700 BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.
    701 @param stream Stream for the asynchronous version.
    702 
    703 @sa bilateralFilter
    704  */
    705 CV_EXPORTS void bilateralFilter(InputArray src, OutputArray dst, int kernel_size, float sigma_color, float sigma_spatial,
    706                                 int borderMode = BORDER_DEFAULT, Stream& stream = Stream::Null());
    707 
    708 ///////////////////////////// Blending ////////////////////////////////
    709 
    710 /** @brief Performs linear blending of two images.
    711 
    712 @param img1 First image. Supports only CV_8U and CV_32F depth.
    713 @param img2 Second image. Must have the same size and the same type as img1 .
    714 @param weights1 Weights for first image. Must have tha same size as img1 . Supports only CV_32F
    715 type.
    716 @param weights2 Weights for second image. Must have tha same size as img2 . Supports only CV_32F
    717 type.
    718 @param result Destination image.
    719 @param stream Stream for the asynchronous version.
    720  */
    721 CV_EXPORTS void blendLinear(InputArray img1, InputArray img2, InputArray weights1, InputArray weights2,
    722                             OutputArray result, Stream& stream = Stream::Null());
    723 
    724 //! @}
    725 
    726 }} // namespace cv { namespace cuda {
    727 
    728 #endif /* __OPENCV_CUDAIMGPROC_HPP__ */
    729