• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CUDAWARPING_HPP__
44 #define __OPENCV_CUDAWARPING_HPP__
45 
46 #ifndef __cplusplus
47 #  error cudawarping.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 cudawarping Image Warping
57   @}
58  */
59 
60 namespace cv { namespace cuda {
61 
62 //! @addtogroup cudawarping
63 //! @{
64 
65 /** @brief Applies a generic geometrical transformation to an image.
66 
67 @param src Source image.
68 @param dst Destination image with the size the same as xmap and the type the same as src .
69 @param xmap X values. Only CV_32FC1 type is supported.
70 @param ymap Y values. Only CV_32FC1 type is supported.
71 @param interpolation Interpolation method (see resize ). INTER_NEAREST , INTER_LINEAR and
72 INTER_CUBIC are supported for now.
73 @param borderMode Pixel extrapolation method (see borderInterpolate ). BORDER_REFLECT101 ,
74 BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.
75 @param borderValue Value used in case of a constant border. By default, it is 0.
76 @param stream Stream for the asynchronous version.
77 
78 The function transforms the source image using the specified map:
79 
80 \f[\texttt{dst} (x,y) =  \texttt{src} (xmap(x,y), ymap(x,y))\f]
81 
82 Values of pixels with non-integer coordinates are computed using the bilinear interpolation.
83 
84 @sa remap
85  */
86 CV_EXPORTS void remap(InputArray src, OutputArray dst, InputArray xmap, InputArray ymap,
87                       int interpolation, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar(),
88                       Stream& stream = Stream::Null());
89 
90 /** @brief Resizes an image.
91 
92 @param src Source image.
93 @param dst Destination image with the same type as src . The size is dsize (when it is non-zero)
94 or the size is computed from src.size() , fx , and fy .
95 @param dsize Destination image size. If it is zero, it is computed as:
96 \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f]
97 Either dsize or both fx and fy must be non-zero.
98 @param fx Scale factor along the horizontal axis. If it is zero, it is computed as:
99 \f[\texttt{(double)dsize.width/src.cols}\f]
100 @param fy Scale factor along the vertical axis. If it is zero, it is computed as:
101 \f[\texttt{(double)dsize.height/src.rows}\f]
102 @param interpolation Interpolation method. INTER_NEAREST , INTER_LINEAR and INTER_CUBIC are
103 supported for now.
104 @param stream Stream for the asynchronous version.
105 
106 @sa resize
107  */
108 CV_EXPORTS void resize(InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null());
109 
110 /** @brief Applies an affine transformation to an image.
111 
112 @param src Source image. CV_8U , CV_16U , CV_32S , or CV_32F depth and 1, 3, or 4 channels are
113 supported.
114 @param dst Destination image with the same type as src . The size is dsize .
115 @param M *2x3* transformation matrix.
116 @param dsize Size of the destination image.
117 @param flags Combination of interpolation methods (see resize) and the optional flag
118 WARP_INVERSE_MAP specifying that M is an inverse transformation ( dst=\>src ). Only
119 INTER_NEAREST , INTER_LINEAR , and INTER_CUBIC interpolation methods are supported.
120 @param borderMode
121 @param borderValue
122 @param stream Stream for the asynchronous version.
123 
124 @sa warpAffine
125  */
126 CV_EXPORTS void warpAffine(InputArray src, OutputArray dst, InputArray M, Size dsize, int flags = INTER_LINEAR,
127     int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar(), Stream& stream = Stream::Null());
128 
129 /** @brief Builds transformation maps for affine transformation.
130 
131 @param M *2x3* transformation matrix.
132 @param inverse Flag specifying that M is an inverse transformation ( dst=\>src ).
133 @param dsize Size of the destination image.
134 @param xmap X values with CV_32FC1 type.
135 @param ymap Y values with CV_32FC1 type.
136 @param stream Stream for the asynchronous version.
137 
138 @sa cuda::warpAffine , cuda::remap
139  */
140 CV_EXPORTS void buildWarpAffineMaps(InputArray M, bool inverse, Size dsize, OutputArray xmap, OutputArray ymap, Stream& stream = Stream::Null());
141 
142 /** @brief Applies a perspective transformation to an image.
143 
144 @param src Source image. CV_8U , CV_16U , CV_32S , or CV_32F depth and 1, 3, or 4 channels are
145 supported.
146 @param dst Destination image with the same type as src . The size is dsize .
147 @param M *3x3* transformation matrix.
148 @param dsize Size of the destination image.
149 @param flags Combination of interpolation methods (see resize ) and the optional flag
150 WARP_INVERSE_MAP specifying that M is the inverse transformation ( dst =\> src ). Only
151 INTER_NEAREST , INTER_LINEAR , and INTER_CUBIC interpolation methods are supported.
152 @param borderMode
153 @param borderValue
154 @param stream Stream for the asynchronous version.
155 
156 @sa warpPerspective
157  */
158 CV_EXPORTS void warpPerspective(InputArray src, OutputArray dst, InputArray M, Size dsize, int flags = INTER_LINEAR,
159     int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar(), Stream& stream = Stream::Null());
160 
161 /** @brief Builds transformation maps for perspective transformation.
162 
163 @param M *3x3* transformation matrix.
164 @param inverse Flag specifying that M is an inverse transformation ( dst=\>src ).
165 @param dsize Size of the destination image.
166 @param xmap X values with CV_32FC1 type.
167 @param ymap Y values with CV_32FC1 type.
168 @param stream Stream for the asynchronous version.
169 
170 @sa cuda::warpPerspective , cuda::remap
171  */
172 CV_EXPORTS void buildWarpPerspectiveMaps(InputArray M, bool inverse, Size dsize, OutputArray xmap, OutputArray ymap, Stream& stream = Stream::Null());
173 
174 /** @brief Rotates an image around the origin (0,0) and then shifts it.
175 
176 @param src Source image. Supports 1, 3 or 4 channels images with CV_8U , CV_16U or CV_32F
177 depth.
178 @param dst Destination image with the same type as src . The size is dsize .
179 @param dsize Size of the destination image.
180 @param angle Angle of rotation in degrees.
181 @param xShift Shift along the horizontal axis.
182 @param yShift Shift along the vertical axis.
183 @param interpolation Interpolation method. Only INTER_NEAREST , INTER_LINEAR , and INTER_CUBIC
184 are supported.
185 @param stream Stream for the asynchronous version.
186 
187 @sa cuda::warpAffine
188  */
189 CV_EXPORTS void rotate(InputArray src, OutputArray dst, Size dsize, double angle, double xShift = 0, double yShift = 0,
190                        int interpolation = INTER_LINEAR, Stream& stream = Stream::Null());
191 
192 /** @brief Smoothes an image and downsamples it.
193 
194 @param src Source image.
195 @param dst Destination image. Will have Size((src.cols+1)/2, (src.rows+1)/2) size and the same
196 type as src .
197 @param stream Stream for the asynchronous version.
198 
199 @sa pyrDown
200  */
201 CV_EXPORTS void pyrDown(InputArray src, OutputArray dst, Stream& stream = Stream::Null());
202 
203 /** @brief Upsamples an image and then smoothes it.
204 
205 @param src Source image.
206 @param dst Destination image. Will have Size(src.cols\*2, src.rows\*2) size and the same type as
207 src .
208 @param stream Stream for the asynchronous version.
209  */
210 CV_EXPORTS void pyrUp(InputArray src, OutputArray dst, Stream& stream = Stream::Null());
211 
212 //! @}
213 
214 }} // namespace cv { namespace cuda {
215 
216 #endif /* __OPENCV_CUDAWARPING_HPP__ */
217