Difference between revisions of "Image I/O & Framework"
From CUVI Wiki
Line 91: | Line 91: | ||
{| | {| | ||
|style="font-size: | |style="font-size:125%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Revision as of 15:06, 27 April 2012
CUVI sdlksljfdks;dlks kdsldks
Using CUVI with C++
CuviImage
CuviImage is a C++ class to hold image data on the device. It has all the essential members to hold image information as well as methods to create and move image to and from device. All the C++ functions in CUVI take CuviImage as input/output image argument. CuviImage creates an image on the GPU so you do not need to cater for manually copying the image to the GPU and then back to the CPU, this is catered by CuviImage.
Members
Member name | Type | Description |
---|---|---|
data | void* | Data pointer containing the image pixel values on device |
width | Cuvi32u | Image width in pixels |
height | Cuvi32u | Image height in pixels |
pitch | size_t | Image pitch/widthstep in bytes |
depth | Cuvi32u | Defines the data container for the image. A depth of '8' creates CuviImage of type Cuvi8u |
dataBits | Cuvi32u | No. of bits containing image information. By default dataBits is equal to the depth of the image |
nChannels | Cuvi32u | Number of channels in image |
isSigned | bool | Specifies if the image also contains negative values. (float is an exception) |
isInitialized | bool | Specifies if the image has successfully been created on the device |
channelSequence | CuviChannelSeq | Specifies the arrangement of image channels like RGB and BGR |
CuviImage methods helps create, copy and show images. All methods return CuviStatus except constructors and destructor which throws an exception in case of failure.
Methods
Method | Description |
---|---|
CuviImage() | Default constructor. Initializes all members with 0 |
CuviImage(CuviSize size, Cuvi32u depth, Cuvi32u channels); | Creates a CuviImage of specified size, depth and channels. Throws exception if memory allocation on device fails. |
CuviImage(const CuviImage&); | Creates a copy of existing CuviImage |
CuviImage(const CuviMat&); | Creates a copy of existing CuviMat |
CuviStatus upload(void* pSrcHost, size_t srcPitch, CuviStream* stream = NULL); | Copy image data from host memory to CuviImage. This function also supports async operation |
CuviStatus download(void* pDstHost, size_t dstPitch, CuviStream* stream = NULL); | Copy image data from CuviImage to host memory. |
CuviStatus show(char* title = "CUVI Image",int milliseconds = 0); | Render CuviImage on screen for a specified amount of time |
~CuviImage(); | CuviImage destructor. Throws an exception in case of failure |
I/O using CuviImage
|