From 60246b9e77b1e9b1dc83054b0a6529c1b771fb04 Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Thu, 12 Aug 2010 13:29:49 +0000 Subject: [PATCH] added gpu test : stereobp --- tests/gpu/src/meanshift.cpp | 2 ++ tests/gpu/src/stereo_bp.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/gpu/src/stereo_bp.cpp diff --git a/tests/gpu/src/meanshift.cpp b/tests/gpu/src/meanshift.cpp index 41c82d0..8d5ea68 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 0000000..cb25142 --- /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; -- 2.7.4