I using visual studio 2010 with gpu opencv library.When I am using function GMG of GPU opencv library,it give me only blank output.But the normal opencv library give me correct ouput.

asked 2015-01-28 03:40:25 -0600

Lim Wen Jin gravatar image

using namespace cv;

int main()
{
Mat fgMaskGMG;

Mat frame;

gpu::GpuMat GPU_fgMaskGMG;

gpu::GpuMat GPU_frame;

gpu::setDevice(0);

VideoCapture stream1(0);       
stream1.open(0);

while (true) {    

    stream1.read(frame);
    if(!(stream1.read(frame)))     
    break;  

    GPU_frame.upload(frame);


    gpu::GMG_GPU::GMG_GPU();
    gpu::GMG_GPU GMG;
    GMG(GPU_frame,GPU_fgMaskGMG,0.03);

    GPU_fgMaskGMG.download(fgMaskGMG);

    imshow("Origin", frame); 
    imshow("GMG", fgMaskGMG);

    switch(waitKey(10)){
        case 27: 
        return 0;
    }
}

}

edit retag flag offensive close merge delete