Commit 5c3495a0 authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

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

parent da6aa774
...@@ -113,7 +113,7 @@ Returns true if the device has the given GPU feature, otherwise false. ...@@ -113,7 +113,7 @@ Returns true if the device has the given GPU feature, otherwise false.
\cvdefCpp{bool DeviceInfo::has(GpuFeature feature);} \cvdefCpp{bool DeviceInfo::has(GpuFeature feature);}
\begin{description} \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} \end{description}
...@@ -131,7 +131,7 @@ This class provides functionality (as set of static methods) for checking which ...@@ -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: The following method checks whether the module was built with the support of the given feature:
\cvdefCpp{static bool builtWith(GpuFeature feature);} \cvdefCpp{static bool builtWith(GpuFeature feature);}
\begin{description} \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} \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): There are a set of methods for checking whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
......
...@@ -125,7 +125,6 @@ private: ...@@ -125,7 +125,6 @@ private:
void name##_test::run() void name##_test::run()
#define SUBTEST TestSystem::instance().subtest() #define SUBTEST TestSystem::instance().subtest()
#define DESCRIPTION TestSystem::instance().subtest()
#define CPU_ON TestSystem::instance().cpuOn() #define CPU_ON TestSystem::instance().cpuOn()
#define GPU_ON TestSystem::instance().gpuOn() #define GPU_ON TestSystem::instance().gpuOn()
#define CPU_OFF TestSystem::instance().cpuOff() #define CPU_OFF TestSystem::instance().cpuOff()
......
...@@ -167,32 +167,32 @@ TEST(cornerHarris) ...@@ -167,32 +167,32 @@ TEST(cornerHarris)
} }
//TEST(integral) TEST(integral)
//{ {
// Mat src, sum; Mat src, sum;
// gpu::GpuMat d_src, d_sum, d_buf; gpu::GpuMat d_src, d_sum, d_buf;
//
// int size = 4000; int size = 4000;
//
// gen(src, size, size, CV_8U, 0, 256); gen(src, size, size, CV_8U, 0, 256);
// sum.create(size + 1, size + 1, CV_32S); sum.create(size + 1, size + 1, CV_32S);
//
// d_src = src; d_src = src;
// d_sum.create(size + 1, size + 1, CV_32S); d_sum.create(size + 1, size + 1, CV_32S);
//
// for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i)
// { {
// SUBTEST << "size " << size << ", 8U"; SUBTEST << "size " << size << ", 8U";
//
// CPU_ON; CPU_ON;
// integral(src, sum); integral(src, sum);
// CPU_OFF; CPU_OFF;
//
// GPU_ON; GPU_ON;
// gpu::integralBuffered(d_src, d_sum, d_buf); gpu::integralBuffered(d_src, d_sum, d_buf);
// GPU_OFF; GPU_OFF;
// } }
//} }
TEST(norm) TEST(norm)
...@@ -653,4 +653,31 @@ TEST(cvtColor) ...@@ -653,4 +653,31 @@ TEST(cvtColor)
cv::swap(src, dst); cv::swap(src, dst);
d_src.swap(d_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;
}
} }
\ No newline at end of file
...@@ -60,10 +60,13 @@ void inline contextOff() ...@@ -60,10 +60,13 @@ void inline contextOff()
safeCall(cuCtxPopCurrent(&prev_context)); safeCall(cuCtxPopCurrent(&prev_context));
} }
// GPUs data
GpuMat d_left[2]; GpuMat d_left[2];
GpuMat d_right[2]; GpuMat d_right[2];
StereoBM_GPU* bm[2]; StereoBM_GPU* bm[2];
GpuMat d_result[2]; GpuMat d_result[2];
// CPU result
Mat result; Mat result;
int main(int argc, char** argv) int main(int argc, char** argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment