added remap test, fix compilation error
This commit is contained in:
parent
7f1995f19a
commit
bad7dadb75
@ -131,7 +131,7 @@ namespace cv { namespace gpu { namespace imgproc
|
|||||||
grid.x = divUp(dst.cols, threads.x);
|
grid.x = divUp(dst.cols, threads.x);
|
||||||
grid.y = divUp(dst.rows, threads.y);
|
grid.y = divUp(dst.rows, threads.y);
|
||||||
|
|
||||||
TextureBinder tex_remap(&tex_remap, src);
|
TextureBinder tex(&tex_remap, src);
|
||||||
|
|
||||||
remap_1c<<<grid, threads>>>(xmap.data, ymap.data, xmap.step, dst.data, dst.step, dst.cols, dst.rows);
|
remap_1c<<<grid, threads>>>(xmap.data, ymap.data, xmap.step, dst.data, dst.step, dst.cols, dst.rows);
|
||||||
cudaSafeCall( cudaGetLastError() );
|
cudaSafeCall( cudaGetLastError() );
|
||||||
|
@ -178,6 +178,63 @@ INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
|
|||||||
testing::Values(CV_8UC1, CV_8UC4),
|
testing::Values(CV_8UC1, CV_8UC4),
|
||||||
testing::Values((int)cv::INTER_NEAREST, (int)cv::INTER_LINEAR)));
|
testing::Values((int)cv::INTER_NEAREST, (int)cv::INTER_LINEAR)));
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// remap
|
||||||
|
|
||||||
|
struct Remap : testing::TestWithParam< std::tr1::tuple<cv::gpu::DeviceInfo, int> >
|
||||||
|
{
|
||||||
|
cv::gpu::DeviceInfo devInfo;
|
||||||
|
int type;
|
||||||
|
|
||||||
|
cv::Size size;
|
||||||
|
cv::Mat src;
|
||||||
|
cv::Mat xmap;
|
||||||
|
cv::Mat ymap;
|
||||||
|
|
||||||
|
cv::Mat dst_gold;
|
||||||
|
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
devInfo = std::tr1::get<0>(GetParam());
|
||||||
|
type = std::tr1::get<1>(GetParam());
|
||||||
|
|
||||||
|
cv::gpu::setDevice(devInfo.deviceID());
|
||||||
|
|
||||||
|
cv::RNG& rng = cvtest::TS::ptr()->get_rng();
|
||||||
|
|
||||||
|
size = cv::Size(rng.uniform(20, 150), rng.uniform(20, 150));
|
||||||
|
|
||||||
|
src = cvtest::randomMat(rng, size, type, 0.0, 127.0, false);
|
||||||
|
xmap = cvtest::randomMat(rng, size, CV_32FC1, 0.0, src.cols - 1, false);
|
||||||
|
ymap = cvtest::randomMat(rng, size, CV_32FC1, 0.0, src.rows - 1, false);
|
||||||
|
|
||||||
|
cv::remap(src, dst_gold, xmap, ymap, cv::INTER_LINEAR, cv::BORDER_WRAP);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_P(Remap, Accuracy)
|
||||||
|
{
|
||||||
|
PRINT_PARAM(devInfo);
|
||||||
|
PRINT_TYPE(type);
|
||||||
|
PRINT_PARAM(size);
|
||||||
|
|
||||||
|
cv::Mat dst;
|
||||||
|
|
||||||
|
ASSERT_NO_THROW(
|
||||||
|
cv::gpu::GpuMat gpuRes;
|
||||||
|
|
||||||
|
cv::gpu::remap(cv::gpu::GpuMat(src), gpuRes, cv::gpu::GpuMat(xmap), cv::gpu::GpuMat(ymap));
|
||||||
|
|
||||||
|
gpuRes.download(dst);
|
||||||
|
);
|
||||||
|
|
||||||
|
EXPECT_MAT_SIMILAR(dst_gold, dst, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(
|
||||||
|
testing::ValuesIn(devices()),
|
||||||
|
testing::Values(CV_8UC1, CV_8UC3)));
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// copyMakeBorder
|
// copyMakeBorder
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user