This documentation is for the old version. Go to the latest Graphics Mill docs

Lut Class

This class represents look-up table (LUT) used for tone correction.

Namespace: Aurigma.GraphicsMill.Transforms
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
<DefaultMemberAttribute("Item")> _
Public NotInheritable Class Lut _
	Inherits LockableObject _
	Implements ICloneable, IEnumerable
C#
[DefaultMemberAttribute("Item")]
public sealed class Lut : LockableObject, ICloneable, IEnumerable

Remarks

Look-up tables are used in most tone correction algorithms. LUT defines a "luminosity function", in other words, a rule which translate channel luminosity to another value. Actually it is implemented as an array where entries means the luminosity values for channels which has luminosity equal to this entry index. To make it more clean, let's see the pseudocode for the algorithm which uses LUT:

Visual Basic
' This is a pseudocode demonstrating 
' how LUT works. Note, it is not an actual code and 
' this syntax is not correct for Graphics Mill objects! It
' is just used for brevity.

' Let's assume that width and height - image dimension (both for input 
' and output), channelCount - number of channels defined for bitmap pixel format
' (also the same in both bitmaps). LUT is specified look-up table

For i = 0 To height - 1
	For j = 0 To width - 1
		For k = 0 to channelCount - 1
			outputBitmap(i, j, k) = LUT(inputBitmap(i, j, k))
		Next
	Next
Next
C#
// This is a pseudocode demonstrating 
// how LUT works. Note, it is not an actual code and 
// this syntax is not correct for Graphics Mill objects! It
// is just used for brevity.

// Let's assume that width and height - image dimension (both for input 
// and output), channelCount - number of channels defined for bitmap pixel format
// (also the same in both bitmaps). LUT is specified look-up table

for ( i = 0; i &lt; height - 1; i++)
{
	for ( j = 0; j &lt; width - 1; j++)
	{
		for ( k = 0; k &lt; channelCount - 1; k++)
		{
			outputBitmap[i, j, k] = LUT[inputBitmap[i, j, k]];
		}
	}
}

For LUT entries the following rules are true:

  1. Minimum value of the LUT entry is 0.
  2. Maximum value of the LUT entry is a maximum possible luminosity for target pixel format. If pixel format is not extended (i. e. it has 8 bits per channel), maximum value is 255. For extended pixel formats (16 bits per channel) maximum value is 65535.
  3. LUT has as much entries as maximum possible luminosity (for 8 bit per channel images it is 255, for 16 bits per channel images - 65535).
  4. If LUT is not define monotone increasing function, some pixel values will be inverted (at the decreasing function sections).

As LUT values depend on the target bitmap pixel format (saying more precisely, it depends on the channel bit depth), this class provides a property IsExtended. When you change it, the look-up table is resized either to 8-bit or 16-bit case. Besides of that each contrustor (instead of parameterless one) has argument specifying what bit depth to use.

Note

If you create 16-bit LUT, then set IsExtended property to false (convert it to 8-bit), and after that set it back to true, LUT won't be the same as initially. Some information can be lost. It interpolates the missing entries linearly.

You can fill the LUT as if it is common array using property Item[Int32]. To check how much entries it actually has, use Length property. You can also create predefined LUTs using BuildXXX methods. For example, BuildEmpty(Boolean) method creates LUT filled with zeros. BuildFromSpline(PointF[], Boolean) method defines a LUT as a curve which passes specified array of points. BuildLinear(Single, Single, Boolean) method defines a LUT as a linear function with given parameters.

Inheritance Hierarchy

System.Object
L Aurigma.GraphicsMill.LockableObject
L Aurigma.GraphicsMill.Transforms.Lut

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

See Also

Reference