更新时间:2023-02-27 11:19:13
OpenCV没有内置函数来计算高斯偏导数.但是您可以使用 cv::getGaussianKernel
和 cv::filter2D
这样做.
OpenCV doesn't have built-in function to calculate Gaussian partial derivatives. But you may use cv::getGaussianKernel
and cv::filter2D
to do so.
例如:
cv::Mat kernel = cv::getGaussianKernel(3, 0.85, CV_32F);
kernel = kernel.reshape(1, 1);
cv::filter2D(img, img, CV_8U, kernel);
请注意,cv::getGaussianKernel
返回列过滤器,因此您需要reshape
将其水平放置.
Please note that cv::getGaussianKernel
returns column filter, so you need reshape
to make it horizontal.