←Select platform

StretchIntensityCommand Class

Summary
Increases the contrast in an image by centering, maximizing, and proportioning the range of intensity values.
Syntax
C#
VB
Objective-C
C++
Java
public class StretchIntensityCommand : RasterCommand 
Public Class StretchIntensityCommand  
   Inherits RasterCommand 
@interface LTStretchIntensityCommand : LTRasterCommand 
public class StretchIntensityCommand extends RasterCommand 
public ref class StretchIntensityCommand : public RasterCommand   
Remarks
  • Unlike the ChangeContrastCommand command, this command always retains the original number of different intensity values. (Ordinary contrast adjustments can lose values at the high and low ends of the scale.)
  • This command supports 12 and 16-bit grayscale and 48 and 64-bit color images. 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 32-bit grayscale images.

If the image has a LUT and you want to work on the image data, set RasterImage.UseLookupTable to false. Then, after calling the method, reset the UselookupTable property to true, as follows:

rasterImage.UseLookupTable = false; 
Method(rasterImage); 
rasterImage.UseLookupTable = true; 

For more information, refer to Changing Brightness and Contrast.

Example

Run the StretchIntensityCommand on an image and maximize its range of intensity values.

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Color; 
 
public void StretchIntensityCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP")); 
 
   // Prepare the command 
   StretchIntensityCommand command = new StretchIntensityCommand(); 
   //Stretch the intensity. 
   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:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing.Color 
 
Public Sub StretchIntensityCommandExample() 
   Dim codecs As New RasterCodecs() 
   codecs.ThrowExceptionsOnInvalidImages = True 
 
   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP")) 
 
   ' Prepare the command 
   Dim command As StretchIntensityCommand = New StretchIntensityCommand 
   'Stretch the intensity. 
 
   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:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

See Also

Reference

StretchIntensityCommand Members

Leadtools.ImageProcessing.Color Namespace

Changing Brightness and Contrast

ChangeIntensityCommand Class

GammaCorrectCommand Class

ChangeContrastCommand Class

HistogramContrastCommand Class

RemapIntensityCommand Class

InvertCommand Class

ChangeHueCommand Class

ChangeSaturationCommand Class

HistogramEqualizeCommand Class

Leadtools.ImageProcessing.FillCommand

HistogramCommand Class

Leadtools.ImageProcessing.Core.WindowLevelCommand

ChannelMixerCommand Class

Leadtools.ImageProcessing.Effects.DeinterlaceCommand

DesaturateCommand Class

Leadtools.ImageProcessing.Effects.EdgeDetectStatisticalCommand

LightControlCommand Class

Leadtools.ImageProcessing.Effects.SmoothEdgesCommand

LocalHistogramEqualizeCommand Class

AddWeightedCommand Class

ColorMergeCommand Class

ColorSeparateCommand Class

MultiplyCommand Class

AutoColorLevelCommand Class

ColorLevelCommand Class

Leadtools.ImageProcessing.Core.CorrelationListCommand

GrayScaleToDuotoneCommand Class

GrayScaleToMultitoneCommand Class

Leadtools.ImageProcessing.Core.HolePunchRemoveCommand

SelectiveColorCommand Class

Leadtools.ImageProcessing.Effects.SkeletonCommand

ChangeHueSaturationIntensityCommand Class

ColorReplaceCommand Class

ColorThresholdCommand Class

MathematicalFunctionCommand Class

SegmentCommand Class

AdaptiveContrastCommand Class

ApplyMathematicalLogicCommand Class

ColorIntensityBalanceCommand Class

Leadtools.ImageProcessing.Core.ColorizeGrayCommand

ContrastBrightnessIntensityCommand Class

Leadtools.ImageProcessing.Core.DigitalSubtractCommand

DynamicBinaryCommand Class

Leadtools.ImageProcessing.Effects.EdgeDetectEffectCommand

Leadtools.ImageProcessing.SpecialEffects.FunctionalLightCommand

Leadtools.ImageProcessing.Core.MultiscaleEnhancementCommand

Leadtools.ImageProcessing.Core.SelectDataCommand

Leadtools.ImageProcessing.Core.ShiftDataCommand

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

Leadtools.ImageProcessing.Color Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.