VC++ 2010 looking for SURF_GPU in wrong .dll

asked 2013-06-16 16:25:41 -0500

Visidyn gravatar image

updated 2013-06-16 16:30:00 -0500

Hello, I am trying to write a homography program using the GPU functionality in VC++ 2010 on Windows 7. I have the most recent Nvidia drivers and CUDA 5.0. I am using this page as a reference for how to use the GPU to use SURF_GPU and how to find the keypoints and descriptors:

Here is what my code looks like so far (I have not written the findhomography functionality yet):

#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/nonfree/gpu.hpp>
#include "opencv2/gpu/gpu.hpp"
using namespace std;
using namespace cv;
using namespace gpu;

int main()
    Mat img; // The object the image will be loaded into
    VideoCapture cap(0); // The video object that will get the image from the webcam
    Mat frame; // The individual frame from the video
    Mat window; // Object that will serve as window

    GpuMat img_gpu, vid_gpu; // The image and video GPU objects
    GpuMat imgkey_gpu, vidkey_gpu; // The image and video GPU keyframe objects
    GpuMat imgdes_gpu, viddes_gpu; // The image and video GPu descriptors
    gpu::SURF_GPU surf; // Declares a surf object

    vector<cv::KeyPoint> imgkey_vec, vidkey_vec; // The vector for the image and video keypoints
    vector<float> imgdes_vec, viddes_vec; // The vector for the image and video descriptors
    vector<vector<cv::DMatch>> matches; // The vector for the matches

    img = imread("snapshot.jpg",CV_LOAD_IMAGE_GRAYSCALE); // Loads the image into the img object in b/w

    while (1)
        cap >> frame; // Puts individual video frame into the 'frame' object


        surf(img_gpu, GpuMat(), imgkey_gpu, imgdes_gpu, false);
        surf(vid_gpu, GpuMat(), vidkey_gpu, viddes_gpu, false);

        surf.downloadKeypoints(imgkey_gpu, imgkey_vec);
        surf.downloadKeypoints(vidkey_gpu, vidkey_vec);
        surf.downloadDescriptors(imgdes_gpu, imgdes_vec);
        surf.downloadDescriptors(viddes_gpu, viddes_vec);

        BruteForceMatcher_GPU<cv::L2<float>> matcher;
        GpuMat trainIdx, distance;
        matcher.radiusMatch(imgkey_gpu, vidkey_gpu, matches, 0.1f);
        drawMatches(img, imgkey_vec, frame, vidkey_vec, matches, window);
        if (waitKey(30)>0)break;

My program compiles fine, however, when I run it, I encounter this error:

image description

When I comment out the 'downloadDescriptors' function, I get the same error only with the 'downloadKeypoints' function. When I comment this out, I get the same error only with the SURF_GPU function. From my understanding the error indicates that it is looking for SURF_GPU in opencv_gpu245d.dll, while I know SURF_GPU has been relocated to nonfree245d.dll, which I have also included in the additional dependencies. If I remove the opencv_gpu245d.dll, it will break other functions. How do I tell VC++ to look for SURF_GPU in nonfree245d.dll? Is this even my problem?

Thanks for your help.

edit retag flag offensive close merge delete