Ask Your Question

paul's profile - activity

2013-05-07 14:31:40 -0500 received badge  Student (source)
2013-04-16 20:01:59 -0500 commented question Using gpu::BroxOpticalFlow, assertion failed

For future reference :). The cause of the error was the scale parameter (50.0f). Obviously, a scale parameter this big fills up the GPU memory in no time. I will just go ahead now and let the poster in the above link know.

2013-04-16 19:11:58 -0500 asked a question Using gpu::BroxOpticalFlow, assertion failed

Hi,

I am trying to run gpu::BroxOpticalFlow on some images. I get an assertion error:

OpenCV Error: Assertion failed (_rows >= 0 && _cols >= 0) in unknown function, file ..\..\opencv-2.4\modules\core\src\gpumat.cpp, line 1525

Here's my code snippet:

int main() 
{ 
    cv::Mat img1;
    cv::Mat img2;
    img1 = imread("1.png", CV_LOAD_IMAGE_GRAYSCALE);
    img2 = imread("2.png", CV_LOAD_IMAGE_GRAYSCALE);
    namedWindow( "window1", CV_WINDOW_AUTOSIZE );
    imshow( "window1", img1 );
    namedWindow( "window2", CV_WINDOW_AUTOSIZE );
    imshow( "window2", img2 );

    img1.convertTo(img1, CV_32FC1);
    img2.convertTo(img2, CV_32FC1);

    cv::gpu::GpuMat img1gpu(img1);
    cv::gpu::GpuMat img2gpu(img2);

    cv::gpu::GpuMat FlowXGPU;
    cv::gpu::GpuMat FlowYGPU;

    cv::gpu::BroxOpticalFlow OpticalFlowGPU = cv::gpu::BroxOpticalFlow(0.197f, 0.8f, 50.0f, 10, 77, 10);

    OpticalFlowGPU(img1gpu, img2gpu, FlowXGPU, FlowYGPU);

    cv::Mat FlowX;
    cv::Mat FlowY;
    FlowXGPU.download(FlowX);
    FlowYGPU.download(FlowY);

    waitKey(0);
}

The usage of the Brox function is the same as in a post here: http://stackoverflow.com/questions/15069255/opencv-brox-optical-flow-exception-in-opencv-core244dcvglbufferunbind. I just wanted to see if it works.

I'm pretty sure this has to do with the sizes of FlowXGPU and FlowYGPU... I'm very new to OpenCV and would really appreciate some advice.

Thank you.

2013-04-16 10:23:25 -0500 asked a question compiling OpenCV with CUDA and OpenGL

Hi.

I am trying to use Brox's gpu optical flow algorithm in OpenCV. I read that for this, OpenCV must be recompiled with CUDA and OpenGL enabled. I am using OpenCV 2.4.9 (? - the 'master' branch from the repository), CUDA 5.0 and VS 2010 Express under Windows 7 64 bit. I have the latest updates for the OS, VS and my graphics card (GTX 660).

I build the solution with CMake, WITH_CUDA and WITH_OPENGL ticked. It builds successfully, although some libraries (WEBP, GIGEAPI) are not found. I don't know if this is relevant. In CMake, I did not touch the detected CUDA options (path found correctly and if I understand correctly, it wants to build for multiple computing capabilities, etc.).

When I try to compile the solution in VS, 16 build fail, sadly, opencv_gpu among them. The error messages are the following:

1, Error    36  error C2065: 'CV_StsBadArg' : undeclared identifier C:\CODE\opencv-master\modules\softcascade\test\utility.cpp  78  1   opencv_test_softcascade

2, Error    1212    error C2065: 'CV_StsNotImplemented' : undeclared identifier C:\CODE\opencv-master\modules\gpu\src\arithm.cpp    80  1   opencv_gpu

3, Error    1218    error C3861: 'cvLoad': identifier not found C:\CODE\opencv-master\modules\gpu\src\cascadeclassifier.cpp 787 1   opencv_gpu

4, Error    1518    error LNK1104: cannot open file '..\..\..\lib\Debug\opencv_gpu249d.lib' C:\CODE\opencv_build\modules\gpu\perf4au\LINK   gpu_perf4au

and 13 other LNK1104s for different projects, all failing to link opencv_gpu249d.lib)

There are many other C2065s, C2228s, C3861s, C2146s, C2059s and the like, but I figure that they must be caused by the same reason.

Any help or advice is welcome. If there is a solution to this without having to recompile, I'm open for that too.

Thanks.