From 723a99a5414cc9555703c0a27d003fd5bcfff5ca Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Thu, 12 Aug 2010 12:50:02 +0000 Subject: [PATCH] added test for gpu: meanshift --- tests/gpu/src/meanshift.cpp | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/gpu/src/meanshift.cpp diff --git a/tests/gpu/src/meanshift.cpp b/tests/gpu/src/meanshift.cpp new file mode 100644 index 0000000000..41c82d0db9 --- /dev/null +++ b/tests/gpu/src/meanshift.cpp @@ -0,0 +1,39 @@ +#include "gputest.hpp" +#include +#include + +#include +#include + +class CV_GpuMeanShift : public CvTest +{ + public: + CV_GpuMeanShift(); + protected: + void run(int); +}; + +CV_GpuMeanShift::CV_GpuMeanShift(): CvTest( "GPU-MeanShift", "meanshift" ){} + +void CV_GpuMeanShift::run(int ) +{ + int spatialRad = 30; + int colorRad = 30; + + cv::Mat img = cv::imread(std::string(ts->get_data_path()) + "meanshift/con.png"); + cv::Mat img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result.png"); + + cv::Mat rgba; + cvtColor(img, rgba, CV_BGR2BGRA); + + cv::gpu::GpuMat res; + + cv::gpu::meanShiftFiltering_GPU( cv::gpu::GpuMat(rgba), res, spatialRad, colorRad ); + + double norm = cv::norm(res, img_template, cv::NORM_INF); + + ts->set_failed_test_info((norm < 0.5) ? CvTS::OK : CvTS::FAIL_GENERIC); +} + + +CV_GpuMeanShift CV_GpuMeanShift_test;