需要帮助从 OpenCV 编译该示例

发布于 2025-01-01 14:41:42 字数 1262 浏览 1 评论 0原文

我需要帮助来编译那段 代码

它有一些我的项目需要的东西,但我无法编译它。

我按照正确的说明从源代码编译整个“OpenCV”库 那里

但是有一个大问题:

1 - 在包含文件中,在目录“opencv2/stitching”中,没有子目录称为“detail”(源文件中有一个,但 /usr/local/include/opencv2/stitching 中的编译版本中没有)。

2 - 在当前版本中,在示例中,在stitching_detailed.cpp中,对此没有任何修改!

另外,我在编译时没有任何错误...只有未使用的变量的警告...

更多信息:

所以,我使用它来编译:

g++ stitching_detail.cpp -o stitcher pkg-config --libs opencv -lopencv_stitching -lopencv_gpu

但是 opencv_stitching 中有很多错误,例如:

未定义引用`cv::gpu::buildWarpCylindricalMaps(cv::Size_, cv::Rect_, cv::Mat const&, cv::Mat const&, float, cv::gpu::GpuMat&, cv::gpu::GpuMat&, cv::gpu::Stream&)'

有没有办法删除opencv_gpu 的依赖项?因为我现在唯一的问题就是这个造成的!

重要提示:

在配置中,指定我要在没有CUDA的情况下编译OpenCV,我显然有以下第三方信息:

--其他第三方库:

-- 使用 IPP:否

-- 使用 TBB:否

-- 使用 Cuda:否

-- 使用特征:否

I need help to compile that piece of code:

It has some stuff that I need for my project, but I can't compile it.

I compile the whole ´OpenCV´ library from the source, following instructions right there:

But there's big problems:

1 - in the include files, in directory "opencv2/stitching", there's not sub-directory called "detail" (there's one in the source files, but not in the compiled version in /usr/local/include/opencv2/stitching).

2 - in the current version, in the sample, in stitching_detailed.cpp, there's no modification at all regarding this!

Also, I didn't have any error while compiling... there's only warnings for unused variables...

MORE INFO:

So, I'm using this to compile:

g++ stitching_detail.cpp -o stitcher pkg-config --libs opencv -lopencv_stitching -lopencv_gpu

But there's a lot of errors in opencv_stitching like:

undefined reference to `cv::gpu::buildWarpCylindricalMaps(cv::Size_, cv::Rect_, cv::Mat const&, cv::Mat const&, float, cv::gpu::GpuMat&, cv::gpu::GpuMat&, cv::gpu::Stream&)'

Is there a way to remove the dependencies to opencv_gpu ? Because the only problems that I have right now are caused by this!

IMPORTANT:

In the configuration, it's specified that I want to compile OpenCV without CUDA, I clearly have the following third-party information:

-- Other third-party libraries:

-- Use IPP: NO

-- Use TBB: NO

-- Use Cuda: NO

-- Use Eigen: NO

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感受沵的脚步 2025-01-08 14:41:42

您收到此错误是因为您在没有 CUDA 支持的情况下编译了库,并且有些函数需要它。
编译器正在尝试链接 cv::gpu 函数,如果您在 CMAKE 解决方案生成期间不使用 CUDA 标志,则它们不会添加到编译库中。
为了避免这种行为,您有两个选择:

  1. 使用 CUDA 标志重新编译 OpenCV。 (您需要安装所有 CUDA
    首先依赖项)
  2. 从示例代码中删除所有 cv::gpu 调用。

如果您在Windows环境下,您可以轻松下载支持cuda的预编译库并测试代码。如果您没有 CUDA 支持,代码可能会在 cv::gpu 函数期间崩溃。

第二种选择很容易做到。该代码已声明 using namespace cv,因此您只需查找所有 gpu::(function_name) 调用并将其删除。请注意不要使用 --try_gpu 参数,因为我没有阅读所有代码,这可能会在执行期间调用一些未定义的行为。

You are getting this error because you compiled the library without CUDA support and there are functions that needs it.
The compiller is trying to link against the cv::gpu functions and they are not added at the compiled library if you don't use CUDA flag during CMAKE solution generation.
To avoid this behaviour you have two options:

  1. Recompile OpenCV with CUDA flag. (you will need to install all CUDA
    dependencies first)
    :
  2. Remove all cv::gpu calls from the example code.

If you are at windows environment, you can easily download the pre-compiled library with cuda support and test the code. If you don't have CUDA support, probably the code will crash during cv::gpu functions.

The second option is pretty easy to do. The code has declared using namespace cv, so you just need to look for all gpu::(function_name) calls and erase it. Just take care to not use --try_gpu argument because I didn't read all the code and this probably will call some undefined behaviors during execution time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文