From CUVI Wiki

Extracts the specified channel from a multichannel image.


CuviStatus getChannel(const CuviImage& src,
                      CuviImage& dst,
                      const Cuvi32s channel,
                      const CuviStream& stream = CuviStream());


Name Type Description
src const CuviImage& Input Image
dst CuviImage& Destination Image
channel Cuvi32s Channel number from 0 to (src.channels() - 1)
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC3 8uC1
8uC4 8uC1
16uC3 16uC1
16uC4 16uC1
32fC3 32fC1
32fC4 32fC1


//Creating GPU images
CuviImage input = cuvi:io::loadImage(path), output;
//Get first channel of the input image
cuvi::dataExchange::getChannel(input, output, 0);

//The same can be achieved by using the channel fetch operator
output = input[0];