本文介绍了为什么会EmguCV高斯模糊不返回相同的结果为OpenCV的高斯模糊?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到OpenCV的高斯模糊功能和EmguCv CvInvoke.cvSmooth / Image.SmoothGaussian功能之间的不匹配

I'm experiencing a mismatch between the OpenCV GaussianBlur function and the EmguCv CvInvoke.cvSmooth/Image.SmoothGaussian functions.

高斯模糊的呼叫:

GaussianBlur(src, dest, Size(13,13), 1.5, BORDER_REPLICATE);



EmguCV电话:

The EmguCV call:

CvInvoke.cvSmooth(src, dst, SMOOTH_TYPE.CV_GAUSSIAN, 13, 13, 1.5, 0);

在这两种情况下,src为一个32F,3通道的图像。我已经验证了SRC的内容是相同的(救了他们为bmp,做二元差异)

In both cases, src is a 32F, 3 channel image. I have verified that the contents of src are identical (saved them as bmp and did binary diff).

在OpenCV中的cvSmooth调用看起来是这样的:

The cvSmooth call in opencv looks like this:

CV_IMPL void
cvSmooth( const void* srcarr, void* dstarr, int smooth_type,
          int param1, int param2, double param3, double param4 )
{
    cv::Mat src = cv::cvarrToMat(srcarr), dst0 = cv::cvarrToMat(dstarr), dst = dst0;

    if( smooth_type == CV_GAUSSIAN )
        cv::GaussianBlur( src, dst, cv::Size(param1, param2), param3, param4, cv::BORDER_REPLICATE );
}



...这似乎是做同样的事情我原来的OpenCV的呼叫这样做。 CV_GAUSSIAN被定义为在两个EmguCV和OpenCV 2。结果落得非常接近,但EmguCV图像仍比OpenCV的图像较模糊一点点。有任何想法吗?我也crossposted 这个问题。

推荐答案

的问题是:

GaussianBlur(src, dest, Size(13,13), 1.5, BORDER_REPLICATE);



在流逝1.5作为sigma1和1(BORDER_REPLICATE)为sigma2。在Emgu代码更改为

Is passing 1.5 as sigma1, and 1 (BORDER_REPLICATE) as sigma2. Changing the Emgu code to

CvInvoke.cvSmooth(src, dst, SMOOTH_TYPE.CV_GAUSSIAN, 13, 13, 1.5, 1);

在一个完美的比赛结果。

results in a perfect match.

这篇关于为什么会EmguCV高斯模糊不返回相同的结果为OpenCV的高斯模糊?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 06:13