BiExponentialEPF(双指数边缘保留滤波器)
C++原型:
void __stdcall BiExponentialEPF(unsigned char *Src, unsigned char *Dest, int Width, int Height, int Stride, float SpatialContraDecay, float PhotometricStandardDeviation)
C#声明:
[DllImport("ImageProcessing.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)] internal static extern void BiExponentialEPF(byte* Src, byte* Dest, int Width, int Height, int Stride, float SpatialContraDecay, float PhotometricStandardDeviation);
VB.NET声明:
<DllImport("ImageProcessing.dll", CallingConvention := CallingConvention.StdCall, CharSet := CharSet.Unicode, ExactSpelling := True)> _ Friend Shared Sub BiExponentialEPF(ByVal Src As IntPtr, ByVal Dest As IntPtr, ByVal Width As Integer, ByVal Height As Integer, ByVal Stride As Integer, ByVal SpatialContraDecay As Single, Byval PhotometricStandardDeviation as Single) End Sub
VB6.0声明:
Private Declare Sub BiExponentialEPF Lib "ImageProcessing" (ByVal Src As Long, ByVal Dest As Long, ByVal Width As Long, ByVal Height As Long, ByVal StrideAs Long, ByVal SpatialContraDecay As Single, Byval PhotometricStandardDeviation as Single)
函数说明:
/// <summary> /// 基于Beep的边缘保留平滑滤波的实现,整理日期:2014.9.20 /// 参考论文: Bi-Exponential Edge-Preserving Smoother. /// </summary> /// <param name="Src">源图像数据在内存的起始地址。</param> /// <param name="Dest">目标图像数据在内存的起始地址。</param> /// <param name="Width">图像的宽度。</param> /// <param name="Height">图像的高度。</param> /// <param name="Stride">图像的扫描行大小。</param> /// <param name="SpatialContraDecay">空域标准差,建议取值[1,255],值越大,模糊越明显,建议取50左右能获得较好效果。</param> /// <param name="PhotometricStandardDeviation">值域的标准差,建议取值[1,255]。值越大,模糊也越明显,建议区30左右能有好效果。</param> /// <remarks> 1、程序的执行时间和算法的参数无关。 </remarks> /// <remarks> 2、Src和Dest可以相同,相同和不同时执行速度无区别。</remarks> /// <remarks> 3、采用了多线程方式,在多核下可以明显加快速度。</remarks> // <remarks> 4、此算法本身高度并行,可利用GPU等大幅加速。</remarks>
算法效果:
处理速度:
I3 M380 2.53GHZ 笔记本上测试:1000 * 1000 彩色像素,用时500ms(时间是于参数无关的)。
代码情况:
本代码是基于论文Bi-Exponential Edge-Preserving Smoother 提供的算法编写优化的,其JAVA代码可以从相关的网站上下载到。
其他说明:
算法本身是可高度并行执行的,适合于GPU实现。