1
/*M///////////////////////////////////////////////////////////////////////////////////////
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
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.
11
// For Open Source Computer Vision Library
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.
17
// Redistribution and use in source and binary forms, with or without modification,
18
// are permitted provided that the following conditions are met:
20
// * Redistribution's of source code must retain the above copyright notice,
21
// this list of conditions and the following disclaimer.
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.
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.
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.
43
#ifndef __OPENCV_CUDAIMGPROC_HPP__
44
#define __OPENCV_CUDAIMGPROC_HPP__
47
# error cudaimgproc.hpp header must be compiled as C++
50
#include "opencv2/core/cuda.hpp"
51
#include "opencv2/imgproc.hpp"
56
@defgroup cudaimgproc Image Processing
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
66
namespace cv { namespace cuda {
68
//! @addtogroup cudaimgproc
71
/////////////////////////// Color Processing ///////////////////////////
73
//! @addtogroup cudaimgproc_color
76
/** @brief Converts an image from one color space to another.
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.
85
3-channel color spaces (like HSV, XYZ, and so on) can be stored in a 4-channel image for better
90
CV_EXPORTS void cvtColor(InputArray src, OutputArray dst, int code, int dcn = 0, Stream& stream = Stream::Null());
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,
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,
105
COLOR_BayerBG2GRAY_MHT = 260,
106
COLOR_BayerGB2GRAY_MHT = 261,
107
COLOR_BayerRG2GRAY_MHT = 262,
108
COLOR_BayerGR2GRAY_MHT = 263
111
/** @brief Converts an image from Bayer pattern to RGB or grayscale.
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.
120
The function can do the following transformations:
122
- Demosaicing using bilinear interpolation
124
> - COLOR_BayerBG2GRAY , COLOR_BayerGB2GRAY , COLOR_BayerRG2GRAY , COLOR_BayerGR2GRAY
125
> - COLOR_BayerBG2BGR , COLOR_BayerGB2BGR , COLOR_BayerRG2BGR , COLOR_BayerGR2BGR
127
- Demosaicing using Malvar-He-Cutler algorithm (@cite MHT2011)
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
136
CV_EXPORTS void demosaicing(InputArray src, OutputArray dst, int code, int dcn = -1, Stream& stream = Stream::Null());
138
/** @brief Exchanges the color channels of an image in-place.
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.
146
The methods support arbitrary permutations of the original channels, including replication.
148
CV_EXPORTS void swapChannels(InputOutputArray image, const int dstOrder[4], Stream& stream = Stream::Null());
150
/** @brief Routines for correcting image color gamma.
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.
157
CV_EXPORTS void gammaCorrection(InputArray src, OutputArray dst, bool forward = true, Stream& stream = Stream::Null());
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};
162
/** @brief Composites two images using alpha opacity values contained in each image.
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:
174
- **ALPHA_OVER_PREMUL**
175
- **ALPHA_IN_PREMUL**
176
- **ALPHA_OUT_PREMUL**
177
- **ALPHA_ATOP_PREMUL**
178
- **ALPHA_XOR_PREMUL**
179
- **ALPHA_PLUS_PREMUL**
181
@param stream Stream for the asynchronous version.
184
- An example demonstrating the use of alphaComp can be found at
185
opencv_source_code/samples/gpu/alpha_comp.cpp
187
CV_EXPORTS void alphaComp(InputArray img1, InputArray img2, OutputArray dst, int alpha_op, Stream& stream = Stream::Null());
189
//! @} cudaimgproc_color
191
////////////////////////////// Histogram ///////////////////////////////
193
//! @addtogroup cudaimgproc_hist
196
/** @brief Calculates histogram for one channel 8-bit image.
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.
202
CV_EXPORTS void calcHist(InputArray src, OutputArray hist, Stream& stream = Stream::Null());
204
/** @brief Equalizes the histogram of a grayscale image.
206
@param src Source image with CV_8UC1 type.
207
@param dst Destination image.
208
@param stream Stream for the asynchronous version.
212
CV_EXPORTS void equalizeHist(InputArray src, OutputArray dst, Stream& stream = Stream::Null());
214
/** @brief Base class for Contrast Limited Adaptive Histogram Equalization. :
216
class CV_EXPORTS CLAHE : public cv::CLAHE
219
using cv::CLAHE::apply;
220
/** @brief Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
222
@param src Source image with CV_8UC1 type.
223
@param dst Destination image.
224
@param stream Stream for the asynchronous version.
226
virtual void apply(InputArray src, OutputArray dst, Stream& stream) = 0;
229
/** @brief Creates implementation for cuda::CLAHE .
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.
235
CV_EXPORTS Ptr<cuda::CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
237
/** @brief Computes levels with even distribution.
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.
245
CV_EXPORTS void evenLevels(OutputArray levels, int nLevels, int lowerLevel, int upperLevel, Stream& stream = Stream::Null());
247
/** @brief Calculates a histogram with evenly distributed bins.
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.
257
CV_EXPORTS void histEven(InputArray src, OutputArray hist, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null());
259
CV_EXPORTS void histEven(InputArray src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null());
261
/** @brief Calculates a histogram with bins determined by the levels array.
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.
269
CV_EXPORTS void histRange(InputArray src, OutputArray hist, InputArray levels, Stream& stream = Stream::Null());
271
CV_EXPORTS void histRange(InputArray src, GpuMat hist[4], const GpuMat levels[4], Stream& stream = Stream::Null());
273
//! @} cudaimgproc_hist
275
//////////////////////////////// Canny ////////////////////////////////
277
/** @brief Base class for Canny Edge Detector. :
279
class CV_EXPORTS CannyEdgeDetector : public Algorithm
282
/** @brief Finds edges in an image using the @cite Canny86 algorithm.
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.
288
virtual void detect(InputArray image, OutputArray edges, Stream& stream = Stream::Null()) = 0;
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.
295
virtual void detect(InputArray dx, InputArray dy, OutputArray edges, Stream& stream = Stream::Null()) = 0;
297
virtual void setLowThreshold(double low_thresh) = 0;
298
virtual double getLowThreshold() const = 0;
300
virtual void setHighThreshold(double high_thresh) = 0;
301
virtual double getHighThreshold() const = 0;
303
virtual void setAppertureSize(int apperture_size) = 0;
304
virtual int getAppertureSize() const = 0;
306
virtual void setL2Gradient(bool L2gradient) = 0;
307
virtual bool getL2Gradient() const = 0;
310
/** @brief Creates implementation for cuda::CannyEdgeDetector .
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
320
CV_EXPORTS Ptr<CannyEdgeDetector> createCannyEdgeDetector(double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false);
322
/////////////////////////// Hough Transform ////////////////////////////
324
//////////////////////////////////////
327
//! @addtogroup cudaimgproc_hough
330
/** @brief Base class for lines detector algorithm. :
332
class CV_EXPORTS HoughLinesDetector : public Algorithm
335
/** @brief Finds lines in a binary image using the classical Hough transform.
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.
346
virtual void detect(InputArray src, OutputArray lines, Stream& stream = Stream::Null()) = 0;
348
/** @brief Downloads results from cuda::HoughLinesDetector::detect to host memory.
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.
355
virtual void downloadResults(InputArray d_lines, OutputArray h_lines, OutputArray h_votes = noArray(), Stream& stream = Stream::Null()) = 0;
357
virtual void setRho(float rho) = 0;
358
virtual float getRho() const = 0;
360
virtual void setTheta(float theta) = 0;
361
virtual float getTheta() const = 0;
363
virtual void setThreshold(int threshold) = 0;
364
virtual int getThreshold() const = 0;
366
virtual void setDoSort(bool doSort) = 0;
367
virtual bool getDoSort() const = 0;
369
virtual void setMaxLines(int maxLines) = 0;
370
virtual int getMaxLines() const = 0;
373
/** @brief Creates implementation for cuda::HoughLinesDetector .
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.
382
CV_EXPORTS Ptr<HoughLinesDetector> createHoughLinesDetector(float rho, float theta, int threshold, bool doSort = false, int maxLines = 4096);
385
//////////////////////////////////////
388
/** @brief Base class for line segments detector algorithm. :
390
class CV_EXPORTS HoughSegmentDetector : public Algorithm
393
/** @brief Finds line segments in a binary image using the probabilistic Hough transform.
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
399
@param stream Stream for the asynchronous version.
403
virtual void detect(InputArray src, OutputArray lines, Stream& stream = Stream::Null()) = 0;
405
virtual void setRho(float rho) = 0;
406
virtual float getRho() const = 0;
408
virtual void setTheta(float theta) = 0;
409
virtual float getTheta() const = 0;
411
virtual void setMinLineLength(int minLineLength) = 0;
412
virtual int getMinLineLength() const = 0;
414
virtual void setMaxLineGap(int maxLineGap) = 0;
415
virtual int getMaxLineGap() const = 0;
417
virtual void setMaxLines(int maxLines) = 0;
418
virtual int getMaxLines() const = 0;
421
/** @brief Creates implementation for cuda::HoughSegmentDetector .
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.
429
CV_EXPORTS Ptr<HoughSegmentDetector> createHoughSegmentDetector(float rho, float theta, int minLineLength, int maxLineGap, int maxLines = 4096);
431
//////////////////////////////////////
434
/** @brief Base class for circles detector algorithm. :
436
class CV_EXPORTS HoughCirclesDetector : public Algorithm
439
/** @brief Finds circles in a grayscale image using the Hough transform.
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.
448
virtual void detect(InputArray src, OutputArray circles, Stream& stream = Stream::Null()) = 0;
450
virtual void setDp(float dp) = 0;
451
virtual float getDp() const = 0;
453
virtual void setMinDist(float minDist) = 0;
454
virtual float getMinDist() const = 0;
456
virtual void setCannyThreshold(int cannyThreshold) = 0;
457
virtual int getCannyThreshold() const = 0;
459
virtual void setVotesThreshold(int votesThreshold) = 0;
460
virtual int getVotesThreshold() const = 0;
462
virtual void setMinRadius(int minRadius) = 0;
463
virtual int getMinRadius() const = 0;
465
virtual void setMaxRadius(int maxRadius) = 0;
466
virtual int getMaxRadius() const = 0;
468
virtual void setMaxCircles(int maxCircles) = 0;
469
virtual int getMaxCircles() const = 0;
472
/** @brief Creates implementation for cuda::HoughCirclesDetector .
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
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.
488
CV_EXPORTS Ptr<HoughCirclesDetector> createHoughCirclesDetector(float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096);
490
//////////////////////////////////////
493
/** @brief Creates implementation for generalized hough transform from @cite Ballard1981 .
495
CV_EXPORTS Ptr<GeneralizedHoughBallard> createGeneralizedHoughBallard();
497
/** @brief Creates implementation for generalized hough transform from @cite Guil1999 .
499
CV_EXPORTS Ptr<GeneralizedHoughGuil> createGeneralizedHoughGuil();
501
//! @} cudaimgproc_hough
503
////////////////////////// Corners Detection ///////////////////////////
505
//! @addtogroup cudaimgproc_feature
508
/** @brief Base class for Cornerness Criteria computation. :
510
class CV_EXPORTS CornernessCriteria : public Algorithm
513
/** @brief Computes the cornerness criteria at each image pixel.
515
@param src Source image.
516
@param dst Destination image containing cornerness values. It will have the same size as src and
518
@param stream Stream for the asynchronous version.
520
virtual void compute(InputArray src, OutputArray dst, Stream& stream = Stream::Null()) = 0;
523
/** @brief Creates implementation for Harris cornerness criteria.
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
534
CV_EXPORTS Ptr<CornernessCriteria> createHarrisCorner(int srcType, int blockSize, int ksize, double k, int borderType = BORDER_REFLECT101);
536
/** @brief Creates implementation for the minimum eigen value of a 2x2 derivative covariation matrix (the
537
cornerness criteria).
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
545
@sa cornerMinEigenVal
547
CV_EXPORTS Ptr<CornernessCriteria> createMinEigenValCorner(int srcType, int blockSize, int ksize, int borderType = BORDER_REFLECT101);
549
////////////////////////// Corners Detection ///////////////////////////
551
/** @brief Base class for Corners Detector. :
553
class CV_EXPORTS CornersDetector : public Algorithm
556
/** @brief Determines strong corners on an image.
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
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.
565
virtual void detect(InputArray image, OutputArray corners, InputArray mask = noArray(), Stream& stream = Stream::Null()) = 0;
568
/** @brief Creates implementation for cuda::CornersDetector .
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.
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);
589
//! @} cudaimgproc_feature
591
///////////////////////////// Mean Shift //////////////////////////////
593
/** @brief Performs mean-shift filtering for each point of the source image.
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
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.
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.
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());
610
/** @brief Performs a mean-shift procedure and stores information about processed points (their colors and
611
positions) in two images.
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
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.
623
@sa cuda::meanShiftFiltering
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());
629
/** @brief Performs a mean-shift segmentation of the source image and eliminates small segments.
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.
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());
643
/////////////////////////// Match Template ////////////////////////////
645
/** @brief Base class for Template Matching. :
647
class CV_EXPORTS TemplateMatching : public Algorithm
650
/** @brief Computes a proximity map for a raster template and an image where the template is searched for.
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.
658
virtual void match(InputArray image, InputArray templ, OutputArray result, Stream& stream = Stream::Null()) = 0;
661
/** @brief Creates implementation for cuda::TemplateMatching .
663
@param srcType Input source type. CV_32F and CV_8U depth images (1..4 channels) are supported
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
671
The following methods are supported for the CV_8U depth images for now:
674
- CV_TM_SQDIFF_NORMED
678
- CV_TM_CCOEFF_NORMED
680
The following methods are supported for the CV_32F images for now:
687
CV_EXPORTS Ptr<TemplateMatching> createTemplateMatching(int srcType, int method, Size user_block_size = Size());
689
////////////////////////// Bilateral Filter ///////////////////////////
691
/** @brief Performs bilateral filtering of passed image
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.
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());
708
///////////////////////////// Blending ////////////////////////////////
710
/** @brief Performs linear blending of two images.
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
716
@param weights2 Weights for second image. Must have tha same size as img2 . Supports only CV_32F
718
@param result Destination image.
719
@param stream Stream for the asynchronous version.
721
CV_EXPORTS void blendLinear(InputArray img1, InputArray img2, InputArray weights1, InputArray weights2,
722
OutputArray result, Stream& stream = Stream::Null());
726
}} // namespace cv { namespace cuda {
728
#endif /* __OPENCV_CUDAIMGPROC_HPP__ */