gpt4 book ai didi

c++ - cv::gpu::SURF_GPU 使用期间的问题: ‘KeyPoint’ 未在此范围内声明

转载 作者:太空宇宙 更新时间:2023-11-03 23:18:56 25 4
gpt4 key购买 nike

这里尝试使用 opencv 的类:SURF_GPU。

testSURFGPU.cpp:

#include <opencv2/nonfree/gpu.hpp>

int main(int argc, char* argv[])
{
cv::gpu::SURF_GPU surf;

return 0;
}

控制台命令:

g++ test_surf.cpp -o test `pkg-config --cflags --libs opencv`

以下是我编译时的错误信息:

控制台响应:

    /usr/local/include/opencv2/nonfree/gpu.hpp:75:44: error: ‘KeyPoint’ was not declared in this scope
void uploadKeypoints(const std::vector<KeyPoint>& keypoints, GpuMat& keypointsGPU);
^
/usr/local/include/opencv2/nonfree/gpu.hpp:75:52: error: template argument 1 is invalid
void uploadKeypoints(const std::vector<KeyPoint>& keypoints, GpuMat& keypointsGPU);
^
/usr/local/include/opencv2/nonfree/gpu.hpp:75:52: error: template argument 2 is invalid
/usr/local/include/opencv2/nonfree/gpu.hpp:77:68: error: ‘KeyPoint’ was not declared in this scope
void downloadKeypoints(const GpuMat& keypointsGPU, std::vector<KeyPoint>& keypoints);
^
/usr/local/include/opencv2/nonfree/gpu.hpp:77:76: error: template argument 1 is invalid
void downloadKeypoints(const GpuMat& keypointsGPU, std::vector<KeyPoint>& keypoints);
^
/usr/local/include/opencv2/nonfree/gpu.hpp:77:76: error: template argument 2 is invalid
/usr/local/include/opencv2/nonfree/gpu.hpp:98:72: error: ‘KeyPoint’ was not declared in this scope
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints);
^
/usr/local/include/opencv2/nonfree/gpu.hpp:98:80: error: template argument 1 is invalid
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints);
^
/usr/local/include/opencv2/nonfree/gpu.hpp:98:80: error: template argument 2 is invalid
/usr/local/include/opencv2/nonfree/gpu.hpp:99:72: error: ‘KeyPoint’ was not declared in this scope
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, GpuMat& descriptors,
^
/usr/local/include/opencv2/nonfree/gpu.hpp:99:80: error: template argument 1 is invalid
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, GpuMat& descriptors,
^
/usr/local/include/opencv2/nonfree/gpu.hpp:99:80: error: template argument 2 is invalid
/usr/local/include/opencv2/nonfree/gpu.hpp:102:72: error: ‘KeyPoint’ was not declared in this scope
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, std::vector<float>& descriptors,
^
/usr/local/include/opencv2/nonfree/gpu.hpp:102:80: error: template argument 1 is invalid
void operator()(const GpuMat& img, const GpuMat& mask, std::vector<KeyPoint>& keypoints, std::vector<float>& descriptors,
^
/usr/local/include/opencv2/nonfree/gpu.hpp:102:80: error: template argument 2 is invalid

我做错了什么? OpenCV 的文件 (gpu.hpp) 如何无法识别 Opencv 的对象 (KeyPoint)?任何帮助将不胜感激。

谢谢。

设置:Ubuntu 14.04、OpenCV 2.4.11

最佳答案

您缺少 cv::KeyPoint 定义的包含。

尝试添加

#include <opencv2/features2d/features2d.hpp>

到您的演示代码。

关于c++ - cv::gpu::SURF_GPU 使用期间的问题: ‘KeyPoint’ 未在此范围内声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34312168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com