ICogAcqLookupTable SetLookupTable Method Cognex VisionPro 9.20
Access the specified lookup table values as an array.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 80.0.0.0
Syntax

void SetLookupTable(
	int index,
	byte[] value
)

Parameters

index
Type: System Int32

The index of the lookup table. For cameras that support only one lookup table, this value should always be zero. For dual tap cameras, the index of the even field is zero, and the index of the odd field is 1.

value
Type:  System Byte 
Events

Event TypeReason
ICogChangedEvent Changed

Fires when the lookup table is changed.

The following state flag may be affected:

Exceptions

ExceptionCondition
ArgumentException

value is not of the proper size for the pixel depth of this FIFO.

ArgumentException

index is < zero or > NumLookupTables − 1.

Remarks

Sets or gets lookup table values as an array.

NumLookupTables determines how many lookup tables a camera supports. Lookup table numbering starts at zero. The index for a camera that supports only one lookup table, then, would be 0.

For dual tap cameras that provide even- and odd-field lookup tables, lookup table 0 is the even field and lookup table 1 is the odd field.

Default Value: An identity table.

Examples

using Cognex.VisionPro;

private CogFrameGrabbers myFrameGrabbers;
private ICogFrameGrabber myFrameGrabber;
private ICogAcqFifo myAcqFifo;

private void InitializeFifo()
{
    const string VIDEO_FORMAT = "Sony XC75 640x480";
    ICogAcqLookupTable LUTParams;

    myFrameGrabbers = new CogFrameGrabbers();
    myFrameGrabber = myFrameGrabbers[0];
    myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, 
        Cognex.VisionPro.CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);

    LUTParams = myAcqFifo.OwnedLookupTableParams;

    if (LUTParams  != null) {
        byte[] inverseLut = LUTParams.GetLookupTable(0);

        for (int i = 0; i <= 255; i++)
            inverseLut[i] = (byte) (255 - i);
            LUTParams.SetLookupTable(0, inverseLut);
      }
}
Imports Cognex.VisionPro

Private myFrameGrabbers As CogFrameGrabbers
Private myFrameGrabber As Cognex.VisionPro.ICogFrameGrabber
Private myAcqFifo As Cognex.VisionPro.ICogAcqFifo

Private Sub InitializeFifo()
        Const VIDEO_FORMAT = "Sony XC75 640x480"
        Dim LUTParams As Cognex.VisionPro.ICogAcqLookupTable

        myFrameGrabbers = New CogFrameGrabbers
        myFrameGrabber = myFrameGrabbers.Item(0)
        myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, CogAcqFifoPixelFormatConstants.Format8Grey, 0, False)

        LUTParams = myAcqFifo.OwnedLookupTableParams

        If Not LUTParams Is Nothing Then
            Dim i As Integer
            Dim inverseLut As Byte()
            inverseLut = LUTParams.GetLookupTable(0)
            For i = 0 To 255
                inverseLut(i) = 255 - i
            Next
            LUTParams.SetLookupTable(0, inverseLut)
        End If
End Sub
See Also