←Select platform

SampleTargetCommand Class

Summary

Corrects color values by shifting the sample colors to the target colors. This command is available in the Imaging Pro and above toolkits.

Syntax
C#
VB
C++
public class SampleTargetCommand : RasterCommand 
Public Class SampleTargetCommand  
   Inherits RasterCommand 
public ref class SampleTargetCommand : public RasterCommand   

Remarks
  • For example, suppose you are working with a color image. In the SampleColor property or the sampleColor parameter, set the red value portion of the RasterColor structure to 125, the green portion to 165 and the blue portion to 100. In the TargetColor property or the targetColor parameter you set the red value portion to 170, the green to 120 and the blue to 200. If you set SampleTargetCommandFlags.Blue in the Flags property or the flags parameter, then for every pixel in the image that has a blue value of 100, that blue value will be changed to 200, thus shifting the colors in the image. Depending on whether you set SampleTargetCommandFlags.Low, SampleTargetCommandFlags.Mid, or SampleTargetCommandFlags.High, either the shadow values in the blue channel will be remapped, or the midtone values in the blue channel will be remapped, or the highlight values in the blue channel will be remapped.
  • This command supports 12 and 16-bit grayscale and 48 and 64-bit color images.
  • For gray scale images the gray value of the SampleColor and TargetColor properties or the sampleColor and targetColor parameters are used, and the different channel flags have the same effect since it works on the same channel (gray channel). Support for 12 and 16-bit grayscale and 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 Correcting Colors.

Example

Run the SampleTargetCommand on an image.

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Color; 
 
public void SampleTargetCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "sample5.cmp")); 
 
   // Prepare the command 
   SampleTargetCommand command = new SampleTargetCommand(); 
   command.SampleColor = new RasterColor(50, 100, 150); 
   command.TargetColor = new RasterColor(60, 90, 150); 
   command.Flags = SampleTargetCommandFlags.Red | SampleTargetCommandFlags.High; 
   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"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Color 
 
Public Sub SampleTargetCommandExample() 
   Dim codecs As New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
 
   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "sample5.cmp")) 
 
   ' Prepare the command 
   Dim command As SampleTargetCommand = New SampleTargetCommand 
   command.SampleColor = New RasterColor(50, 100, 150) 
   command.TargetColor = New RasterColor(60, 90, 150) 
   command.Flags = SampleTargetCommandFlags.Red Or SampleTargetCommandFlags.High 
   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 

Requirements

Target Platforms

See Also

Reference

SampleTargetCommand Members

Leadtools.ImageProcessing.Color Namespace

Introduction to Image Processing With LEADTOOLS

Correcting Colors

Leadtools.ImageProcessing.Effects.AddNoiseCommand

Leadtools.ImageProcessing.Effects.EmbossCommand

Leadtools.ImageProcessing.Effects.MosaicCommand

Leadtools.ImageProcessing.Effects.MotionBlurCommand

Leadtools.ImageProcessing.Effects.OilifyCommand

PosterizeCommand Class

RemoveRedEyeCommand Class

SolarizeCommand Class

Leadtools.ImageProcessing.SpecialEffects.BumpMapCommand

Leadtools.ImageProcessing.Effects.CubismCommand

Leadtools.ImageProcessing.SpecialEffects.DrawStarCommand

Leadtools.ImageProcessing.SpecialEffects.GlowCommand

Leadtools.ImageProcessing.SpecialEffects.FreePlaneBendCommand

Leadtools.ImageProcessing.SpecialEffects.DryCommand

Leadtools.ImageProcessing.SpecialEffects.OceanCommand

Leadtools.ImageProcessing.SpecialEffects.GlassEffectCommand

Leadtools.ImageProcessing.SpecialEffects.LensFlareCommand

Leadtools.ImageProcessing.SpecialEffects.LightCommand

Leadtools.ImageProcessing.SpecialEffects.FreeRadialBendCommand

Leadtools.ImageProcessing.SpecialEffects.PlaneBendCommand

Leadtools.ImageProcessing.SpecialEffects.PlaneCommand

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

AdjustTintCommand Class

Leadtools.ImageProcessing.Effects.ColorHalftoneCommand

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.Color Assembly