Function:Demosaic

From CUVI Wiki

Restores an RGB image from a gray-scale CFA image using Bayer algorithm

Function

CuviStatus demosaic(CuviImage* srcImage,
                    CuviImage* dstImage,
                    CuviBayerSeq bayerSequence,
                    CuviStream* stream = NULL);


Parameters

Name Type Description
srcImage CuviImage* Input Bayer Image
dstImage CuviImage* Output RGB Imag
bayerSequence CuviBayerSeq Bayer Type
stream CuviStream* GPU stream ID for execution


Image Type Support

Input Output
8u 8u
16u 16u

Sample

Input
Output
Input
Output

Example

//Example using C


CuviSize size;

CuviMat* gimg, *gout;
CuviStream* str;

//Creating Stream
cuviCreateStream(&str);

//Size of the image	
size = cuviSize(img->width,img->height);

//Creating GPU Images
cuviCreateMat(&gimg,size,img->depth,img->nChannels);
cuviCreateMat(&gout,size,img->depth,3);

//Populating input image data on GPU
cuviUploadData(gimg,img->imageData,img->widthStep,str);

//Demosaic 
cuviDemosaic(gimg,gout,CUVI_BAYER_BGGR,str);