opencv/modules/gpu/perf/perf_labeling.cpp

35 lines
809 B
C++
Raw Normal View History

2012-08-09 12:42:27 +04:00
#include "perf_precomp.hpp"
using namespace std;
using namespace testing;
2012-08-09 12:42:27 +04:00
namespace {
DEF_PARAM_TEST_1(Image, string);
2012-08-09 12:42:27 +04:00
PERF_TEST_P(Image, Labeling_ConnectedComponents, Values<string>("gpu/labeling/aloe-disp.png"))
{
cv::Mat image = readImage(GetParam(), cv::IMREAD_GRAYSCALE);
2012-08-09 18:48:25 +04:00
2012-08-10 15:01:03 +04:00
// cv::threshold(image, image, 150, 255, CV_THRESH_BINARY);
2012-08-09 12:42:27 +04:00
cv::gpu::GpuMat mask;
mask.create(image.rows, image.cols, CV_8UC1);
cv::gpu::GpuMat components;
components.create(image.rows, image.cols, CV_32SC1);
cv::gpu::connectivityMask(cv::gpu::GpuMat(image), mask, cv::Scalar::all(0), cv::Scalar::all(2));
ASSERT_NO_THROW(cv::gpu::labelComponents(mask, components));
declare.time(1.0);
TEST_CYCLE()
{
cv::gpu::labelComponents(mask, components);
}
}
} // namespace