←Select platform

RemoveRedEyeCommand Class

Summary

Removes the "red eye" effect in color images by converting the red color in the eye to a new color.

Remarks
  • This command has no effect on grayscale images, since there is no "red eye" problem in grayscale images.
  • To use this command the user should select a small region around the eye. Otherwise, the method will change all the red color in the image. This method also allows the user to replace the red color with a new color for the eyes that is nearest to the original color.
  • This command 48 and 64-bit color images. Support for 48 and 64-bit color images is available only in the Document/Medical toolkits.
  • This command does not support signed data images.
  • This command does not support 32-bit grayscale images.

For more information, refer to Introduction to Image Processing With LEADTOOLS. For more information, refer to Applying Artistic Effects. For more information, refer to Correcting Colors.

Example

Run the RemoveRedEyeCommand on an image.

C#
VB
WinRT C#
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Color 
 
    
Public Sub RemoveRedEyeCommandExample() 
   Dim codecs As New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "red_eye.cmp")) 
 
   ' Prepare the command 
   Dim command As RemoveRedEyeCommand = New RemoveRedEyeCommand 
   'Apply the redeye removal command. 
   command.NewColor = New RasterColor(5, 20, 10) 
   command.Threshold = 125 
   command.Lightness = 100 
   command.Run(leadImage) 
   codecs.Save(leadImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24) 
 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Color; 
 
       
public void RemoveRedEyeCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "red_eye.cmp")); 
 
   // Prepare the command 
   RemoveRedEyeCommand command = new RemoveRedEyeCommand(); 
   //Apply the redeye removal command. 
   command.NewColor = new RasterColor(5, 20, 10); 
   command.Threshold = 125; 
   command.Lightness = 100; 
   command.Run(image); 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24); 
 
} 
 
static class LEAD_VARS 
{ 
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Color; 
 
       
public async Task RemoveRedEyeCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
   // Load the image 
   string srcFileName = @"Assets\Image1.cmp"; 
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); 
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); 
 
   // Prepare the command 
   RemoveRedEyeCommand command = new RemoveRedEyeCommand(); 
   //Apply the redeye removal command. 
   command.NewColor = RasterColorHelper.Create(5, 20, 10); 
   command.Threshold = 125; 
   command.Lightness = 100; 
   command.Run(image); 
 
   string destFileName = @"result.jpg"; 
   StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName); 
   await codecs.SaveAsync(image, LeadStreamFactory.Create(saveFile), RasterImageFormat.Jpeg, 0); 
} 

Requirements

Target Platforms

See Also

Reference

RemoveRedEyeCommand Members

Leadtools.ImageProcessing.Color Namespace

Introduction to Image Processing With LEADTOOLS

Applying Artistic Effects

Correcting Colors

Leadtools.ImageProcessing.SpecialEffects.BumpMapCommand

Leadtools.ImageProcessing.Effects.CubismCommand

Leadtools.ImageProcessing.SpecialEffects.DrawStarCommand

Leadtools.ImageProcessing.SpecialEffects.DryCommand

Leadtools.ImageProcessing.SpecialEffects.FreePlaneBendCommand

Leadtools.ImageProcessing.SpecialEffects.FreeRadialBendCommand

Leadtools.ImageProcessing.SpecialEffects.GlassEffectCommand

Leadtools.ImageProcessing.SpecialEffects.GlowCommand

Leadtools.ImageProcessing.SpecialEffects.LensFlareCommand

Leadtools.ImageProcessing.SpecialEffects.LightCommand

Leadtools.ImageProcessing.SpecialEffects.OceanCommand

Leadtools.ImageProcessing.SpecialEffects.PlaneBendCommand

Leadtools.ImageProcessing.SpecialEffects.PlaneCommand

SampleTargetCommand Class

Leadtools.ImageProcessing.SpecialEffects.TunnelCommand

Leadtools.ImageProcessing.SpecialEffects.BendCommand

Leadtools.ImageProcessing.SpecialEffects.CylinderCommand

Leadtools.ImageProcessing.SpecialEffects.FreeHandShearCommand

Leadtools.ImageProcessing.SpecialEffects.FreeHandWaveCommand

Leadtools.ImageProcessing.SpecialEffects.ImpressionistCommand

Leadtools.ImageProcessing.SpecialEffects.PixelateCommand

Leadtools.ImageProcessing.SpecialEffects.PolarCommand

Leadtools.ImageProcessing.SpecialEffects.PunchCommand

Leadtools.ImageProcessing.SpecialEffects.RadialBlurCommand

Leadtools.ImageProcessing.SpecialEffects.RadialWaveCommand

Leadtools.ImageProcessing.SpecialEffects.RippleCommand

Leadtools.ImageProcessing.SpecialEffects.SphereCommand

Leadtools.ImageProcessing.SpecialEffects.SwirlCommand

Leadtools.ImageProcessing.SpecialEffects.WaveCommand

Leadtools.ImageProcessing.SpecialEffects.WindCommand

Leadtools.ImageProcessing.SpecialEffects.ZoomBlurCommand

Leadtools.ImageProcessing.SpecialEffects.ZoomWaveCommand

Leadtools.ImageProcessing.SpecialEffects.ShadowCommand

Leadtools.ImageProcessing.SpecialEffects.RevEffectCommand

Leadtools.ImageProcessing.SpecialEffects.AgingCommand

Leadtools.ImageProcessing.SpecialEffects.DiceEffectCommand

Leadtools.ImageProcessing.SpecialEffects.FunctionalLightCommand

Leadtools.ImageProcessing.SpecialEffects.PuzzleEffectCommand

Leadtools.ImageProcessing.SpecialEffects.RingEffectCommand

Leadtools.ImageProcessing.Effects.TextureAlphaBlendCommand

Leadtools.ImageProcessing.SpecialEffects.BricksTextureCommand

Leadtools.ImageProcessing.SpecialEffects.CanvasCommand

Leadtools.ImageProcessing.SpecialEffects.CloudsCommand

Leadtools.ImageProcessing.SpecialEffects.ColoredBallsCommand

Leadtools.ImageProcessing.SpecialEffects.DiffuseGlowCommand

Leadtools.ImageProcessing.Effects.DisplacementCommand

Leadtools.ImageProcessing.SpecialEffects.FragmentCommand

Leadtools.ImageProcessing.Core.HalfTonePatternCommand

Leadtools.ImageProcessing.Effects.MaskConvolutionCommand

Leadtools.ImageProcessing.SpecialEffects.MosaicTilesCommand

Leadtools.ImageProcessing.Effects.OffsetCommand

Leadtools.ImageProcessing.SpecialEffects.PlasmaCommand

Leadtools.ImageProcessing.SpecialEffects.PointillistCommand

Leadtools.ImageProcessing.SpecialEffects.RomanMosaicCommand

Leadtools.ImageProcessing.SpecialEffects.VignnetCommand

Leadtools.ImageProcessing.SpecialEffects.ZigZagCommand

AdjustTintCommand Class

Leadtools.ImageProcessing.Core.HalfToneCommand

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.ImageProcessing.Color Assembly
Click or drag to resize