added gpu test : stereobp

pull/13383/head
Andrey Morozov 14 years ago
parent 723a99a541
commit 60246b9e77
  1. 2
      tests/gpu/src/meanshift.cpp
  2. 38
      tests/gpu/src/stereo_bp.cpp

@ -30,6 +30,8 @@ void CV_GpuMeanShift::run(int )
cv::gpu::meanShiftFiltering_GPU( cv::gpu::GpuMat(rgba), res, spatialRad, colorRad ); 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); double norm = cv::norm(res, img_template, cv::NORM_INF);
ts->set_failed_test_info((norm < 0.5) ? CvTS::OK : CvTS::FAIL_GENERIC); ts->set_failed_test_info((norm < 0.5) ? CvTS::OK : CvTS::FAIL_GENERIC);

@ -0,0 +1,38 @@
#include "gputest.hpp"
#include <iostream>
#include <string>
#include <opencv2/opencv.hpp>
#include <opencv2/gpu/gpu.hpp>
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;
Loading…
Cancel
Save