added perf test for gpu::erode, fixed docs, refactored perf. sample

This commit is contained in:
Alexey Spizhevoy 2011-02-04 08:16:09 +00:00
parent da6aa774d2
commit 5c3495a079
4 changed files with 58 additions and 29 deletions

View File

@ -113,7 +113,7 @@ Returns true if the device has the given GPU feature, otherwise false.
\cvdefCpp{bool DeviceInfo::has(GpuFeature feature);}
\begin{description}
\cvarg{feature}{Feature to be checked. See \hyperref[cpp.gpu.GpuFeature]{gpu::GpuFeature}.}
\cvarg{feature}{Feature to be checked. See \hyperref[cpp.gpu.GpuFeature]{cv::gpu::GpuFeature}.}
\end{description}
@ -131,7 +131,7 @@ This class provides functionality (as set of static methods) for checking which
The following method checks whether the module was built with the support of the given feature:
\cvdefCpp{static bool builtWith(GpuFeature feature);}
\begin{description}
\cvarg{feature}{Feature to be checked. See \hyperref[cpp.gpu.GpuFeature]{gpu::GpuFeature}.}
\cvarg{feature}{Feature to be checked. See \hyperref[cpp.gpu.GpuFeature]{cv::gpu::GpuFeature}.}
\end{description}
There are a set of methods for checking whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):

View File

@ -125,7 +125,6 @@ private:
void name##_test::run()
#define SUBTEST TestSystem::instance().subtest()
#define DESCRIPTION TestSystem::instance().subtest()
#define CPU_ON TestSystem::instance().cpuOn()
#define GPU_ON TestSystem::instance().gpuOn()
#define CPU_OFF TestSystem::instance().cpuOff()

View File

@ -167,32 +167,32 @@ TEST(cornerHarris)
}
//TEST(integral)
//{
// Mat src, sum;
// gpu::GpuMat d_src, d_sum, d_buf;
//
// int size = 4000;
//
// gen(src, size, size, CV_8U, 0, 256);
// sum.create(size + 1, size + 1, CV_32S);
//
// d_src = src;
// d_sum.create(size + 1, size + 1, CV_32S);
//
// for (int i = 0; i < 5; ++i)
// {
// SUBTEST << "size " << size << ", 8U";
//
// CPU_ON;
// integral(src, sum);
// CPU_OFF;
//
// GPU_ON;
// gpu::integralBuffered(d_src, d_sum, d_buf);
// GPU_OFF;
// }
//}
TEST(integral)
{
Mat src, sum;
gpu::GpuMat d_src, d_sum, d_buf;
int size = 4000;
gen(src, size, size, CV_8U, 0, 256);
sum.create(size + 1, size + 1, CV_32S);
d_src = src;
d_sum.create(size + 1, size + 1, CV_32S);
for (int i = 0; i < 5; ++i)
{
SUBTEST << "size " << size << ", 8U";
CPU_ON;
integral(src, sum);
CPU_OFF;
GPU_ON;
gpu::integralBuffered(d_src, d_sum, d_buf);
GPU_OFF;
}
}
TEST(norm)
@ -653,4 +653,31 @@ TEST(cvtColor)
cv::swap(src, dst);
d_src.swap(d_dst);
}
TEST(erode)
{
Mat src, dst, ker;
gpu::GpuMat d_src, d_dst;
for (int size = 2000; size <= 4000; size += 1000)
{
SUBTEST << "size " << size;
gen(src, size, size, CV_8UC4, Scalar::all(0), Scalar::all(256));
ker = getStructuringElement(MORPH_RECT, Size(3, 3));
dst.create(src.size(), src.type());
CPU_ON;
erode(src, dst, ker);
CPU_OFF;
d_src = src;
d_dst.create(d_src.size(), d_src.type());
GPU_ON;
gpu::erode(d_src, d_dst, ker);
GPU_OFF;
}
}

View File

@ -60,10 +60,13 @@ void inline contextOff()
safeCall(cuCtxPopCurrent(&prev_context));
}
// GPUs data
GpuMat d_left[2];
GpuMat d_right[2];
StereoBM_GPU* bm[2];
GpuMat d_result[2];
// CPU result
Mat result;
int main(int argc, char** argv)