Vital Belikov
Vital Belikov

Reputation: 364

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

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?

Upvotes: 0

Views: 2349

Answers (1)

emrainey
emrainey

Reputation: 51

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

Upvotes: 1

Related Questions