Difference between revisions of "Function:LUT"

From CUVI Wiki
Line 47: Line 47:
! Output
! Output
|-
|-
| 8u
| 8uC1
| 8u
| 8uC1
| 8u
| 8uC1
|-
| 8uC3
| 8uC3
| 8uC3
|}
|}



Revision as of 00:43, 17 April 2020

Remaps image values according to look up table.

Function

CuviStatus LUT(const CuviImage& src,
               const CuviImage& mapping,
               CuviImage& dst,
               const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src CuviImage& Input Image
mapping CuviImage& The look-up table
dst CuviImage& Resultant Image
stream CuviStream& GPU stream ID for execution

Image Type Support

Input 1 Input 2 Output
8uC1 8uC1 8uC1
8uC3 8uC3 8uC3

Sample

Example

CuviImage input = cuvi::io::loadImage(path), output;

//Create LUT on host
const int mappingSize = 256;

unsigned char mappingValues[mappingSize];

//Initialize LUT with values which invert the image values
for(int i=0; i<mappingSize; i++)
    mappingValues[i] = 255 - i;

//Create and upload LUT matrix on device
CuviImage mapping(mappingSize,1, CUVI_8UC1);
mapping.upload(mappingValues, sizeof(mappingValues));

cuvi::colorOperations::LUT( input, mapping, output );