Why cv::gpu::GaussianBlur is slower, than cv::GaussianBlur?

喜你入骨 提交于 2019-12-13 05:27:20

问题


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);

is slower, than

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?


回答1:


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



来源:https://stackoverflow.com/questions/15035907/why-cvgpugaussianblur-is-slower-than-cvgaussianblur

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!