diff --git a/tests/gpu/src/meanshift.cpp b/tests/gpu/src/meanshift.cpp index 41c82d0db9..8d5ea68555 100644 --- a/tests/gpu/src/meanshift.cpp +++ b/tests/gpu/src/meanshift.cpp @@ -30,6 +30,8 @@ void CV_GpuMeanShift::run(int ) cv::gpu::meanShiftFiltering_GPU( cv::gpu::GpuMat(rgba), res, spatialRad, colorRad ); + res.convertTo(res, img_template.type()); + double norm = cv::norm(res, img_template, cv::NORM_INF); ts->set_failed_test_info((norm < 0.5) ? CvTS::OK : CvTS::FAIL_GENERIC); diff --git a/tests/gpu/src/stereo_bp.cpp b/tests/gpu/src/stereo_bp.cpp new file mode 100644 index 0000000000..cb251421e5 --- /dev/null +++ b/tests/gpu/src/stereo_bp.cpp @@ -0,0 +1,38 @@ +#include "gputest.hpp" +#include +#include + +#include +#include + +class CV_GpuStereoBP : public CvTest +{ + public: + CV_GpuStereoBP(); + protected: + void run(int); +}; + +CV_GpuStereoBP::CV_GpuStereoBP(): CvTest( "GPU-StereoBP", "StereoBP" ){} + +void CV_GpuStereoBP::run(int ) +{ + cv::Mat img_l = cv::imread(std::string(ts->get_data_path()) + "stereobp/aloe-L.png"); + cv::Mat img_r = cv::imread(std::string(ts->get_data_path()) + "stereobp/aloe-R.png"); + cv::Mat img_template = cv::imread(std::string(ts->get_data_path()) + "stereobp/aloe-disp.png", 0); + + cv::gpu::GpuMat disp; + cv::gpu::StereoBeliefPropagation bpm(128, 8, 4, 25, 0.1f, 15, 1); + + bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp); + + //cv::imwrite(std::string(ts->get_data_path()) + "stereobp/aloe-disp.png", disp); + + disp.convertTo(disp, img_template.type()); + + double norm = cv::norm(disp, img_template, cv::NORM_INF); + ts->set_failed_test_info((norm < 0.5) ? CvTS::OK : CvTS::FAIL_GENERIC); +} + + +CV_GpuStereoBP CV_GpuStereoBP_test;