LEADTOOLS Image Processing (Leadtools.ImageProcessing.Effects assembly)

GetFunctionalLookupTable Method

Show in webframe
Example 







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.
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).
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).
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 that indicate the function used to update the lookup table and whether or not the lookupTable should contain signed or unsigned data.
Updates a range of entries in the lookup table, based on the specified mathematical function.
Syntax
public static void GetFunctionalLookupTable( 
   int[] lookupTable,
   int start,
   int end,
   int factor,
   FunctionalLookupTableFlags flags
)
'Declaration
 
Public Shared Sub GetFunctionalLookupTable( _
   ByVal lookupTable() As Integer, _
   ByVal start As Integer, _
   ByVal end As Integer, _
   ByVal factor As Integer, _
   ByVal flags As FunctionalLookupTableFlags _
) 
'Usage
 
Dim lookupTable() As Integer
Dim start As Integer
Dim end As Integer
Dim factor As Integer
Dim flags As FunctionalLookupTableFlags
 
EffectsUtilities.GetFunctionalLookupTable(lookupTable, start, end, factor, flags)
public static void GetFunctionalLookupTable( 
   int[] lookupTable,
   int start,
   int end,
   int factor,
   FunctionalLookupTableFlags flags
)
+ (void)getFunctionalLookupTable:(int*)lookupTable 
               lookupTableLength:(unsigned int)lookupTableLength 
                           start:(int)start 
                             end:(int)end 
                          factor:(int)factor 
                           flags:(LTFunctionalLookupTableFlags)flags 
                           error:(NSError**)outError;
            
public static void getFunctionalLookupTable(
   int[] lookupTable, 
   int start, 
   int end, 
   int factor, 
   FunctionalLookupTableFlags flags
)
            
 function Leadtools.ImageProcessing.Effects.EffectsUtilities.GetFunctionalLookupTable( 
   lookupTable ,
   start ,
   end ,
   factor ,
   flags 
)
public:
static void GetFunctionalLookupTable( 
   array<int>^ lookupTable,
   int start,
   int end,
   int factor,
   FunctionalLookupTableFlags flags
) 

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.
Remarks
Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.ImageProcessing.Effects

Public Sub GetFunctionalLookupTableExample()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   ' Prepare the command
   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, 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;
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:\Users\Public\Documents\LEADTOOLS Images";
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Effects;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;

      
public async Task GetFunctionalLookupTableExample()
{
   // 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
   int[] LookupTable = new int[256];
   LookupTable[0] = 0;
   LookupTable[255] = 255;
   int[] retLookupTable = EffectsUtilities.GetFunctionalLookupTable(LookupTable, 0, 255, 5, FunctionalLookupTableFlags.Exponential);

   RemapIntensityCommand command = new RemapIntensityCommand();
   command.Flags = RemapIntensityCommandFlags.Master;
   command.LookupTable = retLookupTable;
   command.Run(image);
   //Save as BMP
   string destFileName = @"result.bmp";
   StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName);
   await codecs.SaveAsync(image, LeadStreamFactory.Create(saveFile), RasterImageFormat.Bmp, 24);

}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Effects;
using Leadtools.ImageProcessing.Color;
using Leadtools.Examples;

public void GetFunctionalLookupTableExample(RasterImage image, Stream outStream)
{
   // 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);
   // Save result image
   RasterCodecs codecs = new RasterCodecs();
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);
   image.Dispose();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Effects
Imports Leadtools.ImageProcessing.Color

Public Sub GetFunctionalLookupTableExample(ByVal image As RasterImage, ByVal outStream As Stream)
   ' Prepare the command
   Dim LookupTable As Integer() = New Integer(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(image)
   ' Save result image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)
   image.Dispose()
End Sub
Requirements

Target Platforms

See Also

Reference

EffectsUtilities Class
EffectsUtilities Members
Leadtools.ImageProcessing.Color.RemapIntensityCommand
Leadtools.ImageProcessing.Core.ApplyVoiLookupTableCommand
Leadtools.ImageProcessing.Color.AdjustTintCommand
Leadtools.ImageProcessing.Color.GammaCorrectExtendedCommand

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.