From: Alexey Spizhevoy Date: Thu, 17 Feb 2011 07:02:12 +0000 (+0000) Subject: removed catch from GPU stereo_bp test as --gtest_catch_exceptions flags exists (but... X-Git-Tag: accepted/2.0/20130307.220821~3490 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f1aa1b92d132fea25f2ba5be4988e64540f2f66;p=profile%2Fivi%2Fopencv.git removed catch from GPU stereo_bp test as --gtest_catch_exceptions flags exists (but err msg isn't printed in case when there is no GPU) --- diff --git a/modules/gpu/test/test_main.cpp b/modules/gpu/test/test_main.cpp index c4b5e24..1f2c265 100644 --- a/modules/gpu/test/test_main.cpp +++ b/modules/gpu/test/test_main.cpp @@ -1,3 +1,9 @@ #include "test_precomp.hpp" +// Run test with --gtest_catch_exceptions flag to avoid runtime errors in +// the case when there is no GPU CV_TEST_MAIN("gpu") + +// TODO Add other tests from tests/gpu folder +// TODO When there is no GPU test system doesn't print error message: it fails or keeps +// quiet when --gtest_catch_exceptions is enabled diff --git a/modules/gpu/test/test_stereo_bp.cpp b/modules/gpu/test/test_stereo_bp.cpp index fcf01f7..a3b1780 100644 --- a/modules/gpu/test/test_stereo_bp.cpp +++ b/modules/gpu/test/test_stereo_bp.cpp @@ -43,7 +43,7 @@ struct CV_GpuStereoBPTest : public cvtest::BaseTest { - void run(int ) + void 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"); @@ -55,34 +55,25 @@ struct CV_GpuStereoBPTest : public cvtest::BaseTest return; } - try - { - {cv::Mat temp; cv::cvtColor(img_l, temp, CV_BGR2BGRA); cv::swap(temp, img_l);} - {cv::Mat temp; cv::cvtColor(img_r, temp, CV_BGR2BGRA); cv::swap(temp, img_r);} + {cv::Mat temp; cv::cvtColor(img_l, temp, CV_BGR2BGRA); cv::swap(temp, img_l);} + {cv::Mat temp; cv::cvtColor(img_r, temp, CV_BGR2BGRA); cv::swap(temp, img_r);} - cv::gpu::GpuMat disp; - cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S); + cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S); + cv::gpu::GpuMat disp; - bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp); + 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); + //cv::imwrite(std::string(ts->get_data_path()) + "stereobp/aloe-disp.png", disp); - disp.convertTo(disp, img_template.type()); + disp.convertTo(disp, img_template.type()); - double norm = cv::norm(disp, img_template, cv::NORM_INF); - if (norm >= 0.5) - { - ts->printf(cvtest::TS::LOG, "\nStereoBP norm = %f\n", norm); - ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC); - return; - } - } - catch(const cv::Exception& e) - { - if (!check_and_treat_gpu_exception(e, ts)) - throw; - return; - } + double norm = cv::norm(disp, img_template, cv::NORM_INF); + if (norm >= 0.5) + { + ts->printf(cvtest::TS::LOG, "\nStereoBP norm = %f\n", norm); + ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC); + return; + } ts->set_failed_test_info(cvtest::TS::OK); }