|
|
|
#include "perf_precomp.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace cv;
|
|
|
|
using namespace cv::gpu;
|
|
|
|
|
|
|
|
void fill(Mat& m, double a, double b)
|
|
|
|
{
|
|
|
|
RNG rng(123456789);
|
|
|
|
rng.fill(m, RNG::UNIFORM, Scalar::all(a), Scalar::all(b));
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrintTo(const CvtColorInfo& info, ostream* os)
|
|
|
|
{
|
|
|
|
static const char* str[] =
|
|
|
|
{
|
|
|
|
"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",
|
|
|
|
"BGR5552RGB",
|
|
|
|
"BGRA2BGR555",
|
|
|
|
"RGBA2BGR555",
|
|
|
|
"BGR5552BGRA",
|
|
|
|
"BGR5552RGBA",
|
|
|
|
|
|
|
|
"GRAY2BGR555",
|
|
|
|
"BGR5552GRAY",
|
|
|
|
|
|
|
|
"BGR2XYZ",
|
|
|
|
"RGB2XYZ",
|
|
|
|
"XYZ2BGR",
|
|
|
|
"XYZ2RGB",
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
"YUV2BGRA_YVYU",
|
|
|
|
|
|
|
|
"YUV2GRAY_UYVY",
|
|
|
|
"YUV2GRAY_YUY2",
|
|
|
|
|
|
|
|
// alpha premultiplication
|
|
|
|
"RGBA2mRGBA",
|
|
|
|
"mRGBA2RGBA",
|
|
|
|
|
|
|
|
"COLORCVT_MAX"
|
|
|
|
};
|
|
|
|
|
|
|
|
*os << str[info.code];
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|