parent
71eeaa7276
commit
fc3730fcc2
50 changed files with 2068 additions and 1537 deletions
@ -0,0 +1,9 @@ |
|||||||
|
if(ANDROID OR IOS) |
||||||
|
ocv_module_disable(gpuwarping) |
||||||
|
endif() |
||||||
|
|
||||||
|
set(the_description "GPU-accelerated Image Warping") |
||||||
|
|
||||||
|
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations) |
||||||
|
|
||||||
|
ocv_define_module(gpuwarping opencv_imgproc OPTIONAL opencv_gpulegacy) |
@ -0,0 +1,8 @@ |
|||||||
|
***************************************** |
||||||
|
gpuwarping. GPU-accelerated Image Warping |
||||||
|
***************************************** |
||||||
|
|
||||||
|
.. toctree:: |
||||||
|
:maxdepth: 1 |
||||||
|
|
||||||
|
warping |
@ -0,0 +1,251 @@ |
|||||||
|
Image Warping |
||||||
|
============= |
||||||
|
|
||||||
|
.. highlight:: cpp |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::remap |
||||||
|
-------------- |
||||||
|
Applies a generic geometrical transformation to an image. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::remap( const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap, int interpolation, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream& stream=Stream::Null() ) |
||||||
|
|
||||||
|
:param src: Source image. |
||||||
|
|
||||||
|
:param dst: Destination image with the size the same as ``xmap`` and the type the same as ``src`` . |
||||||
|
|
||||||
|
:param xmap: X values. Only ``CV_32FC1`` type is supported. |
||||||
|
|
||||||
|
:param ymap: Y values. Only ``CV_32FC1`` type is supported. |
||||||
|
|
||||||
|
:param interpolation: Interpolation method (see :ocv:func:`resize` ). ``INTER_NEAREST`` , ``INTER_LINEAR`` and ``INTER_CUBIC`` are supported for now. |
||||||
|
|
||||||
|
:param borderMode: Pixel extrapolation method (see :ocv:func:`borderInterpolate` ). ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now. |
||||||
|
|
||||||
|
:param borderValue: Value used in case of a constant border. By default, it is 0. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
The function transforms the source image using the specified map: |
||||||
|
|
||||||
|
.. math:: |
||||||
|
|
||||||
|
\texttt{dst} (x,y) = \texttt{src} (xmap(x,y), ymap(x,y)) |
||||||
|
|
||||||
|
Values of pixels with non-integer coordinates are computed using the bilinear interpolation. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`remap` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::resize |
||||||
|
--------------- |
||||||
|
Resizes an image. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null()) |
||||||
|
|
||||||
|
:param src: Source image. |
||||||
|
|
||||||
|
:param dst: Destination image with the same type as ``src`` . The size is ``dsize`` (when it is non-zero) or the size is computed from ``src.size()`` , ``fx`` , and ``fy`` . |
||||||
|
|
||||||
|
:param dsize: Destination image size. If it is zero, it is computed as: |
||||||
|
|
||||||
|
.. math:: |
||||||
|
\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))} |
||||||
|
|
||||||
|
Either ``dsize`` or both ``fx`` and ``fy`` must be non-zero. |
||||||
|
|
||||||
|
:param fx: Scale factor along the horizontal axis. If it is zero, it is computed as: |
||||||
|
|
||||||
|
.. math:: |
||||||
|
|
||||||
|
\texttt{(double)dsize.width/src.cols} |
||||||
|
|
||||||
|
:param fy: Scale factor along the vertical axis. If it is zero, it is computed as: |
||||||
|
|
||||||
|
.. math:: |
||||||
|
|
||||||
|
\texttt{(double)dsize.height/src.rows} |
||||||
|
|
||||||
|
:param interpolation: Interpolation method. ``INTER_NEAREST`` , ``INTER_LINEAR`` and ``INTER_CUBIC`` are supported for now. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`resize` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::warpAffine |
||||||
|
------------------- |
||||||
|
Applies an affine transformation to an image. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::warpAffine( const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream& stream=Stream::Null() ) |
||||||
|
|
||||||
|
:param src: Source image. ``CV_8U`` , ``CV_16U`` , ``CV_32S`` , or ``CV_32F`` depth and 1, 3, or 4 channels are supported. |
||||||
|
|
||||||
|
:param dst: Destination image with the same type as ``src`` . The size is ``dsize`` . |
||||||
|
|
||||||
|
:param M: *2x3* transformation matrix. |
||||||
|
|
||||||
|
:param dsize: Size of the destination image. |
||||||
|
|
||||||
|
:param flags: Combination of interpolation methods (see :ocv:func:`resize`) and the optional flag ``WARP_INVERSE_MAP`` specifying that ``M`` is an inverse transformation ( ``dst=>src`` ). Only ``INTER_NEAREST`` , ``INTER_LINEAR`` , and ``INTER_CUBIC`` interpolation methods are supported. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`warpAffine` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::buildWarpAffineMaps |
||||||
|
------------------------ |
||||||
|
Builds transformation maps for affine transformation. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null()) |
||||||
|
|
||||||
|
:param M: *2x3* transformation matrix. |
||||||
|
|
||||||
|
:param inverse: Flag specifying that ``M`` is an inverse transformation ( ``dst=>src`` ). |
||||||
|
|
||||||
|
:param dsize: Size of the destination image. |
||||||
|
|
||||||
|
:param xmap: X values with ``CV_32FC1`` type. |
||||||
|
|
||||||
|
:param ymap: Y values with ``CV_32FC1`` type. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`gpu::warpAffine` , :ocv:func:`gpu::remap` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::warpPerspective |
||||||
|
------------------------ |
||||||
|
Applies a perspective transformation to an image. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::warpPerspective( const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream& stream=Stream::Null() ) |
||||||
|
|
||||||
|
:param src: Source image. ``CV_8U`` , ``CV_16U`` , ``CV_32S`` , or ``CV_32F`` depth and 1, 3, or 4 channels are supported. |
||||||
|
|
||||||
|
:param dst: Destination image with the same type as ``src`` . The size is ``dsize`` . |
||||||
|
|
||||||
|
:param M: *3x3* transformation matrix. |
||||||
|
|
||||||
|
:param dsize: Size of the destination image. |
||||||
|
|
||||||
|
:param flags: Combination of interpolation methods (see :ocv:func:`resize` ) and the optional flag ``WARP_INVERSE_MAP`` specifying that ``M`` is the inverse transformation ( ``dst => src`` ). Only ``INTER_NEAREST`` , ``INTER_LINEAR`` , and ``INTER_CUBIC`` interpolation methods are supported. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`warpPerspective` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::buildWarpPerspectiveMaps |
||||||
|
----------------------------- |
||||||
|
Builds transformation maps for perspective transformation. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null()) |
||||||
|
|
||||||
|
:param M: *3x3* transformation matrix. |
||||||
|
|
||||||
|
:param inverse: Flag specifying that ``M`` is an inverse transformation ( ``dst=>src`` ). |
||||||
|
|
||||||
|
:param dsize: Size of the destination image. |
||||||
|
|
||||||
|
:param xmap: X values with ``CV_32FC1`` type. |
||||||
|
|
||||||
|
:param ymap: Y values with ``CV_32FC1`` type. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`gpu::warpPerspective` , :ocv:func:`gpu::remap` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::rotate |
||||||
|
--------------- |
||||||
|
Rotates an image around the origin (0,0) and then shifts it. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null()) |
||||||
|
|
||||||
|
:param src: Source image. Supports 1, 3 or 4 channels images with ``CV_8U`` , ``CV_16U`` or ``CV_32F`` depth. |
||||||
|
|
||||||
|
:param dst: Destination image with the same type as ``src`` . The size is ``dsize`` . |
||||||
|
|
||||||
|
:param dsize: Size of the destination image. |
||||||
|
|
||||||
|
:param angle: Angle of rotation in degrees. |
||||||
|
|
||||||
|
:param xShift: Shift along the horizontal axis. |
||||||
|
|
||||||
|
:param yShift: Shift along the vertical axis. |
||||||
|
|
||||||
|
:param interpolation: Interpolation method. Only ``INTER_NEAREST`` , ``INTER_LINEAR`` , and ``INTER_CUBIC`` are supported. |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`gpu::warpAffine` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::buildWarpPlaneMaps |
||||||
|
----------------------- |
||||||
|
Builds plane warping maps. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::buildWarpPlaneMaps( Size src_size, Rect dst_roi, const Mat & K, const Mat& R, const Mat & T, float scale, GpuMat& map_x, GpuMat& map_y, Stream& stream=Stream::Null() ) |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::buildWarpCylindricalMaps |
||||||
|
----------------------------- |
||||||
|
Builds cylindrical warping maps. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::buildWarpCylindricalMaps( Size src_size, Rect dst_roi, const Mat & K, const Mat& R, float scale, GpuMat& map_x, GpuMat& map_y, Stream& stream=Stream::Null() ) |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::buildWarpSphericalMaps |
||||||
|
--------------------------- |
||||||
|
Builds spherical warping maps. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::buildWarpSphericalMaps( Size src_size, Rect dst_roi, const Mat & K, const Mat& R, float scale, GpuMat& map_x, GpuMat& map_y, Stream& stream=Stream::Null() ) |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::pyrDown |
||||||
|
------------------- |
||||||
|
Smoothes an image and downsamples it. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::pyrDown(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) |
||||||
|
|
||||||
|
:param src: Source image. |
||||||
|
|
||||||
|
:param dst: Destination image. Will have ``Size((src.cols+1)/2, (src.rows+1)/2)`` size and the same type as ``src`` . |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`pyrDown` |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gpu::pyrUp |
||||||
|
------------------- |
||||||
|
Upsamples an image and then smoothes it. |
||||||
|
|
||||||
|
.. ocv:function:: void gpu::pyrUp(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) |
||||||
|
|
||||||
|
:param src: Source image. |
||||||
|
|
||||||
|
:param dst: Destination image. Will have ``Size(src.cols*2, src.rows*2)`` size and the same type as ``src`` . |
||||||
|
|
||||||
|
:param stream: Stream for the asynchronous version. |
||||||
|
|
||||||
|
.. seealso:: :ocv:func:`pyrUp` |
@ -0,0 +1,131 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#ifndef __OPENCV_GPUWARPING_HPP__ |
||||||
|
#define __OPENCV_GPUWARPING_HPP__ |
||||||
|
|
||||||
|
#ifndef __cplusplus |
||||||
|
# error gpuwarping.hpp header must be compiled as C++ |
||||||
|
#endif |
||||||
|
|
||||||
|
#include "opencv2/core/gpumat.hpp" |
||||||
|
#include "opencv2/imgproc.hpp" |
||||||
|
|
||||||
|
namespace cv { namespace gpu { |
||||||
|
|
||||||
|
//! DST[x,y] = SRC[xmap[x,y],ymap[x,y]]
|
||||||
|
//! supports only CV_32FC1 map type
|
||||||
|
CV_EXPORTS void remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap, |
||||||
|
int interpolation, int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar(), |
||||||
|
Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! resizes the image
|
||||||
|
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC, INTER_AREA
|
||||||
|
CV_EXPORTS void resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! warps the image using affine transformation
|
||||||
|
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
|
||||||
|
CV_EXPORTS void warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR, |
||||||
|
int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar(), Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
CV_EXPORTS void buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! warps the image using perspective transformation
|
||||||
|
//! Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
|
||||||
|
CV_EXPORTS void warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR, |
||||||
|
int borderMode = BORDER_CONSTANT, Scalar borderValue = Scalar(), Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
CV_EXPORTS void buildWarpPerspectiveMaps(const Mat& M, bool inverse, Size dsize, GpuMat& xmap, GpuMat& ymap, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! builds plane warping maps
|
||||||
|
CV_EXPORTS void buildWarpPlaneMaps(Size src_size, Rect dst_roi, const Mat &K, const Mat& R, const Mat &T, float scale, |
||||||
|
GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! builds cylindrical warping maps
|
||||||
|
CV_EXPORTS void buildWarpCylindricalMaps(Size src_size, Rect dst_roi, const Mat &K, const Mat& R, float scale, |
||||||
|
GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! builds spherical warping maps
|
||||||
|
CV_EXPORTS void buildWarpSphericalMaps(Size src_size, Rect dst_roi, const Mat &K, const Mat& R, float scale, |
||||||
|
GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! rotates an image around the origin (0,0) and then shifts it
|
||||||
|
//! supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC
|
||||||
|
//! supports 1, 3 or 4 channels images with CV_8U, CV_16U or CV_32F depth
|
||||||
|
CV_EXPORTS void rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, |
||||||
|
int interpolation = INTER_LINEAR, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! smoothes the source image and downsamples it
|
||||||
|
CV_EXPORTS void pyrDown(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
//! upsamples the source image and then smoothes it
|
||||||
|
CV_EXPORTS void pyrUp(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
class CV_EXPORTS ImagePyramid |
||||||
|
{ |
||||||
|
public: |
||||||
|
inline ImagePyramid() : nLayers_(0) {} |
||||||
|
inline ImagePyramid(const GpuMat& img, int nLayers, Stream& stream = Stream::Null()) |
||||||
|
{ |
||||||
|
build(img, nLayers, stream); |
||||||
|
} |
||||||
|
|
||||||
|
void build(const GpuMat& img, int nLayers, Stream& stream = Stream::Null()); |
||||||
|
|
||||||
|
void getLayer(GpuMat& outImg, Size outRoi, Stream& stream = Stream::Null()) const; |
||||||
|
|
||||||
|
inline void release() |
||||||
|
{ |
||||||
|
layer0_.release(); |
||||||
|
pyramid_.clear(); |
||||||
|
nLayers_ = 0; |
||||||
|
} |
||||||
|
|
||||||
|
private: |
||||||
|
GpuMat layer0_; |
||||||
|
std::vector<GpuMat> pyramid_; |
||||||
|
int nLayers_; |
||||||
|
}; |
||||||
|
|
||||||
|
}} // namespace cv { namespace gpu {
|
||||||
|
|
||||||
|
#endif /* __OPENCV_GPUWARPING_HPP__ */ |
@ -0,0 +1,47 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#include "perf_precomp.hpp" |
||||||
|
|
||||||
|
using namespace perf; |
||||||
|
|
||||||
|
CV_PERF_TEST_MAIN(gpuwarping, printCudaInfo()) |
@ -0,0 +1,43 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#include "perf_precomp.hpp" |
@ -0,0 +1,64 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#ifdef __GNUC__ |
||||||
|
# pragma GCC diagnostic ignored "-Wmissing-declarations" |
||||||
|
# if defined __clang__ || defined __APPLE__ |
||||||
|
# pragma GCC diagnostic ignored "-Wmissing-prototypes" |
||||||
|
# pragma GCC diagnostic ignored "-Wextra" |
||||||
|
# endif |
||||||
|
#endif |
||||||
|
|
||||||
|
#ifndef __OPENCV_PERF_PRECOMP_HPP__ |
||||||
|
#define __OPENCV_PERF_PRECOMP_HPP__ |
||||||
|
|
||||||
|
#include "opencv2/ts.hpp" |
||||||
|
#include "opencv2/ts/gpu_perf.hpp" |
||||||
|
|
||||||
|
#include "opencv2/gpuwarping.hpp" |
||||||
|
#include "opencv2/imgproc.hpp" |
||||||
|
|
||||||
|
#ifdef GTEST_CREATE_SHARED_LIBRARY |
||||||
|
#error no modules except ts should have GTEST_CREATE_SHARED_LIBRARY defined |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,592 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#include "perf_precomp.hpp" |
||||||
|
|
||||||
|
using namespace std; |
||||||
|
using namespace testing; |
||||||
|
using namespace perf; |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Remap
|
||||||
|
|
||||||
|
enum { HALF_SIZE=0, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH }; |
||||||
|
CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH) |
||||||
|
|
||||||
|
void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode) |
||||||
|
{ |
||||||
|
for (int j = 0; j < map_x.rows; ++j) |
||||||
|
{ |
||||||
|
for (int i = 0; i < map_x.cols; ++i) |
||||||
|
{ |
||||||
|
switch (remapMode) |
||||||
|
{ |
||||||
|
case HALF_SIZE: |
||||||
|
if (i > map_x.cols*0.25 && i < map_x.cols*0.75 && j > map_x.rows*0.25 && j < map_x.rows*0.75) |
||||||
|
{ |
||||||
|
map_x.at<float>(j,i) = 2.f * (i - map_x.cols * 0.25f) + 0.5f; |
||||||
|
map_y.at<float>(j,i) = 2.f * (j - map_x.rows * 0.25f) + 0.5f; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
map_x.at<float>(j,i) = 0.f; |
||||||
|
map_y.at<float>(j,i) = 0.f; |
||||||
|
} |
||||||
|
break; |
||||||
|
case UPSIDE_DOWN: |
||||||
|
map_x.at<float>(j,i) = static_cast<float>(i); |
||||||
|
map_y.at<float>(j,i) = static_cast<float>(map_x.rows - j); |
||||||
|
break; |
||||||
|
case REFLECTION_X: |
||||||
|
map_x.at<float>(j,i) = static_cast<float>(map_x.cols - i); |
||||||
|
map_y.at<float>(j,i) = static_cast<float>(j); |
||||||
|
break; |
||||||
|
case REFLECTION_BOTH: |
||||||
|
map_x.at<float>(j,i) = static_cast<float>(map_x.cols - i); |
||||||
|
map_y.at<float>(j,i) = static_cast<float>(map_x.rows - j); |
||||||
|
break; |
||||||
|
} // end of switch
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border_Mode, cv::Size, MatDepth, MatCn, Interpolation, BorderMode, RemapMode); |
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, Remap, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4, |
||||||
|
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), |
||||||
|
ALL_BORDER_MODES, |
||||||
|
RemapMode::all())) |
||||||
|
{ |
||||||
|
declare.time(20.0); |
||||||
|
|
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
const int interpolation = GET_PARAM(3); |
||||||
|
const int borderMode = GET_PARAM(4); |
||||||
|
const int remapMode = GET_PARAM(5); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
cv::Mat xmap(size, CV_32FC1); |
||||||
|
cv::Mat ymap(size, CV_32FC1); |
||||||
|
generateMap(xmap, ymap, remapMode); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
const cv::gpu::GpuMat d_xmap(xmap); |
||||||
|
const cv::gpu::GpuMat d_ymap(ymap); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::remap(d_src, dst, d_xmap, d_ymap, interpolation, borderMode); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::remap(src, dst, xmap, ymap, interpolation, borderMode); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Resize
|
||||||
|
|
||||||
|
DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Scale, cv::Size, MatDepth, MatCn, Interpolation, double); |
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, Resize, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4, |
||||||
|
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), |
||||||
|
Values(0.5, 0.3, 2.0))) |
||||||
|
{ |
||||||
|
declare.time(20.0); |
||||||
|
|
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
const int interpolation = GET_PARAM(3); |
||||||
|
const double f = GET_PARAM(4); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::resize(d_src, dst, cv::Size(), f, f, interpolation); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::resize(src, dst, cv::Size(), f, f, interpolation); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// ResizeArea
|
||||||
|
|
||||||
|
DEF_PARAM_TEST(Sz_Depth_Cn_Scale, cv::Size, MatDepth, MatCn, double); |
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn_Scale, ResizeArea, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4, |
||||||
|
Values(0.2, 0.1, 0.05))) |
||||||
|
{ |
||||||
|
declare.time(1.0); |
||||||
|
|
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
const int interpolation = cv::INTER_AREA; |
||||||
|
const double f = GET_PARAM(3); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::resize(d_src, dst, cv::Size(), f, f, interpolation); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::resize(src, dst, cv::Size(), f, f, interpolation); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// WarpAffine
|
||||||
|
|
||||||
|
DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border, cv::Size, MatDepth, MatCn, Interpolation, BorderMode); |
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn_Inter_Border, WarpAffine, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4, |
||||||
|
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), |
||||||
|
ALL_BORDER_MODES)) |
||||||
|
{ |
||||||
|
declare.time(20.0); |
||||||
|
|
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
const int interpolation = GET_PARAM(3); |
||||||
|
const int borderMode = GET_PARAM(4); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
const double aplha = CV_PI / 4; |
||||||
|
const double mat[2 * 3] = |
||||||
|
{ |
||||||
|
std::cos(aplha), -std::sin(aplha), src.cols / 2, |
||||||
|
std::sin(aplha), std::cos(aplha), 0 |
||||||
|
}; |
||||||
|
const cv::Mat M(2, 3, CV_64F, (void*) mat); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::warpAffine(d_src, dst, M, size, interpolation, borderMode); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst, 1); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::warpAffine(src, dst, M, size, interpolation, borderMode); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// WarpPerspective
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn_Inter_Border, WarpPerspective, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4, |
||||||
|
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)), |
||||||
|
ALL_BORDER_MODES)) |
||||||
|
{ |
||||||
|
declare.time(20.0); |
||||||
|
|
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
const int interpolation = GET_PARAM(3); |
||||||
|
const int borderMode = GET_PARAM(4); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
const double aplha = CV_PI / 4; |
||||||
|
double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2}, |
||||||
|
{std::sin(aplha), std::cos(aplha), 0}, |
||||||
|
{0.0, 0.0, 1.0}}; |
||||||
|
const cv::Mat M(3, 3, CV_64F, (void*) mat); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::warpPerspective(d_src, dst, M, size, interpolation, borderMode); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst, 1); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::warpPerspective(src, dst, M, size, interpolation, borderMode); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// BuildWarpPlaneMaps
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz, BuildWarpPlaneMaps, |
||||||
|
GPU_TYPICAL_MAT_SIZES) |
||||||
|
{ |
||||||
|
const cv::Size size = GetParam(); |
||||||
|
|
||||||
|
const cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); |
||||||
|
const cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); |
||||||
|
const cv::Mat T = cv::Mat::zeros(1, 3, CV_32F); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
cv::gpu::GpuMat map_x; |
||||||
|
cv::gpu::GpuMat map_y; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(map_x); |
||||||
|
GPU_SANITY_CHECK(map_y); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
FAIL_NO_CPU(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// BuildWarpCylindricalMaps
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz, BuildWarpCylindricalMaps, |
||||||
|
GPU_TYPICAL_MAT_SIZES) |
||||||
|
{ |
||||||
|
const cv::Size size = GetParam(); |
||||||
|
|
||||||
|
const cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); |
||||||
|
const cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
cv::gpu::GpuMat map_x; |
||||||
|
cv::gpu::GpuMat map_y; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(map_x); |
||||||
|
GPU_SANITY_CHECK(map_y); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
FAIL_NO_CPU(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// BuildWarpSphericalMaps
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz, BuildWarpSphericalMaps, |
||||||
|
GPU_TYPICAL_MAT_SIZES) |
||||||
|
{ |
||||||
|
const cv::Size size = GetParam(); |
||||||
|
|
||||||
|
const cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1); |
||||||
|
const cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
cv::gpu::GpuMat map_x; |
||||||
|
cv::gpu::GpuMat map_y; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(map_x); |
||||||
|
GPU_SANITY_CHECK(map_y); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
FAIL_NO_CPU(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Rotate
|
||||||
|
|
||||||
|
DEF_PARAM_TEST(Sz_Depth_Cn_Inter, cv::Size, MatDepth, MatCn, Interpolation); |
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn_Inter, Rotate, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4, |
||||||
|
Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)))) |
||||||
|
{ |
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
const int interpolation = GET_PARAM(3); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::rotate(d_src, dst, size, 30.0, 0, 0, interpolation); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst, 1e-3, ERROR_RELATIVE); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
FAIL_NO_CPU(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// PyrDown
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn, PyrDown, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4)) |
||||||
|
{ |
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::pyrDown(d_src, dst); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::pyrDown(src, dst); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// PyrUp
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn, PyrUp, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4)) |
||||||
|
{ |
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::gpu::pyrUp(d_src, dst); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cv::Mat dst; |
||||||
|
|
||||||
|
TEST_CYCLE() cv::pyrUp(src, dst); |
||||||
|
|
||||||
|
CPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// ImagePyramidBuild
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn, ImagePyramidBuild, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4)) |
||||||
|
{ |
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
const int nLayers = 5; |
||||||
|
const cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
|
||||||
|
cv::gpu::ImagePyramid d_pyr; |
||||||
|
|
||||||
|
TEST_CYCLE() d_pyr.build(d_src, nLayers); |
||||||
|
|
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
d_pyr.getLayer(dst, dstSize); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
FAIL_NO_CPU(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// ImagePyramidGetLayer
|
||||||
|
|
||||||
|
PERF_TEST_P(Sz_Depth_Cn, ImagePyramidGetLayer, |
||||||
|
Combine(GPU_TYPICAL_MAT_SIZES, |
||||||
|
Values(CV_8U, CV_16U, CV_32F), |
||||||
|
GPU_CHANNELS_1_3_4)) |
||||||
|
{ |
||||||
|
const cv::Size size = GET_PARAM(0); |
||||||
|
const int depth = GET_PARAM(1); |
||||||
|
const int channels = GET_PARAM(2); |
||||||
|
|
||||||
|
const int type = CV_MAKE_TYPE(depth, channels); |
||||||
|
|
||||||
|
cv::Mat src(size, type); |
||||||
|
declare.in(src, WARMUP_RNG); |
||||||
|
|
||||||
|
const int nLayers = 3; |
||||||
|
const cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10); |
||||||
|
|
||||||
|
if (PERF_RUN_GPU()) |
||||||
|
{ |
||||||
|
const cv::gpu::GpuMat d_src(src); |
||||||
|
cv::gpu::GpuMat dst; |
||||||
|
|
||||||
|
cv::gpu::ImagePyramid d_pyr(d_src, nLayers); |
||||||
|
|
||||||
|
TEST_CYCLE() d_pyr.getLayer(dst, dstSize); |
||||||
|
|
||||||
|
GPU_SANITY_CHECK(dst); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
FAIL_NO_CPU(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,221 @@ |
|||||||
|
/*M/////////////////////////////////////////////////////////////////////////////////////// |
||||||
|
// |
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. |
||||||
|
// |
||||||
|
// 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. |
||||||
|
// |
||||||
|
// |
||||||
|
// License Agreement |
||||||
|
// For Open Source Computer Vision Library |
||||||
|
// |
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. |
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved. |
||||||
|
// Third party copyrights are property of their respective owners. |
||||||
|
// |
||||||
|
// Redistribution and use in source and binary forms, with or without modification, |
||||||
|
// are permitted provided that the following conditions are met: |
||||||
|
// |
||||||
|
// * Redistribution's of source code must retain the above copyright notice, |
||||||
|
// this list of conditions and the following disclaimer. |
||||||
|
// |
||||||
|
// * Redistribution's 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. |
||||||
|
// |
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products |
||||||
|
// derived from this software without specific prior written permission. |
||||||
|
// |
||||||
|
// 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 the Intel Corporation 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. |
||||||
|
// |
||||||
|
//M*/ |
||||||
|
|
||||||
|
#if !defined CUDA_DISABLER |
||||||
|
|
||||||
|
#include "opencv2/core/cuda/common.hpp" |
||||||
|
#include "opencv2/core/cuda/vec_traits.hpp" |
||||||
|
#include "opencv2/core/cuda/vec_math.hpp" |
||||||
|
#include "opencv2/core/cuda/saturate_cast.hpp" |
||||||
|
#include "opencv2/core/cuda/border_interpolate.hpp" |
||||||
|
|
||||||
|
namespace cv { namespace gpu { namespace cudev |
||||||
|
{ |
||||||
|
namespace imgproc |
||||||
|
{ |
||||||
|
// TODO use intrinsics like __sinf and so on |
||||||
|
|
||||||
|
namespace build_warp_maps |
||||||
|
{ |
||||||
|
|
||||||
|
__constant__ float ck_rinv[9]; |
||||||
|
__constant__ float cr_kinv[9]; |
||||||
|
__constant__ float ct[3]; |
||||||
|
__constant__ float cscale; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
class PlaneMapper |
||||||
|
{ |
||||||
|
public: |
||||||
|
static __device__ __forceinline__ void mapBackward(float u, float v, float &x, float &y) |
||||||
|
{ |
||||||
|
using namespace build_warp_maps; |
||||||
|
|
||||||
|
float x_ = u / cscale - ct[0]; |
||||||
|
float y_ = v / cscale - ct[1]; |
||||||
|
|
||||||
|
float z; |
||||||
|
x = ck_rinv[0] * x_ + ck_rinv[1] * y_ + ck_rinv[2] * (1 - ct[2]); |
||||||
|
y = ck_rinv[3] * x_ + ck_rinv[4] * y_ + ck_rinv[5] * (1 - ct[2]); |
||||||
|
z = ck_rinv[6] * x_ + ck_rinv[7] * y_ + ck_rinv[8] * (1 - ct[2]); |
||||||
|
|
||||||
|
x /= z; |
||||||
|
y /= z; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
class CylindricalMapper |
||||||
|
{ |
||||||
|
public: |
||||||
|
static __device__ __forceinline__ void mapBackward(float u, float v, float &x, float &y) |
||||||
|
{ |
||||||
|
using namespace build_warp_maps; |
||||||
|
|
||||||
|
u /= cscale; |
||||||
|
float x_ = ::sinf(u); |
||||||
|
float y_ = v / cscale; |
||||||
|
float z_ = ::cosf(u); |
||||||
|
|
||||||
|
float z; |
||||||
|
x = ck_rinv[0] * x_ + ck_rinv[1] * y_ + ck_rinv[2] * z_; |
||||||
|
y = ck_rinv[3] * x_ + ck_rinv[4] * y_ + ck_rinv[5] * z_; |
||||||
|
z = ck_rinv[6] * x_ + ck_rinv[7] * y_ + ck_rinv[8] * z_; |
||||||
|
|
||||||
|
if (z > 0) { x /= z; y /= z; } |
||||||
|
else x = y = -1; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
class SphericalMapper |
||||||
|
{ |
||||||
|
public: |
||||||
|
static __device__ __forceinline__ void mapBackward(float u, float v, float &x, float &y) |
||||||
|
{ |
||||||
|
using namespace build_warp_maps; |
||||||
|
|
||||||
|
v /= cscale; |
||||||
|
u /= cscale; |
||||||
|
|
||||||
|
float sinv = ::sinf(v); |
||||||
|
float x_ = sinv * ::sinf(u); |
||||||
|
float y_ = -::cosf(v); |
||||||
|
float z_ = sinv * ::cosf(u); |
||||||
|
|
||||||
|
float z; |
||||||
|
x = ck_rinv[0] * x_ + ck_rinv[1] * y_ + ck_rinv[2] * z_; |
||||||
|
y = ck_rinv[3] * x_ + ck_rinv[4] * y_ + ck_rinv[5] * z_; |
||||||
|
z = ck_rinv[6] * x_ + ck_rinv[7] * y_ + ck_rinv[8] * z_; |
||||||
|
|
||||||
|
if (z > 0) { x /= z; y /= z; } |
||||||
|
else x = y = -1; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
template <typename Mapper> |
||||||
|
__global__ void buildWarpMapsKernel(int tl_u, int tl_v, int cols, int rows, |
||||||
|
PtrStepf map_x, PtrStepf map_y) |
||||||
|
{ |
||||||
|
int du = blockIdx.x * blockDim.x + threadIdx.x; |
||||||
|
int dv = blockIdx.y * blockDim.y + threadIdx.y; |
||||||
|
if (du < cols && dv < rows) |
||||||
|
{ |
||||||
|
float u = tl_u + du; |
||||||
|
float v = tl_v + dv; |
||||||
|
float x, y; |
||||||
|
Mapper::mapBackward(u, v, x, y); |
||||||
|
map_x.ptr(dv)[du] = x; |
||||||
|
map_y.ptr(dv)[du] = y; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void buildWarpPlaneMaps(int tl_u, int tl_v, PtrStepSzf map_x, PtrStepSzf map_y, |
||||||
|
const float k_rinv[9], const float r_kinv[9], const float t[3], |
||||||
|
float scale, cudaStream_t stream) |
||||||
|
{ |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::ck_rinv, k_rinv, 9*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cr_kinv, r_kinv, 9*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::ct, t, 3*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cscale, &scale, sizeof(float))); |
||||||
|
|
||||||
|
int cols = map_x.cols; |
||||||
|
int rows = map_x.rows; |
||||||
|
|
||||||
|
dim3 threads(32, 8); |
||||||
|
dim3 grid(divUp(cols, threads.x), divUp(rows, threads.y)); |
||||||
|
|
||||||
|
buildWarpMapsKernel<PlaneMapper><<<grid,threads>>>(tl_u, tl_v, cols, rows, map_x, map_y); |
||||||
|
cudaSafeCall(cudaGetLastError()); |
||||||
|
if (stream == 0) |
||||||
|
cudaSafeCall(cudaDeviceSynchronize()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void buildWarpCylindricalMaps(int tl_u, int tl_v, PtrStepSzf map_x, PtrStepSzf map_y, |
||||||
|
const float k_rinv[9], const float r_kinv[9], float scale, |
||||||
|
cudaStream_t stream) |
||||||
|
{ |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::ck_rinv, k_rinv, 9*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cr_kinv, r_kinv, 9*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cscale, &scale, sizeof(float))); |
||||||
|
|
||||||
|
int cols = map_x.cols; |
||||||
|
int rows = map_x.rows; |
||||||
|
|
||||||
|
dim3 threads(32, 8); |
||||||
|
dim3 grid(divUp(cols, threads.x), divUp(rows, threads.y)); |
||||||
|
|
||||||
|
buildWarpMapsKernel<CylindricalMapper><<<grid,threads>>>(tl_u, tl_v, cols, rows, map_x, map_y); |
||||||
|
cudaSafeCall(cudaGetLastError()); |
||||||
|
if (stream == 0) |
||||||
|
cudaSafeCall(cudaDeviceSynchronize()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void buildWarpSphericalMaps(int tl_u, int tl_v, PtrStepSzf map_x, PtrStepSzf map_y, |
||||||
|
const float k_rinv[9], const float r_kinv[9], float scale, |
||||||
|
cudaStream_t stream) |
||||||
|
{ |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::ck_rinv, k_rinv, 9*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cr_kinv, r_kinv, 9*sizeof(float))); |
||||||
|
cudaSafeCall(cudaMemcpyToSymbol(build_warp_maps::cscale, &scale, sizeof(float))); |
||||||
|
|
||||||
|
int cols = map_x.cols; |
||||||
|
int rows = map_x.rows; |
||||||
|
|
||||||
|
dim3 threads(32, 8); |
||||||
|
dim3 grid(divUp(cols, threads.x), divUp(rows, threads.y)); |
||||||
|
|
||||||
|
buildWarpMapsKernel<SphericalMapper><<<grid,threads>>>(tl_u, tl_v, cols, rows, map_x, map_y); |
||||||
|
cudaSafeCall(cudaGetLastError()); |
||||||
|
if (stream == 0) |
||||||
|
cudaSafeCall(cudaDeviceSynchronize()); |
||||||
|
} |
||||||
|
} // namespace imgproc |
||||||
|
}}} // namespace cv { namespace gpu { namespace cudev { |
||||||
|
|
||||||
|
|
||||||
|
#endif /* CUDA_DISABLER */ |
@ -0,0 +1,43 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#include "precomp.hpp" |
@ -0,0 +1,57 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#ifndef __OPENCV_PRECOMP_H__ |
||||||
|
#define __OPENCV_PRECOMP_H__ |
||||||
|
|
||||||
|
#include "opencv2/gpuwarping.hpp" |
||||||
|
|
||||||
|
#include "opencv2/core/gpu_private.hpp" |
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp" |
||||||
|
|
||||||
|
#ifdef HAVE_OPENCV_GPULEGACY |
||||||
|
# include "opencv2/gpulegacy.hpp" |
||||||
|
# include "opencv2/gpulegacy/private.hpp" |
||||||
|
#endif |
||||||
|
|
||||||
|
#endif /* __OPENCV_PRECOMP_H__ */ |
@ -0,0 +1,45 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#include "test_precomp.hpp" |
||||||
|
|
||||||
|
CV_GPU_TEST_MAIN("gpu") |
@ -0,0 +1,43 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#include "test_precomp.hpp" |
@ -0,0 +1,62 @@ |
|||||||
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// License Agreement
|
||||||
|
// For Open Source Computer Vision Library
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Third party copyrights are property of their respective owners.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistribution's of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// * Redistribution's 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.
|
||||||
|
//
|
||||||
|
// * The name of the copyright holders may not be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// 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 the Intel Corporation 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.
|
||||||
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
|
#ifdef __GNUC__ |
||||||
|
# pragma GCC diagnostic ignored "-Wmissing-declarations" |
||||||
|
# if defined __clang__ || defined __APPLE__ |
||||||
|
# pragma GCC diagnostic ignored "-Wmissing-prototypes" |
||||||
|
# pragma GCC diagnostic ignored "-Wextra" |
||||||
|
# endif |
||||||
|
#endif |
||||||
|
|
||||||
|
#ifndef __OPENCV_TEST_PRECOMP_HPP__ |
||||||
|
#define __OPENCV_TEST_PRECOMP_HPP__ |
||||||
|
|
||||||
|
#include "opencv2/ts.hpp" |
||||||
|
#include "opencv2/ts/gpu_test.hpp" |
||||||
|
|
||||||
|
#include "opencv2/gpuwarping.hpp" |
||||||
|
#include "opencv2/imgproc.hpp" |
||||||
|
|
||||||
|
#include "interpolation.hpp" |
||||||
|
|
||||||
|
#endif |
Loading…
Reference in new issue