fixed bug with prefilter_xsobel preset.
authorAnatoly Baksheev <no@email>
Mon, 13 Dec 2010 13:42:35 +0000 (13:42 +0000)
committerAnatoly Baksheev <no@email>
Mon, 13 Dec 2010 13:42:35 +0000 (13:42 +0000)
modules/gpu/src/cuda/stereobm.cu
modules/gpu/src/stereobm.cpp
tests/gpu/src/stereo_bm.cpp

index adc1ae07f543a09f71d9ccee49d63c8d1dd1dec5..ca6a6ab3a4bc2c638c1b32fa77faefc03b2093b8 100644 (file)
@@ -390,7 +390,6 @@ extern "C" __global__ void prefilter_kernel(DevMem2D output, int prefilterCap)
     }\r
 }\r
 \r
-\r
 extern "C" void prefilter_xsobel(const DevMem2D& input, const DevMem2D& output, int prefilterCap, cudaStream_t & stream)\r
 {\r
     cudaChannelFormatDesc desc = cudaCreateChannelDesc<unsigned char>();\r
index 2e6f8bd1255ea5ef27469dca8f907b4c261cdbcc..fb8f7515b6bbadb858d429ba1597c09e5d718bb6 100644 (file)
@@ -62,7 +62,7 @@ namespace cv { namespace gpu
     {\r
         //extern "C" void stereoBM_GPU(const DevMem2D& left, const DevMem2D& right, const DevMem2D& disp, int ndisp, int winsz, const DevMem2D_<uint>& minSSD_buf);\r
         extern "C" void stereoBM_GPU(const DevMem2D& left, const DevMem2D& right, const DevMem2D& disp, int ndisp, int winsz, const DevMem2D_<uint>& minSSD_buf, cudaStream_t & stream);\r
-        extern "C" void prefilter_xsobel(const DevMem2D& input, const DevMem2D output, int prefilterCap /*= 31*/, cudaStream_t & stream);\r
+        extern "C" void prefilter_xsobel(const DevMem2D& input, const DevMem2D& output, int prefilterCap /*= 31*/, cudaStream_t & stream);\r
         extern "C" void postfilter_textureness(const DevMem2D& input, int winsz, float avgTexturenessThreshold, const DevMem2D& disp, cudaStream_t & stream);\r
     }\r
 }}\r
index b1d5d426a5b71847e4d1bbbdc5f6747dba260c1a..c01912f3694e3ed5a4ab26319607409f8e4cf03c 100644 (file)
 
 #include "opencv2/highgui/highgui.hpp"
 
+using namespace cv;
+using namespace cv::gpu;
+
 struct CV_GpuStereoBMTest : public CvTest
 {
        CV_GpuStereoBMTest() : CvTest( "GPU-StereoBM", "StereoBM" ){}
     ~CV_GpuStereoBMTest() {}
 
+
+    void run_stress()
+    {
+        //cv::setBreakOnError(true);
+        int winsz[] = { 13, 15, 17, 19 };
+        int disps[] = { 128, 160, 192, 256};
+
+        Size res[] = { Size(1027, 768), Size(1280, 1024), Size(1600, 1152), Size(1920, 1080) };        
+        RNG rng;
+
+        for(int i = 0; i < 10; ++i)
+        {
+            int winSize = cvRound(rng.uniform(2, 11)) * 2 + 1;
+
+            for(int j = 0; j < 10; ++j)
+            {
+                int ndisp = cvRound(rng.uniform(5, 32)) * 8;
+
+                for(int s = 0; s < 10; ++s)
+                {
+                    int w =  cvRound(rng.uniform(1024, 2048));
+                    int h =  cvRound(rng.uniform(768, 1152));
+
+                    for(int p = 0; p < 2; ++p)
+                    {
+                        //int winSize = winsz[i];
+                        //int disp = disps[j];
+                        Size imgSize(w, h);//res[s];
+                        int preset = p;
+
+                        printf("Preset = %d, nidsp = %d, winsz = %d, width = %d, height = %d\n", p, ndisp, winSize, imgSize.width, imgSize.height);
+
+                        GpuMat l(imgSize, CV_8U);
+                        GpuMat r(imgSize, CV_8U);
+
+                        GpuMat disparity;
+                        StereoBM_GPU bm(preset, ndisp, winSize);
+                        bm(l, r, disparity);
+
+            
+                    }
+                }
+            }
+        }
+    }
+
     void run(int )
     {
+        /*run_stress();
+        return;*/
+
            cv::Mat img_l = cv::imread(std::string(ts->get_data_path()) + "stereobm/aloe-L.png", 0);
            cv::Mat img_r = cv::imread(std::string(ts->get_data_path()) + "stereobm/aloe-R.png", 0);
            cv::Mat img_reference = cv::imread(std::string(ts->get_data_path()) + "stereobm/aloe-disp.png", 0);