gpu_perf.hpp
Go to the documentation of this file.
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_GPU_PERF_UTILITY_HPP__
44 #define __OPENCV_GPU_PERF_UTILITY_HPP__
45 
46 #include "opencv2/core/core.hpp"
49 #include "opencv2/ts/ts_perf.hpp"
50 
51 namespace perf
52 {
53  #define ALL_BORDER_MODES BorderMode::all()
54  #define ALL_INTERPOLATIONS Interpolation::all()
55 
59 
60  enum { Gray = 1, TwoChannel = 2, BGR = 3, BGRA = 4 };
61  CV_ENUM(MatCn, Gray, TwoChannel, BGR, BGRA)
62 
63  #define GPU_CHANNELS_1_3_4 testing::Values(MatCn(Gray), MatCn(BGR), MatCn(BGRA))
64  #define GPU_CHANNELS_1_3 testing::Values(MatCn(Gray), MatCn(BGR))
65 
66  #define GET_PARAM(k) std::tr1::get< k >(GetParam())
67 
68  #define DEF_PARAM_TEST(name, ...) typedef ::perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > name
69  #define DEF_PARAM_TEST_1(name, param_type) typedef ::perf::TestBaseWithParam< param_type > name
70 
71  DEF_PARAM_TEST_1(Sz, cv::Size);
73  DEF_PARAM_TEST(Sz_Depth, cv::Size, perf::MatDepth);
74  DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, perf::MatDepth, MatCn);
75 
76  #define GPU_TYPICAL_MAT_SIZES testing::Values(perf::sz720p, perf::szSXGA, perf::sz1080p)
77 
78  #define FAIL_NO_CPU() FAIL() << "No such CPU implementation analogy"
79 
80  #define GPU_SANITY_CHECK(mat, ...) \
81  do{ \
82  cv::Mat gpu_##mat(mat); \
83  SANITY_CHECK(gpu_##mat, ## __VA_ARGS__); \
84  } while(0)
85 
86  #define CPU_SANITY_CHECK(mat, ...) \
87  do{ \
88  cv::Mat cpu_##mat(mat); \
89  SANITY_CHECK(cpu_##mat, ## __VA_ARGS__); \
90  } while(0)
91 
92  CV_EXPORTS cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
93 
94  struct CvtColorInfo
95  {
96  int scn;
97  int dcn;
98  int code;
99 
101  explicit CvtColorInfo(int scn_, int dcn_, int code_) : scn(scn_), dcn(dcn_), code(code_) {}
102  };
103  CV_EXPORTS void PrintTo(const CvtColorInfo& info, std::ostream* os);
104 
105  CV_EXPORTS void printCudaInfo();
106 
107  CV_EXPORTS void sortKeyPoints(std::vector<cv::KeyPoint>& keypoints, cv::InputOutputArray _descriptors = cv::noArray());
108 }
109 
110 #endif // __OPENCV_GPU_PERF_UTILITY_HPP__
CV_ENUM(BorderMode, BORDER_REFLECT101, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_WRAP) CV_ENUM(Interpolation
area-based (or super) interpolation
Definition: imgproc.hpp:557
INTER_LINEAR
Definition: gpu_perf.hpp:57
INTER_CUBIC
Definition: gpu_perf.hpp:57
int int int flags
Definition: highgui_c.h:186
Definition: core.hpp:132
Definition: highgui.hpp:169
Definition: core.hpp:132
int dcn
Definition: gpu_perf.hpp:97
int scn
Definition: gpu_perf.hpp:96
Definition: ts_perf.hpp:375
The 2D size class.
Definition: core.hpp:81
CV_EXPORTS void sortKeyPoints(std::vector< cv::KeyPoint > &keypoints, cv::InputOutputArray _descriptors=cv::noArray())
const CvArr CvSeq ** keypoints
Definition: compat.hpp:647
Definition: core.hpp:132
CV_EXPORTS void PrintTo(const CvtColorInfo &info, std::ostream *os)
Definition: imgproc.hpp:63
The Image Processing.
INTER_NEAREST
Definition: gpu_perf.hpp:57
Definition: imgproc.hpp:62
The Core Functionality.
The n-dimensional matrix class.
Definition: core.hpp:1688
CvtColorInfo(int scn_, int dcn_, int code_)
Definition: gpu_perf.hpp:101
CvtColorInfo()
Definition: gpu_perf.hpp:100
CV_EXPORTS void printCudaInfo()
perf::Size_MatType Sz_Type
Definition: gpu_perf.hpp:72
Definition: imgproc.hpp:62
Definition: imgproc.hpp:63
CV_EXPORTS cv::Mat readImage(const std::string &fileName, int flags=cv::IMREAD_COLOR)
Definition: core.hpp:132
CV_EXPORTS OutputArray noArray()
Definition: imgproc.hpp:64
Definition: gpu_perf.hpp:94
int code
Definition: gpu_perf.hpp:98
DEF_PARAM_TEST(Sz_Depth, cv::Size, perf::MatDepth)
Proxy datatype for passing Mat's and vector<>'s as input parameters.
Definition: core.hpp:1400
Definition: core.hpp:132