Leadtools.Windows.Media.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.02.15
LocalHistogramEqualizeCommandBitmapEffect Class
See Also  Members   Example 
Leadtools.Windows.Media.Effects.Color Namespace : LocalHistogramEqualizeCommandBitmapEffect Class





Linearizes the number of pixels locally in an image, based on a specific color space. This can be used to bring out the detail in dark areas of an image, and smooth the edges between blocks. This class is available in LEADTOOLS Medical Imaging toolkits.

Syntax

Visual Basic (Declaration) 
Public Class LocalHistogramEqualizeCommandBitmapEffect 
   Inherits RasterCommandBitmapEffect
Visual Basic (Usage)Copy Code
Dim instance As LocalHistogramEqualizeCommandBitmapEffect
C# 
public class LocalHistogramEqualizeCommandBitmapEffect : RasterCommandBitmapEffect 
Managed Extensions for C++ 
public __gc class LocalHistogramEqualizeCommandBitmapEffect : public RasterCommandBitmapEffect 
C++/CLI 
public ref class LocalHistogramEqualizeCommandBitmapEffect : public RasterCommandBitmapEffect 
XAML Property Element Usage 

LocalHistogramEqualizeCommandBitmapEffect ...

Example

Run the LocalHistogramEqualizeCommandBitmapEffect on an image.

Visual BasicCopy Code
Public Sub LocalHistogramEqualizeCommandBitmapEffectExample(ByVal element As FrameworkElement)
   Dim effect As LocalHistogramEqualizeCommandBitmapEffect = New LocalHistogramEqualizeCommandBitmapEffect()

   effect.Height = 1
   effect.Width = 1
   effect.WidthExtension = 10
   effect.HeightExtension = 10
   effect.Type = HistogramEqualizeCommandBitmapEffectsType.Rgb
   effect.Smooth = 0
   element.BitmapEffect = effect

   Dim animation1 As Int32Animation = New Int32Animation()
   animation1.From = 1
   animation1.To = 50
   animation1.Duration = New Duration(TimeSpan.Parse("0:0:5"))
   animation1.RepeatBehavior = RepeatBehavior.Forever
   animation1.AutoReverse = True

   Dim animation2 As Int32Animation = New Int32Animation()
   animation2.From = 1
   animation2.To = 50
   animation2.Duration = New Duration(TimeSpan.Parse("0:0:5"))
   animation2.RepeatBehavior = RepeatBehavior.Forever
   animation2.AutoReverse = True

   Dim storyboard As Storyboard = New Storyboard()

   storyboard.SetTargetName(animation1, "AnimatedBitmapEffect")
   storyboard.SetTargetProperty(animation1, New PropertyPath(LocalHistogramEqualizeCommandBitmapEffect.HeightProperty))
   element.RegisterName("AnimatedBitmapEffect", effect)
   storyboard.Children.Add(animation1)

   storyboard.SetTargetName(animation2, "AnimatedBitmapEffect")
   storyboard.SetTargetProperty(animation2, New PropertyPath(LocalHistogramEqualizeCommandBitmapEffect.WidthProperty))
   element.RegisterName("AnimatedBitmapEffect", effect)
   storyboard.Children.Add(animation2)

   storyboard.Begin(element)

End Sub
C#Copy Code
public void LocalHistogramEqualizeCommandBitmapEffectExample(FrameworkElement element) 

   LocalHistogramEqualizeCommandBitmapEffect effect = new LocalHistogramEqualizeCommandBitmapEffect(); 
 
   effect.Height = 1; 
   effect.Width = 1; 
   effect.WidthExtension = 10; 
   effect.HeightExtension = 10; 
   effect.Type = HistogramEqualizeCommandBitmapEffectsType.Rgb; 
   effect.Smooth = 0; 
 
   element.BitmapEffect = effect; 
 
   Int32Animation animation1 = new Int32Animation(); 
   animation1.From = 1; 
   animation1.To = 50; 
   animation1.Duration = new Duration(TimeSpan.Parse("0:0:5")); 
   animation1.RepeatBehavior = RepeatBehavior.Forever; 
   animation1.AutoReverse = true; 
 
   Int32Animation animation2 = new Int32Animation(); 
   animation2.From = 1; 
   animation2.To = 50; 
   animation2.Duration = new Duration(TimeSpan.Parse("0:0:5")); 
   animation2.RepeatBehavior = RepeatBehavior.Forever; 
   animation2.AutoReverse = true; 
 
   Storyboard storyboard = new Storyboard(); 
 
   Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation1, new PropertyPath(LocalHistogramEqualizeCommandBitmapEffect.HeightProperty)); 
   element.RegisterName("AnimatedBitmapEffect", effect); 
   storyboard.Children.Add(animation1); 
 
   Storyboard.SetTargetName(animation2, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation2, new PropertyPath(LocalHistogramEqualizeCommandBitmapEffect.WidthProperty)); 
   element.RegisterName("AnimatedBitmapEffect", effect); 
   storyboard.Children.Add(animation2); 
 
   storyboard.Begin(element); 
 
}
XAMLCopy Code
<Page Title="CSAnimateEffect" Height="391" Width="300" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:lteffects="clr-namespace:Leadtools.Windows.Media.Effects.Color;assembly=Leadtools.Windows.Media.Effects"> 
  <Grid> 
    <Image Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Center" Source="C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 15\Images\slave.jpg"> 
      <Image.BitmapEffect> 
        <lteffects:LocalHistogramEqualizeCommandBitmapEffect x:Name="AnimatedBitmapEffect" Height="1" Width="1" WidthExtension="10" HeightExtension="10" Type="Rgb" Smooth="0" /> 
      </Image.BitmapEffect> 
      <Image.Triggers> 
        <EventTrigger RoutedEvent="Image.Loaded"> 
          <BeginStoryboard> 
            <Storyboard> 
              <Int32Animation Storyboard.TargetName="AnimatedBitmapEffect" Storyboard.TargetProperty="Height" From="1" To="50" Duration="0:0:5" RepeatBehavior="Forever" AutoReverse="True" /> 
              <Int32Animation Storyboard.TargetName="AnimatedBitmapEffect" Storyboard.TargetProperty="Width" From="1" To="50" Duration="0:0:5" RepeatBehavior="Forever" AutoReverse="True" /> 
            </Storyboard> 
          </BeginStoryboard> 
        </EventTrigger> 
      </Image.Triggers> 
    </Image> 
  </Grid> 
</Page>

Remarks

  • This class applies the histogram equalizer locally on the image. The image is divided into local rectangles of dimension (Width, Height). The number of pixels inside each local rectangle are linearized according the histogram calculated for an extended rectangle around each local rectangle. The extended rectangles are of dimension:
    ((Width+2 * WidthExtension) , ( Height + 2 * HeightExtension)).

    For an example, see the following drawing:

    A rectangle and its associated extension, where the histogram is calculated.
  • Use this class to bring out details in an image that has portions that are too dark or too bright. An example of this is a picture taken with a flashlight in a dark room. In such a picture, the subject receives good light while the background is very dark. The application of the local histogram brings out details, but creates a blocky artifact. Use Smooth to reduce the blockiness of the result.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Freezable
            System.Windows.Media.Animation.Animatable
               System.Windows.Media.Effects.BitmapEffect
                  Leadtools.Windows.Media.Effects.RasterCommandBitmapEffect
                     Leadtools.Windows.Media.Effects.Color.LocalHistogramEqualizeCommandBitmapEffect

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003

See Also