GetFunctionalLookupTable Method (original) (raw)
Summary
Updates a range of entries in the lookup table, based on the specified mathematical function.
Syntax
C#
Objective-C
C++/CLI
Java
Python
+ (void)getFunctionalLookupTable:(int *)_lookupTable_
lookupTableLength:(NSUInteger)_lookupTable_Length
start:(NSInteger)_start_
end:(NSInteger)_end_
factor:(NSInteger)_factor_
flags:(LTFunctionalLookupTableFlags)_flags_
error:(NSError **)error
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).
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 the loaded image by using a lookup table created by using an exponential function.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Effects;
using Leadtools.ImageProcessing.Color;
public void GetFunctionalLookupTableExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "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, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}