Ask Your Question

hunse's profile - activity

2014-07-04 10:17:18 -0500 received badge  Self-Learner (source)
2014-07-03 13:41:39 -0500 received badge  Editor (source)
2014-07-03 13:40:12 -0500 answered a question Segmentation fault in StereoBeliefPropagation

I found the problem. The line

cuda::StereoBeliefPropagation *bp =

should instead be

Ptr<cuda::StereoBeliefPropagation> bp =

As a note, the OpenCV GPU examples were very useful in solving this problem.

2014-06-26 13:20:58 -0500 commented question using opencv gpu functions in python

As far as I know, there is not. I've been using OpenCV 3 in Python for a while now, but I had to switch to C++ to get at the CUDA functions. There is no Python API documentation for the CUDA functions, and the fact that cv2.cpp (the file that defines the Python API) doesn't import any of the CUDA-related headers further suggests to me that these functions are not available in Python.

2014-06-25 11:54:45 -0500 received badge  Student (source)
2014-06-25 11:28:57 -0500 asked a question Segmentation fault in StereoBeliefPropagation

I'm trying to get a basic example of StereoBeliefPropagation working. Here is my code:

#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/cuda.hpp"
#include "opencv2/cudastereo.hpp"

using namespace std;
using namespace cv;

int main(int argc, char* argv[])
        Mat img1_h = imread("tsukuba1.pgm", 0);
        Mat img2_h = imread("tsukuba2.pgm", 0);

        cuda::GpuMat img1, img2, disp;
        disp.upload(img1_h);  // initialize this buffer, will be overwritten

        cuda::StereoBeliefPropagation *bp =

        bp->compute(img1, img2, disp, cuda::Stream::Null());

        Mat disp_h;;
        imshow("Result", disp_h);

    catch(const cv::Exception& ex)
        cout << "Error: " << ex.what() << endl;
        return 1;
    return 0;

When I run this, I get a segmentation fault at bp->compute. Does anyone know why? I'm very new to OpenCV on the GPU, so any advice is welcome. Also, links to examples of successfully running any stereo algorithm on the GPU would be great.

I'm using OpenCV version 3.0.0dev from the beginning of April. From what I can tell, it's set up correctly with the GPU (it detects it, and I can copy images on and off). Also, if anyone wants to run this example, the tsukuba images can be found along with the source code on this page.