我正在运行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 ++逻辑错误,但对于我的生活,我无法理解,请帮助我。
答案 0 :(得分:2)
作为错误消息和文档状态,match
引用了std::vector<DMatch>
,而不是 a std::vector<std::vector<DMatch>>
,是你要经过的。