Difference between revisions of "Function:Demosaic"

From CUVI Wiki
(Created page with "__NOTOC__ Restores an RGB image from a gray-scale CFA image using Bayer algorithm ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus demosaic(...")
 
Line 58: Line 58:
{|
{|
|-
|-
|[[File:BayerIn.jpg|frame|Input]]
|[[File:BayerHolidayIn.png|frame|Input]]
|[[File:BayerOut.jpg|frame|Output]]
|[[File:BayerHolidayOut.png|frame|Output]]
|}
|}


===Example===
===Example===

Revision as of 14:29, 18 May 2012

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

Error creating thumbnail: Unable to save thumbnail to destination
Input
Error creating thumbnail: Unable to save thumbnail to destination
Output

Example

//Example using C


CuviSize size;

CuviMat* gimg, *gout;
float* temp;
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);