minor refactoring of GPU module and GPU tests

added gpu compare version for CMP_NE operation
This commit is contained in:
Vladislav Vinogradov
2010-09-20 10:34:46 +00:00
parent 73b58ad0ef
commit a2f8817df1
15 changed files with 529 additions and 286 deletions
+25 -11
View File
@@ -59,16 +59,18 @@ CV_GpuStereoCSBPTest::CV_GpuStereoCSBPTest(): CvTest( "GPU-StereoCSBP", "Constan
void CV_GpuStereoCSBPTest::run(int )
{
cv::Mat img_l = cv::imread(std::string(ts->get_data_path()) + "csstereobp/aloe-L.png");
cv::Mat img_r = cv::imread(std::string(ts->get_data_path()) + "csstereobp/aloe-R.png");
cv::Mat img_template = cv::imread(std::string(ts->get_data_path()) + "csstereobp/aloe-disp.png", 0);
cv::Mat img_l = cv::imread(std::string(ts->get_data_path()) + "csstereobp/aloe-L.png");
cv::Mat img_r = cv::imread(std::string(ts->get_data_path()) + "csstereobp/aloe-R.png");
cv::Mat img_template = cv::imread(std::string(ts->get_data_path()) + "csstereobp/aloe-disp.png", 0);
if (img_l.empty() || img_r.empty() || img_template.empty())
{
ts->set_failed_test_info(CvTS::FAIL_MISSING_TEST_DATA);
return;
}
if (img_l.empty() || img_r.empty() || img_template.empty())
{
ts->set_failed_test_info(CvTS::FAIL_MISSING_TEST_DATA);
return;
}
try
{
cv::gpu::GpuMat disp;
cv::gpu::StereoConstantSpaceBP bpm(128, 16, 4, 4);
@@ -79,9 +81,21 @@ void CV_GpuStereoCSBPTest::run(int )
disp.convertTo(disp, img_template.type());
double norm = cv::norm(disp, img_template, cv::NORM_INF);
if (norm >= 0.5)
if (norm >= 0.5)
{
ts->printf(CvTS::CONSOLE, "\nConstantSpaceStereoBP norm = %f\n", norm);
ts->set_failed_test_info((norm < 0.5) ? CvTS::OK : CvTS::FAIL_GENERIC);
ts->set_failed_test_info(CvTS::FAIL_GENERIC);
return;
}
}
catch(const cv::Exception& e)
{
if (!check_and_treat_gpu_exception(e, ts))
throw;
return;
}
ts->set_failed_test_info(CvTS::OK);
}
CV_GpuStereoCSBPTest CV_GpuCSStereoBP_test;
CV_GpuStereoCSBPTest CV_GpuCSStereoBP_test;