Function:BitConversion

From CUVI Wiki
Revision as of 17:36, 26 April 2012 by Jawad (talk | contribs) (Created page with "__NOTOC__ Converts image pixel values from one data type to another. It uses dataBits field of CuviImage to decide the number of bits of the destination image. ===Function=== ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Converts image pixel values from one data type to another. It uses dataBits field of CuviImage to decide the number of bits of the destination image.

Function

CuviStatus bitConversion(CuviImage* srcImage,
                         CuviImage* dstImage,
                         CuviStream* stream = NULL);

Parameters

Name Type Description
srcImage CuviImage* Input Image
dstImage CuviImage* Output Image
stream CuviStream* GPU stream ID for execution

Image Type Support

Input Output
8u 8u
8u 16u
16u 16u
16u 8u

Sample

Error creating thumbnail: Unable to save thumbnail to destination
16-bit Image in 16-bit container
Error creating thumbnail: Unable to save thumbnail to destination
15-bit image in 16-bit container


Example

//Using bit Conversion in C
CuviMat* gimg,*gout;

//Size of input and output should be same
CuviSize size = cuviSize(img->width,img->height);


cuviCreateMat(&gimg,size,img->depth,img->nChannels);
cuviUploadData(gimg,img->imageData,img->widthStep);
//Telling that input image has a depth of 7-bit
gimg->dataBits = 7;


cuviCreateMat(&gout,size,16,img->nChannels);
//Convert 7-bit image into 15-bit image
gout->dataBits = 15;


cuviBitConversion(gimg,gout);