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;