Difference between revisions of "Function:Demosaic"

From CUVI Wiki
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
Restores an RGB image from a gray-scale CFA image using Bayer algorithm
Restores an RGB image from a gray-scale CFA image using Bayer algorithm
===Function===
====Function====
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus demosaic(CuviImage* srcImage,
CuviStatus demosaic(const CuviImage& src,
                     CuviImage* dstImage,
                     CuviImage& dst,
                     CuviBayerSeq bayerSequence,
                     const CuviBayerSeq sensorAlignment,
                     CuviStream* stream = NULL);
                     const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}


 
====Parameters====
===Parameters===
{|
 
|style="font-size:75%;"|
{|class="wikitable"
{|class="wikitable"
|-
|-
Line 21: Line 21:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input Bayer Image
| Input Bayer Image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output RGB Imag
| Output RGB Image
|-
|-
| bayerSequence
| sensorAlignment
| CuviBayerSeq
| CuviBayerSeq
| Bayer Type
| Sensor alignment of the bayer image
|-
|-
| stream
| stream
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution
 
|}
|}
|}


 
====Image Type Support====
 
{|
===Image Type Support===
|style="font-size:75%;"|
 
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 48: Line 47:
! Output
! Output
|-
|-
| 8u
| 8uC1
| 8u
| 8uC3
|-
|-
| 16u
| 16uC1
| 16u
| 16uC3
|}
|}
|}


===Sample===
====Sample====
{|
[[File:BayerHolidayIn.png|none|frame|Input]]
|-
<br/>
|[[File:BayerHolidayIn.png|frame|Input]]
[[File:BayerHolidayOut.png|none|frame|Output]]
|[[File:BayerHolidayOut.png|frame|Output]]
<br/>
|-
====Sample====
|[[File:BayerHouseIn.png|frame|Input]]
[[File:BayerHouseIn.png|none|frame|Input]]
|[[File:BayerHouseOut.png|frame|Output]]
<br/>
|}
[[File:BayerHouseOut.png|none|frame|Output]]
<br/>


===Example===
====Example====
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">


//Example using C
//Example using C


CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE_KEEP_DEPTH), gout;


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  
//Demosaic  
cuviDemosaic(gimg,gout,CUVI_BAYER_BGGR,str);
cuvi::colorOperations::demosaic(gimg,gout,CUVI_BAYER_BGGR);


</syntaxhighlight>
</syntaxhighlight>
|}
|}

Latest revision as of 20:57, 18 October 2022

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

Function

CuviStatus demosaic(const CuviImage& src,
                    CuviImage& dst,
                    const CuviBayerSeq sensorAlignment,
                    const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Bayer Image
dst CuviImage& Output RGB Image
sensorAlignment CuviBayerSeq Sensor alignment of the bayer image
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 8uC3
16uC1 16uC3

Sample

Error creating thumbnail: Unable to save thumbnail to destination
Input


Error creating thumbnail: Unable to save thumbnail to destination
Output


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

CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE_KEEP_DEPTH), gout;


//Demosaic 
cuvi::colorOperations::demosaic(gimg,gout,CUVI_BAYER_BGGR);