1、废话不多说
上代码
/**
* .
*
* \param Input 输入图片 支持任意数据类型
* \param Output 输出图片 CV_32FCN
* \param Sigma 高斯滤波的Sigma值
* \param mode 高斯滤波的类型 同Halcon 支持 x、y、none、xx、xy、yy、
*/
void DerivateGauss(const Mat &Input,Mat &Output,double Sigma,const std::string &mode) {
Mat Res;
if (Input.type() != CV_32F) {
Input.convertTo(Res, CV_32F);
}
else {
Res = Input;
}
auto PairFilterParam = genFilterParam(Sigma,mode);
sepFilter2D(Res,Output,CV_32F,PairFilterParam.first,PairFilterParam.second,Point(-1,-1),0,
BORDER_DEFAULT
);
}
以下为结果比较截图
数值与Halcon的输出结果一摸一样、运行速度为Halcon的1-1.5倍
测试图片大小4656*3496单通道
测试CPU i5-10400F
halcon 50ms
我的 68ms (可提供纯C实现 和Halcon速度无差别)
私信我 提供测试dll 验证后再购买
源码有偿 可私信我