我正在运行 Ubuntu 12.04、OpenCV 2.4.6.0.1 和 Cuda 5.5 我得到以下代码:
BruteForceMatcher_GPU< Hamming > matcher;
ORB_GPU orb(1000);
GpuMat patternImage_descriptors;
orb(patternImage_g, GpuMat(), patternImage_keypoints, patternImage_descriptors);
// where patternImage_g is an image I'm loading with GpuMat patternImage_g(originalImage)
// after I make it Gray and resizeing it to 640x480
// then I call
vector<GpuMat> descriptors(1);
descriptors[0] = patternImage_descriptors;
matcher.add(descriptors);
// to train the matcher and then
vector< vector<DMatch> > matches;
matcher.match(frame_descriptors, matches);
// Where frame_descriptors were extracted via ORB_GPU
然后我得到这个编译错误:
MatchingEngineGPU.cpp: In member function 'void
MatchingEngineGPU::processFrameFromFile(const Frame&, Frame&)':
MatchingEngineGPU.cpp:28:43: error: no matching function for call to
'cv::gpu::BruteForceMatcher_GPU<cv::Hamming>::match(cv::gpu::GpuMat&,
std::vector<std::vector<cv::DMatch> >&)'
MatchingEngineGPU.cpp:28:43: note: candidates are:
/usr/local/include/opencv2/gpu/gpu.hpp:1388:10: note: void
cv::gpu::BruteForceMatcher_GPU_base::match(const cv::gpu::GpuMat&, const
cv::gpu::GpuMat&, std::vector<cv::DMatch>&, const cv::gpu::GpuMat&)
/usr/local/include/opencv2/gpu/gpu.hpp:1388:10: note: candidate expects 4
arguments, 2 provided
/usr/local/include/opencv2/gpu/gpu.hpp:1404:10: note: void
cv::gpu::BruteForceMatcher_GPU_base::match(const cv::gpu::GpuMat&,
std::vector<cv::DMatch>&, const std::vector<cv::gpu::GpuMat>&)
/usr/local/include/opencv2/gpu/gpu.hpp:1404:10: note: no known conversion
for argument 2 from 'std::vector<std::vector<cv::DMatch> >' to
'std::vector<cv::DMatch>&'
编译命令:
g++ *.hpp *.cpp `pkg-config --cflags --libs opencv`
我检查了 BruteForceMatcher_GPU 的文档,它具有以下功能:
void match(const GpuMat& query, std::vector<DMatch>& matches,
const std::vector<GpuMat>& masks = std::vector<GpuMat>());
这可能只是一个 C++ 逻辑错误,但对于我来说,我无法弄清楚,请帮助我。