2011-09-07 21:16:07 +08:00
|
|
|
#ifndef __OPENCV_PERF_GPU_UTILITY_HPP__
|
|
|
|
#define __OPENCV_PERF_GPU_UTILITY_HPP__
|
|
|
|
|
2012-08-17 19:14:14 +08:00
|
|
|
#include "opencv2/core/core.hpp"
|
|
|
|
#include "opencv2/core/gpumat.hpp"
|
|
|
|
#include "opencv2/imgproc/imgproc.hpp"
|
|
|
|
#include "opencv2/ts/ts_perf.hpp"
|
|
|
|
|
2012-08-17 20:12:32 +08:00
|
|
|
extern bool runOnGpu;
|
|
|
|
|
2012-08-17 19:14:14 +08:00
|
|
|
void fillRandom(cv::Mat& m, double a = 0.0, double b = 255.0);
|
|
|
|
cv::Mat readImage(const std::string& fileName, int flags = cv::IMREAD_COLOR);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-05-22 21:59:40 +08:00
|
|
|
using perf::MatType;
|
|
|
|
using perf::MatDepth;
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)
|
2012-08-17 19:14:14 +08:00
|
|
|
#define ALL_BORDER_MODES testing::ValuesIn(BorderMode::all())
|
2012-10-09 02:49:02 +08:00
|
|
|
|
2012-08-17 19:14:14 +08:00
|
|
|
CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC, cv::INTER_AREA)
|
|
|
|
#define ALL_INTERPOLATIONS testing::ValuesIn(Interpolation::all())
|
2012-05-23 20:58:01 +08:00
|
|
|
CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2, cv::NORM_HAMMING)
|
|
|
|
|
2012-10-09 02:49:02 +08:00
|
|
|
const int Gray = 1, TwoChannel = 2, BGR = 3, BGRA = 4;
|
2012-10-09 04:44:48 +08:00
|
|
|
CV_ENUM(MatCn, Gray, TwoChannel, BGR, BGRA)
|
2012-10-08 17:58:03 +08:00
|
|
|
#define GPU_CHANNELS_1_3_4 testing::Values(Gray, BGR, BGRA)
|
|
|
|
#define GPU_CHANNELS_1_3 testing::Values(Gray, BGR)
|
|
|
|
|
2012-05-23 20:58:01 +08:00
|
|
|
struct CvtColorInfo
|
|
|
|
{
|
|
|
|
int scn;
|
|
|
|
int dcn;
|
|
|
|
int code;
|
|
|
|
|
|
|
|
explicit CvtColorInfo(int scn_=0, int dcn_=0, int code_=0) : scn(scn_), dcn(dcn_), code(code_) {}
|
|
|
|
};
|
|
|
|
void PrintTo(const CvtColorInfo& info, std::ostream* os);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-08-17 19:14:14 +08:00
|
|
|
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
2011-12-28 20:53:08 +08:00
|
|
|
|
2012-08-17 19:14:14 +08:00
|
|
|
#define DEF_PARAM_TEST(name, ...) typedef ::perf::TestBaseWithParam< std::tr1::tuple< __VA_ARGS__ > > name
|
|
|
|
#define DEF_PARAM_TEST_1(name, param_type) typedef ::perf::TestBaseWithParam< param_type > name
|
2011-12-28 20:53:08 +08:00
|
|
|
|
2012-08-17 19:14:14 +08:00
|
|
|
DEF_PARAM_TEST_1(Sz, cv::Size);
|
|
|
|
typedef perf::Size_MatType Sz_Type;
|
|
|
|
DEF_PARAM_TEST(Sz_Depth, cv::Size, MatDepth);
|
2012-10-09 02:49:02 +08:00
|
|
|
DEF_PARAM_TEST(Sz_Depth_Cn, cv::Size, MatDepth, MatCn);
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-08-23 20:54:48 +08:00
|
|
|
#define GPU_TYPICAL_MAT_SIZES testing::Values(perf::sz720p, perf::szSXGA, perf::sz1080p)
|
2012-10-08 17:58:03 +08:00
|
|
|
|
2012-10-10 03:30:59 +08:00
|
|
|
namespace ts {
|
|
|
|
void printOsInfo();
|
|
|
|
void printCudaInfo();
|
|
|
|
}
|
2011-09-07 21:16:07 +08:00
|
|
|
|
2012-10-10 05:34:21 +08:00
|
|
|
#define GPU_SANITY_CHECK(dmat, ...) \
|
|
|
|
do{ \
|
|
|
|
cv::Mat d##dmat(dmat); \
|
|
|
|
SANITY_CHECK(d##dmat, ## __VA_ARGS__); \
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
#define CPU_SANITY_CHECK(cmat, ...) \
|
|
|
|
do{ \
|
|
|
|
SANITY_CHECK(cmat, ## __VA_ARGS__); \
|
|
|
|
} while(0);
|
|
|
|
|
2011-09-07 21:16:07 +08:00
|
|
|
#endif // __OPENCV_PERF_GPU_UTILITY_HPP__
|