Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
GetUserLookupTable Method
See Also  Example
Leadtools.ImageProcessing.Effects Namespace > EffectsUtilities Class : GetUserLookupTable Method



lookupTable
Lookup table array to be filled by this method.
userPoints
Array of Point structures that contain the points on the curve used to update the lookup table.
Updates the lookup table, based on a curve that passes through the specified points.

Syntax

Visual Basic (Declaration) 
Public Shared Function GetUserLookupTable( _
   ByVal lookupTable() As Integer, _
   ByVal userPoints() As Point _
) As Integer
Visual Basic (Usage)Copy Code
Dim lookupTable() As Integer
Dim userPoints() As Point
Dim value As Integer
 
value = EffectsUtilities.GetUserLookupTable(lookupTable, userPoints)
C# 
public static int GetUserLookupTable( 
   int[] lookupTable,
   Point[] userPoints
)
C++/CLI 
public:
static int GetUserLookupTable( 
   array<int>^ lookupTable,
   array<Point>^ userPoints
) 

Parameters

lookupTable
Lookup table array to be filled by this method.
userPoints
Array of Point structures that contain the points on the curve used to update the lookup table.

Return Value

return the number of entries in the lookup table array that were actually updated by this method.

Example

This example will brighten the loaded bitmap using the lookup table updated by the GetUserLookupTable method.

Visual BasicCopy Code
Public Sub GetUserLookupTableExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")

   ' Prepare the command
   Dim LookupTable() As Integer
   ReDim LookupTable(255)
   Dim UserPoint() As Point
   ReDim UserPoint(2)

   UserPoint(0) = New Point(0, 0)
   UserPoint(1) = New Point(128, 150)
   UserPoint(2) = New Point(255, 255)

   'Get Lookup table where the array effected by user data method.
   EffectsUtilities.GetUserLookupTable(LookupTable, UserPoint)
   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 GetUserLookupTableExample() 

   // 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]; 
   Point[] UserPoint = new Point[3]; 
   UserPoint[0] = new Point(0, 0); 
   UserPoint[1] = new Point(128,150); 
   UserPoint[2] = new Point(255,255); 
 
   //Get Lookup table where the array effected by user data method. 
   EffectsUtilities.GetUserLookupTable(LookupTable, UserPoint); 
   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

  • This method will update the lookup table array using the best curve that passes through the points specified in the userPoint array. The points in the array do not need to be sorted. In most cases, this method is used with the RemapIntensityCommand method.
  • The length of the lookup table array depends upon the number of bits being used, as follows:
    ValueMeaning
    6553616-bit / sample image
    4096 12-bit / sample image
    256256 8-bit / sample image

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