Crash When use gpu::meanShiftFiltering or gpu::meanShiftSegmentation

asked 2016-03-10 06:17:56 -0500

Hi all, I had trouble with using opencv c++ gpu module
The graphic card crashed and screen goes totally black for few seconds when code goes to gpu::meanShiftFiltering
And then error message shows up:
image description
image description

The following is my code:

#include <opencv2/opencv.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/gpu/gpu.hpp>
using namespace cv;

int main()
    //image load  
    Mat img = imread("left01.bmp", CV_LOAD_IMAGE_COLOR);  
    Mat outimg2;  

    //gpu version meanshift  
    gpu::GpuMat pimgGpu, imgGpu, outImgGpu;  

    //gpu meanshift only support 8uc4 type.  
    gpu::cvtColor(pimgGpu, imgGpu, CV_BGR2BGRA);

   //program crashed at here
    gpu::meanShiftFiltering(imgGpu, outImgGpu, 30, 30);;  

    //show image  
    imshow("origin", img);   
    imshow("MeanShift Filter gpu", outimg2);  
    return 0;

I have build opencv 2.4.9 myself
By first set cmake configuration to use compiler vc11(visual studio 2012)
image description

And I check With_CUDA option and setup cuda root path for it before generation.
image description

After that I build opencv with visual studio 2012 by click build on Project "All Build" in only release mode (The build result with 3 error and all others succeeded)
image description

Then I build Project "Install" (The build result with all succeeded)
image description

My graphic card is Nvidia Geforce 310M with compute capability 1.2
My computer has installed CUDA 6.5 driver, toolkit and SDK
image description

Can anyone tell what's wrong there?

edit retag flag offensive close merge delete


The problem seems to be the way I build opencv... But I am still trying to figure out how to build opencv with cuda in Windows... I have read tones of articles include official document but they all won't work....

JerryCwz gravatar imageJerryCwz ( 2016-03-10 06:37:24 -0500 )edit