2011-09-07 21:16:07 +08:00
|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
2011-12-28 20:53:08 +08:00
|
|
|
using namespace cv;
|
2011-09-07 21:16:07 +08:00
|
|
|
using namespace cv::gpu;
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
void fill(Mat& m, double a, double b)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2011-12-28 20:53:08 +08:00
|
|
|
RNG rng(123456789);
|
2012-05-23 20:58:01 +08:00
|
|
|
rng.fill(m, RNG::UNIFORM, Scalar::all(a), Scalar::all(b));
|
2011-09-07 21:16:07 +08:00
|
|
|
}
|
|
|
|
|
2011-12-28 20:53:08 +08:00
|
|
|
void PrintTo(const CvtColorInfo& info, ostream* os)
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
2012-05-23 20:58:01 +08:00
|
|
|
static const char* str[] =
|
2011-09-07 21:16:07 +08:00
|
|
|
{
|
|
|
|
"BGR2BGRA",
|
|
|
|
"BGRA2BGR",
|
|
|
|
"BGR2RGBA",
|
|
|
|
"RGBA2BGR",
|
|
|
|
"BGR2RGB",
|
|
|
|
"BGRA2RGBA",
|
|
|
|
|
|
|
|
"BGR2GRAY",
|
|
|
|
"RGB2GRAY",
|
|
|
|
"GRAY2BGR",
|
|
|
|
"GRAY2BGRA",
|
|
|
|
"BGRA2GRAY",
|
|
|
|
"RGBA2GRAY",
|
|
|
|
|
|
|
|
"BGR2BGR565",
|
|
|
|
"RGB2BGR565",
|
|
|
|
"BGR5652BGR",
|
|
|
|
"BGR5652RGB",
|
|
|
|
"BGRA2BGR565",
|
|
|
|
"RGBA2BGR565",
|
|
|
|
"BGR5652BGRA",
|
|
|
|
"BGR5652RGBA",
|
|
|
|
|
|
|
|
"GRAY2BGR565",
|
|
|
|
"BGR5652GRAY",
|
|
|
|
|
|
|
|
"BGR2BGR555",
|
|
|
|
"RGB2BGR555",
|
|
|
|
"BGR5552BGR",
|
|
|
|
"BGR5552R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
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
"BGR2YUV",
|
|
|
|
"RGB2YUV",
|
|
|
|
"YUV2BGR",
|
|
|
|
"YUV2RGB",
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
2012-05-23 20:58:01 +08:00
|
|
|
0
|
2011-09-07 21:16:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
*os << str[info.code];
|
|
|
|
}
|
2011-12-28 20:53:08 +08:00
|
|
|
|
|
|
|
void cv::gpu::PrintTo(const DeviceInfo& info, ostream* os)
|
|
|
|
{
|
|
|
|
*os << info.name();
|
|
|
|
}
|
|
|
|
|
|
|
|
Mat readImage(const string& fileName, int flags)
|
|
|
|
{
|
|
|
|
return imread(perf::TestBase::getDataPath(fileName), flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
const vector<DeviceInfo>& devices()
|
|
|
|
{
|
|
|
|
static vector<DeviceInfo> devs;
|
|
|
|
static bool first = true;
|
|
|
|
|
|
|
|
if (first)
|
|
|
|
{
|
|
|
|
int deviceCount = getCudaEnabledDeviceCount();
|
|
|
|
|
|
|
|
devs.reserve(deviceCount);
|
|
|
|
|
|
|
|
for (int i = 0; i < deviceCount; ++i)
|
|
|
|
{
|
|
|
|
DeviceInfo info(i);
|
|
|
|
if (info.isCompatible())
|
|
|
|
devs.push_back(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return devs;
|
|
|
|
}
|