Updates a range of entries in the lookup table, based on the specified mathematical function.
Syntax
Parameters
- lookupTable
- Lookup table array to be filled by this method. The user must set the first and the last element of the lookup table manually (i.e. lookupTable[0] = firstValue; lookupTable[tableSize - 1] = lastValue;), if you set the first element to last value and the last element to the first value then the lookup table will become inverted.
- start
- Index of the first entry in the lookup table to update. The indices of the table correspond to the intensity values. If this parameter has a negative value the corresponding index to lookupTable is equal to its value + its length. The range of its possible value is between (-lookupTable length/2) and (lookupTable length/2 - 1).
- end
- Index of the last entry in the lookup table to update. The indices of the table correspond to the intensity values. If this parameter has a negative value the corresponding index to lookupTable is equal to its value + its length. The range of its possible value is between (-lookupTable length/2) and (lookupTable length/2 - 1).
- factor
- Value that indicates the factor to be applied in the function operation specified in the flags parameter.
This parameter is used only if flags is set to FunctionalLookupTableFlags.Exponential,
FunctionalLookupTableFlags.Sigmoid or FunctionalLookupTableFlags.Logarithm.
If FunctionalLookupTableFlags.Exponential or
FunctionalLookupTableFlags.Sigmoid is set, the value of this
parameter can be any integer (+/-). If FunctionalLookupTableFlags.Logarithm
is set, its value should be >= 0. However, if factor = 0, the lookup table will be filled linearly from start to end, regardless of the value set in flags.
- flags
- Flags that indicate the function used to update the lookup table and whether or not the lookupTable should contain signed or unsigned data.
Example
This example will darken loaded image by using lookup table affected by exponential function.
Visual Basic | Copy Code |
---|
Public Sub GetFunctionalLookupTableExample()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")
Dim LookupTable() As Integer
ReDim LookupTable(255)
LookupTable(0) = 0
LookupTable(255) = 255
EffectsUtilities.GetFunctionalLookupTable(LookupTable, 0, 255, 5, FunctionalLookupTableFlags.Exponential)
Dim command As RemapIntensityCommand = New RemapIntensityCommand
command.Flags = RemapIntensityCommandFlags.Master
command.LookupTable = LookupTable
command.Run(leadImage)
codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void GetFunctionalLookupTableExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); // Prepare the command int[] LookupTable = new int[256]; LookupTable[0] = 0; LookupTable[255] = 255; EffectsUtilities.GetFunctionalLookupTable(LookupTable, 0, 255, 5, FunctionalLookupTableFlags.Exponential); RemapIntensityCommand command = new RemapIntensityCommand(); command.Flags = RemapIntensityCommandFlags.Master; command.LookupTable = LookupTable; command.Run(image); codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also