为什么cv :: gpu :: GaussianBlur比cv :: GaussianBlur慢? [英] Why cv::gpu::GaussianBlur is slower, than cv::GaussianBlur?

查看:1429
本文介绍了为什么cv :: gpu :: GaussianBlur比cv :: GaussianBlur慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是在C + +,OpenCV和CUDA的亲,不明白为什么

I'm not a pro in C++, OpenCV and CUDA, and don't understand why

cv::gpu::warpPerspective(g_mask, g_frame, warp_matrix, g_frame.size(), 
    cv::INTER_LINEAR, cv::BORDER_CONSTANT, cv::Scalar(255,255,255));
cv::gpu::GaussianBlur(g_frame, g_frame, cv::Size(blur_radius, blur_radius), 0);
g_frame.download(mask);

cv::gpu::warpPerspective(g_mask, g_frame, warp_matrix, g_frame.size(), 
    cv::INTER_LINEAR, cv::BORDER_CONSTANT, cv::Scalar(255,255,255));
g_frame.download(mask);
cv::GaussianBlur(mask, mask, cv::Size(blur_radius, blur_radius), 0);

告诉我,为什么会发生这种情况?或者我写错了代码?

Tell me, why is this happening? Or i wrote wrong code?

推荐答案

IPC对GPU的开销通常是罪魁祸首。您应该考虑使用cv :: Stream接口以最小化开销。

IPC overhead to the GPU is usually the culprit. You should consider using the cv::Stream interfaces to minimize that overhead.

这篇关于为什么cv :: gpu :: GaussianBlur比cv :: GaussianBlur慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆