1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

most of the performance tests was rewritten in google-test manner

This commit is contained in:
ilya-lavrenov
2013-08-22 18:03:05 +04:00
parent 6c4ad9b597
commit 4c28a6f0f6
22 changed files with 2817 additions and 2735 deletions
+28 -31
View File
@@ -45,41 +45,38 @@
//M*/
#include "perf_precomp.hpp"
using namespace perf;
///////////// Canny ////////////////////////
PERFTEST(Canny)
PERF_TEST(CannyFixture, Canny)
{
Mat img = imread(abspath("aloeL.jpg"), CV_LOAD_IMAGE_GRAYSCALE);
Mat img = imread(getDataPath("gpu/stereobm/aloe-L.png"), cv::IMREAD_GRAYSCALE),
edges(img.size(), CV_8UC1);
ASSERT_TRUE(!img.empty()) << "can't open aloeL.jpg";
if (img.empty())
const std::string impl = getSelectedImpl();
declare.in(img).out(edges);
if (impl == "ocl")
{
throw runtime_error("can't open aloeL.jpg");
ocl::oclMat oclImg(img), oclEdges(img.size(), CV_8UC1);
TEST_CYCLE() Canny(oclImg, oclEdges, 50.0, 100.0);
oclEdges.download(edges);
SANITY_CHECK(edges);
}
else if (impl == "plain")
{
TEST_CYCLE() Canny(img, edges, 50.0, 100.0);
SUBTEST << img.cols << 'x' << img.rows << "; aloeL.jpg" << "; edges" << "; CV_8UC1";
Mat edges(img.size(), CV_8UC1), ocl_edges;
CPU_ON;
Canny(img, edges, 50.0, 100.0);
CPU_OFF;
ocl::oclMat d_img(img);
ocl::oclMat d_edges;
ocl::CannyBuf d_buf;
WARMUP_ON;
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
WARMUP_OFF;
GPU_ON;
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
GPU_OFF;
GPU_FULL_ON;
d_img.upload(img);
ocl::Canny(d_img, d_buf, d_edges, 50.0, 100.0);
d_edges.download(ocl_edges);
GPU_FULL_OFF;
TestSystem::instance().ExceptedMatSimilar(edges, ocl_edges, 2e-2);
SANITY_CHECK(edges);
}
#ifdef HAVE_OPENCV_GPU
else if (impl == "gpu")
CV_TEST_FAIL_NO_IMPL();
#endif
else
CV_TEST_FAIL_NO_IMPL();
}