MSRCRGIMP(基于GIMP版本的多尺度Retinex)

C++原型:

void __stdcall MSRCRGIMP(unsigned char *Src, unsigned char *Dest, int Width, int Height, int Stride, float MaxScale, int ScaleAmount, float Dynamic)

C#声明:

[DllImport("ImageProcessing.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
internal static extern void MSRCRGIMP(byte* Src, byte* Dest, int Width, int Height, int Stride, float MaxScale, int ScaleAmount, float Dynamic);

VB.NET声明:

<DllImport("ImageProcessing.dll", CallingConvention := CallingConvention.StdCall, CharSet := CharSet.Unicode, ExactSpelling := True)> _
Friend Shared Sub MSRCRGIMP(ByVal Src As IntPtr, ByVal Dest As IntPtr, ByVal Width As Integer, ByVal Height As Integer, ByVal Stride As Integer, ByVal MaxScale As Single, Byval ScaleAmount as Single, Byval Dynamic as Single) 
End Sub

VB6.0声明:

Private Declare Sub MSRCRGIMP Lib "ImageProcessing" (ByVal Src As Long, ByVal Dest As Long, ByVal Width As Long, ByVal Height As Long, ByVal Stride As Long, ByVal MaxScale As Single, Byval ScaleAmount as long, Byval Dynamic as Single)

函数说明:

/// <summary>
///  实现功能:带色彩恢复的多尺度Retinex图像增强。
///  参考论文:A Multiscale Retinex for Bridging the Gap Between Color Images and the Human Observation of Scenes
///  参考代码:Contrast-Retinex.c in Gimp. 
/// </summary>
/// <param name="Src">源图像数据在内存的起始地址。</param>
/// <param name="Dest">目标图像数据在内存的起始地址。</param>
/// <param name="Width">源和目标图像的宽度。</param>
/// <param name="Height">源和目标图像的高度。</param>
/// <param name="Stride">源和目标图像的扫描行大小。</param>
/// <param name="MaxScale"> 最大的尺度,建议范围[16-500]。 </param>
/// <param name="ScaleAmount"> 多尺度的数量,有效范围[1-8],为1时则为SSR。. </param>
/// <param name="Dynamic"> 调整图像对比度的参数,数字小则对比度强,建议范围[0.1, 4]。</param>
/// <remarks> 1: 只能处理8位或者24位图像。</remarks>
/// <remarks> 2: Src和Dest可以相同,相同和不同时速度无差异。</remarks>
/// <remarks> 3: 主要的耗时是高斯模糊部分,其他的计算量不大。</remarks>

算法效果:

    \

   

 

   

   

   

   

   

   

   

   

算法适用的对象:

  对于水下图像,或者整体偏色的图像有的较为明显的效果。能够有很好的纠正偏色的能力。对于整体偏暗的图也有较为明显的动态扩展作用。不适用于正常图像的增强。

处理速度:

  I3  M380 2.53GHZ 笔记本上测试:100万像素、ScaleAmount = 3时,用时250ms。

代码情况:

       代码本身不好并行了,但内部的高斯模糊适合并行。

posted @ 2014-10-02 20:01  Imageshop  阅读(2646)  评论(0编辑  收藏  举报