gpt4 book ai didi

opencv - 无法在 OpenCV GPU (CUDA) 中创建过滤器

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

系统信息(版本)

  • OpenCV => 3.2
  • 操作系统/平台 => Windows 10 64 位
  • 编译器 => Visual Studio 2015 社区
  • CUDA 工具包版本 => 8.0

详细说明

我正在使用基于 GPU 的函数和操作。我自己构建了支持 CUDA 的 OpenCV,大多数 GPU 功能和操作都运行良好。但是当涉及到像 createGaussianFiltercreateSobelFilter 这样的过滤器相关函数时,会捕获以下异常:

C:\OpenCV\opencv-3.2.0\modules\cudafilters\src\filtering.cpp:414: 错误:(-215) rowFilter_ != 0 in function `anonymous-namespace'::SeparableLinearFilter: :SeparableLinearFilter

重现代码

// C++ code example
// A very simple snnipet
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/cuda.hpp>
#include <opencv2/cudaimgproc.hpp>
#include <opencv2/cudafilters.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
try
{
Ptr<cuda::Filter> filterX = cuda::createSobelFilter(CV_64F, CV_64F, 1, 0, 3, 1, BORDER_DEFAULT); // x direction
}
catch (cv::Exception& e)
{
const char* err_msg = e.what();
std::cout << "exception caught: " << err_msg << std::endl;
}

return 0;
}

最佳答案

你可以找到here用于测试 CUDA 版本的 Sober 过滤器的代码。

在我看来,这是 OpenCV 开发人员的选择(CUDA API 允许 double 计算,因为我认为很长一段时间以来)。 CV_64F 或 double 浮点不被接受,因为效率较低且精度更高不值得性能下降。计算机图形不需要这种精度,因此 GPU 架构具有更多的单精度单位(更多信息 here,2010 年)。

另见 CUDA faq .

注意:游戏 GPU 与专业 GPU 尤其如此(参见 here,2015 年):

Summary of NVIDIA GPUs

NVIDIA's GTX series are known for their great FP32 performance but are very poor in their FP64 performance. The performance generally ranges between 1:24 (Kepler) and 1:32 (Maxwell). The exceptions to this are the GTX Titan cards which blur the lines between the consumer GTX series and the professional Tesla/Quadro cards.

The Kepler architecture Quadro and Tesla series card provide full double precision performance with 1:3 FP32. However, with the Quadro M6000, NVIDIA has decided to provide only minimal FP64 performance by giving it only 1:32 of FP32 capability and touting the M6000 as the best graphics card rather than the best graphics+compute card like the Quadro K6000.

AMD GPUs

AMD GPUs perform fairly well for FP64 compared to FP32. Most AMD cards (including consumer/gaming series) will give between 1:3 and 1:8 FP32 performance for FP64. The AMD Tahiti architectures tested in these benchmarks here do not suffer from the same problems FP64 problems as NVIDIA's GTX series and give a 1:4 performance. Newer Hawaii architecture consumer grade GPUs are expected to provide 1:8 performance.

The FirePro W9100, W8100 and S9150 will give you an incredible FP64 1:2 FP32 performance.

Overall, AMD GPUs hold a reputation for good double precision performance ratios compared to their NVIDIA counterparts.

关于opencv - 无法在 OpenCV GPU (CUDA) 中创建过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45430567/

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