added gpu test : stereobp
authorAndrey Morozov <no@email>
Thu, 12 Aug 2010 13:29:49 +0000 (13:29 +0000)
committerAndrey Morozov <no@email>
Thu, 12 Aug 2010 13:29:49 +0000 (13:29 +0000)
tests/gpu/src/meanshift.cpp
tests/gpu/src/stereo_bp.cpp [new file with mode: 0644]

index 41c82d0..8d5ea68 100644 (file)
@@ -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 (file)
index 0000000..cb25142
--- /dev/null
@@ -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;