SetLUT
Top  Previous  Next

Description

Assigns the array of values for the software lookup table. If the LUTMode is active, the pixel values in the incoming frames will be transformed based on a corresponding factor in the LUT array.


Syntax


[VB]
objActiveUSB.SetROI LUT, Channels


[C/C++]
HRESULT SetROI(VARIANT LUT, short Channels);


Data Types
[VB]

LUT: Variant (Array)
Channels: Integer


Parameters
[C/C++]

LUT  
SAFEARRAY of floating point factors to be used in the lookup table. The value of 1.0 corresponds to the maximum pixel value in the currently selected video format.  
Channels  
Number of color channels in the submitted array. Can be one of the following values:  
1 - the array contains a one-channel LUT which will be used for all color components  
3 - the array contains a three-channel LUT where the first 1/3 of elements represent the red channel, the second 1/3 of elements - green channel and the last 1/3 of elements - blue channel.  
4 - the array contains a four-channel LUT used for the operation on a raw Bayer video. The first 1/4 of elements represent the R channel, the second 1/4 of elements - Gr channel, the third 1/4 of elements - B channel and the last 1/4 of elements - Gb channel.  

Return Values


S_OK  
Success  
E_FAIL  
Failure.  

Example

The following VB example prepares a 3-channel linear LUT with an amplified green channel and applies it to the video:

Dim
 LUT(256 * 3) As 
Single

For
 i = 0 To 255
LUT(i) = i/255.
Next

For i = 256 To 511
LUT(i) = (i-256)*2/255.
Next
For i = 512 To 767
LUT(i) = (i-512)/255.
Next
ActiveUSB1.SetLUT A, 3

Remarks


The LUT processing in ActiveUSB works in two stages. An array submitted by SetLUT and containing coefficients in the range 0 - 1.0 is converted to the internal LUT array with the number of elements and their values corresponding to the actual range of pixels in the currently selected format. This guarantees that the input LUT will have an identical effect on images of different types and pixel depths.

For example, if a submitted array has 256 elements with values gradually increasing from 0 to 0.5 and the currently selected format is Mono12 (for which the maximum pixel value is 4095), it will be converted to the internal LUT with 4096 elements and values gradually increasing from 0 to 2047. If the format is changed to Mono8, the internal LUT will automatically shrink to 256 elements with values gradually increasing from 0 to 255. If LUTMode is active, the value of each pixel will be mapped to the value of a corresponding element in the internal LUT.

For a single-channel LUT the input value of a pixel is used directly as an index in the LUT array. Multi-channel LUTs are logically divided into several subsequent LUTs starting from the red channel array. Therefore, if a submitted lookup table contains 768 elements and 3 channels, the first 256 elements will be used to index and remap red pixels, the second 256 elements - green pixels, and the last 256 elements - blue pixels.

To obtain the values of the current lookup table, use the GetLUT method.