This class represents look-up table (LUT) used for tone correction.
Namespace:
Aurigma.GraphicsMill.Transforms
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
<DefaultMemberAttribute("Item")> _ Public NotInheritable Class Lut _ Inherits LockableObject _ Implements ICloneable, IEnumerable
[DefaultMemberAttribute("Item")] public sealed class Lut : LockableObject, ICloneable, IEnumerable
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:
' 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
// 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 < height - 1; i++) { for ( j = 0; j < width - 1; j++) { for ( k = 0; k < channelCount - 1; k++) { outputBitmap[i, j, k] = LUT[inputBitmap[i, j, k]]; } } }
For LUT entries the following rules are true:
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.
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.