![]() |
DriveWorks SDK Reference| 0.6.67 Release |
Defines image abstractions, and streamer and format conversion APIs.
Data Structures | |
struct | dwImageCPU |
Defines a CPU-based image. More... | |
struct | dwImageCUDA |
Defines a CUDA image. More... | |
struct | dwImageDataLines |
Container for data lines from the camera. More... | |
struct | dwImageGL |
Defines a GL texture image. More... | |
struct | dwImageMetaData |
Additional meta information stored with each image. More... | |
struct | dwImageNvMedia |
Defines an NvMedia image. More... | |
struct | dwImageProperties |
Defines the properties of the image. More... | |
Modules | |
Image Converter | |
Defines the image conversion functions in the SDK, such as for converting YUV to RGBA. | |
Image Streamer | |
Defines the image streamer function, enabling streaming images between different APIs. | |
Macros | |
#define | DW_MAX_IMAGE_PLANES 3 |
Typedefs | |
typedef uint32_t | GLenum |
typedef uint32_t | GLuint |
Enumerations | |
enum | dwImageCUDAMemoryType { DW_IMAGE_CUDA_PITCH, DW_IMAGE_CUDA_BLOCK } |
Specifies the CUDA memory type. More... | |
enum | dwImageMetaDataFlags { DW_IMAGE_FLAGS_EMBEDDED_LINES = (1 << 2), DW_IMAGE_FLAGS_SENSOR_SETTINGS = (1 << 3) } |
Flags defining the meta information available in an image. More... | |
enum | dwImagePixelFormat { DW_IMAGE_PIXEL_FORMAT_UNKNOWN = 0, DW_IMAGE_R = 1000, DW_IMAGE_RGB = 2000, DW_IMAGE_RCB = 2100, DW_IMAGE_RCC = 2200, DW_IMAGE_RGBA = 3000, DW_IMAGE_YUV420 = 6000, DW_IMAGE_YUV422 = 6100, DW_IMAGE_RAW = 10000 } |
Specifies the pixel format of the image. More... | |
enum | dwImageType { DW_IMAGE_CPU = 0, DW_IMAGE_GL, DW_IMAGE_CUDA, DW_IMAGE_NVMEDIA } |
Specifies the image type. More... | |
Functions | |
DW_API_PUBLIC dwStatus | dwImage_getDataLayout (size_t *elementSize, uint32_t planeChannelCount[DW_MAX_IMAGE_PLANES], dwVector2ui planeSize[DW_MAX_IMAGE_PLANES], const dwImageProperties *prop) |
Returns the expected data layout of an image given its properties. More... | |
DW_API_PUBLIC dwStatus | dwImageCPU_create (dwImageCPU *cpuImage, const dwImageProperties *prop) |
Allocates memory for the data of a dwImageCPU based on the dwImageProperties. More... | |
DW_API_PUBLIC dwStatus | dwImageCPU_destroy (dwImageCPU *cpuImage) |
Deallocates data in a dwImageCPU. More... | |
DW_API_PUBLIC dwStatus | dwImageCPU_mapToROI (dwImageCPU *dstImg, const dwImageCPU *srcImg, dwRect roi) |
Returns a dwImageCPU that is mapped to a region of interest in the data of the srcImg. More... | |
DW_API_PUBLIC dwStatus | dwImageCUDA_create (dwImageCUDA *cudaImage, const dwImageProperties *prop, dwImageCUDAMemoryType layout) |
Allocates memory for the data of a dwImageCUDA based on the dwImageProperties and dwImageCUDAMemoryType memory layout. More... | |
DW_API_PUBLIC dwStatus | dwImageCUDA_destroy (dwImageCUDA *cudaImage) |
Deallocates data in a dwImageCUDA. More... | |
DW_API_PUBLIC dwStatus | dwImageCUDA_getPlaneAsImage (dwImageCUDA *planeImage, const dwImageCUDA *srcImage, uint32_t planeIdx) |
Returns a specific plane of a CUDA image as its own single-plane CUDA image. More... | |
DW_API_PUBLIC dwStatus | dwImageCUDA_mapToROI (dwImageCUDA *dstImg, const dwImageCUDA *srcImg, dwRect roi) |
Returns a dwImageCUDA that is mapped to a region of interest in the data of the srcImg. More... | |
DW_API_PUBLIC dwStatus | dwImageCUDA_setFromPitch (dwImageCUDA *result, void *devicePtr, uint32_t width, uint32_t height, size_t pitchInBytes, dwImagePixelFormat pixelFormat) |
Fill out given dwImageCUDA structure from a raw pointer. More... | |
DW_API_PUBLIC dwStatus | dwImageGL_create (dwImageGL *glImage, const dwImageProperties *prop, GLenum target) |
Generates a texture for a dwImageGL based on the dwImageProperties for a GL target. More... | |
DW_API_PUBLIC dwStatus | dwImageGL_destroy (dwImageGL *glImage) |
Destroys the texture in a dwImageGL. More... | |
DW_API_PUBLIC dwStatus | dwImageGL_setupTexture (dwImageGL *glImg, const uint8_t *data, int32_t level, uint32_t depth) |
Sets up the texture defined in glImg->prop.tex from pixels stored in data. More... | |
DW_API_PUBLIC dwStatus | dwImageNvMedia_create (dwImageNvMedia *nvmImage, const dwImageProperties *prop, const dwContextHandle_t context) |
Sets up an NvMediaImage based on the dwImageProperties for the NvMediaDevice in the current dwContext. More... | |
DW_API_PUBLIC dwStatus | dwImageNvMedia_destroy (dwImageNvMedia *nvmImage) |
Destroys the texture in a dwImageNvMedia. More... | |
DW_API_PUBLIC dwStatus | dwImageNvMedia_setFromImage (dwImageNvMedia *dstImage, const NvMediaImage *srcImage) |
Fills dwImageNvMedia struct based on the contents of NvMediaImage . More... | |
struct dwImageCPU |
Data Fields | ||
---|---|---|
uint8_t * | data[DW_MAX_IMAGE_PLANES] | Specifies the raw image data. |
size_t | pitch[DW_MAX_IMAGE_PLANES] | Specifies the pitch of the image in bytes. |
dwImageProperties | prop | Specifies the properites of the image. |
dwTime_t | timestamp_us | Specifies the time, in microseconds, when the image was acquired. |
struct dwImageCUDA |
Data Fields | ||
---|---|---|
cudaArray_t | array[DW_MAX_IMAGE_PLANES] | Holds the CUDA image plane data. |
void * | dptr[DW_MAX_IMAGE_PLANES] | Holds the pointer to the image planes. |
dwImageCUDAMemoryType | layout | Defines the memory layout of the image. |
size_t | pitch[DW_MAX_IMAGE_PLANES] | Defines the pitch of each plane in bytes. |
dwImageProperties | prop | Defines the properties of the image. |
dwTime_t | timestamp_us | Specifies the time, in microseconds, when the image was acquired. |
struct dwImageDataLines |
Data Fields | ||
---|---|---|
uint8_t * | bottomLineData | |
uint32_t | bytesPerLine | |
dwVector2ui | embeddedDataSize | this defines the number of rows before and after the image |
uint8_t * | topLineData | pointer to the beginning of top and bottom lines |
struct dwImageGL |
Data Fields | ||
---|---|---|
dwImageProperties | prop | Specifies the properties of the image. |
GLenum | target | Specifies the OpenGL texture target. |
GLuint | tex | Specifies the OpenGL texture handle. |
dwTime_t | timestamp_us | Specifies the time, in microseconds, when the image was acquired. |
struct dwImageMetaData |
Data Fields | ||
---|---|---|
float32_t | analogGain | Specifies the analog Gain. |
float32_t | conversionGain | Specifies the conversion Gain. |
dwImageDataLines | dataLines |
embedded data lines. This is where the meta data defined above are parsed from A RAW image coming from a sensor often contains this information arranged as extra lines before and after the image. The full image is stored in a buffer structured as [TOP DATA][IMAGE][BOTTOM DATA] (top * W) + (H * W) + (bott * W) |
float32_t | digitalGain | Specifies the digital Gain. |
float32_t | exposureTime | Specifies the exposure time (microsecond) |
int32_t | flags |
combination of multiple flags dwImageMetaDataFlags defining which of the meta fields are valid |
float32_t | wbGain[4] | Specifies the sensor white balance gains : R(0) G1(1) G2(2) B(3) |
struct dwImageNvMedia |
Data Fields | ||
---|---|---|
NvMediaImage * | img | Holds the pointer to the NvMedia image. |
dwImageProperties | prop | Holds image properties. |
dwTime_t | timestamp_us | Specifies the time, in microseconds, when the image was acquired. |
struct dwImageProperties |
Data Fields | ||
---|---|---|
uint32_t | height | Specifies the height of the image in pixels. |
dwImageMetaData | meta | additional meta information stored with the image. Not all images might provide it |
uint32_t | planeCount | Specifies the plane count of the image. For interleaved images the plane count is 1. |
dwImagePixelFormat | pxlFormat | Specifies the pixel format of the image. |
dwTrivialDataType | pxlType | Specifies the pixel type of the image. |
dwImageType | type | Specifies the type of image. |
uint32_t | width | Specifies the width of the image in pixels. |
enum dwImageMetaDataFlags |
Flags defining the meta information available in an image.
enum dwImagePixelFormat |
Specifies the pixel format of the image.
enum dwImageType |
DW_API_PUBLIC dwStatus dwImage_getDataLayout | ( | size_t * | elementSize, |
uint32_t | planeChannelCount[DW_MAX_IMAGE_PLANES], | ||
dwVector2ui | planeSize[DW_MAX_IMAGE_PLANES], | ||
const dwImageProperties * | prop | ||
) |
Returns the expected data layout of an image given its properties.
The byte size for plane i's row is:
elementSize*planeChannelCount[i]*planeWidth[i]
[out] | elementSize | Size in bytes of the pixel type |
[out] | planeChannelCount | Number of channels within each plane |
[out] | planeSize | Size of each plane |
[in] | prop | A pointer to the image properties to compute data layout from. |
DW_API_PUBLIC dwStatus dwImageCPU_create | ( | dwImageCPU * | cpuImage, |
const dwImageProperties * | prop | ||
) |
Allocates memory for the data of a dwImageCPU based on the dwImageProperties.
All variables in the struct will be automatically initialized. Timestamp is 0 by default.
[out] | cpuImage | A pointer to the dwImageCPU struct. The data pointed by it will be allocated |
[in] | prop | Properties of the dwImageCPU. |
DW_API_PUBLIC dwStatus dwImageCPU_destroy | ( | dwImageCPU * | cpuImage | ) |
Deallocates data in a dwImageCPU.
[in] | cpuImage | A pointer to the dwImageCPU struct. |
DW_API_PUBLIC dwStatus dwImageCPU_mapToROI | ( | dwImageCPU * | dstImg, |
const dwImageCPU * | srcImg, | ||
dwRect | roi | ||
) |
Returns a dwImageCPU that is mapped to a region of interest in the data of the srcImg.
NOTE: only single plane images are supported.
[out] | dstImg | A pointer to the dwImageCPU containing the roi. NOTE: the properties will reflect the size of the roi. (NOTE: this is not a copy) |
[in] | srcImg | A pointer to the source dwImageCPU. |
[in] | roi | A dwRect specifying the coordinates of the region of interest. |
DW_API_PUBLIC dwStatus dwImageCUDA_create | ( | dwImageCUDA * | cudaImage, |
const dwImageProperties * | prop, | ||
dwImageCUDAMemoryType | layout | ||
) |
Allocates memory for the data of a dwImageCUDA based on the dwImageProperties and dwImageCUDAMemoryType memory layout.
All variables in the struct will be automatically initialized. Timestamp is 0 by default.
[out] | cudaImage | A pointer to the dwImageCUDA struct. The data pointed by either the device pointer (for DW_IMAGE_CUDA_PITCH layout) or (for DW_IMAGE_CUDA_BLOCK layout) will be allocated |
[in] | prop | Properties of the dwImageCUDA. |
[in] | layout | the CUDA memory layout. |
DW_API_PUBLIC dwStatus dwImageCUDA_destroy | ( | dwImageCUDA * | cudaImage | ) |
Deallocates data in a dwImageCUDA.
[in] | cudaImage | A pointer to the dwImageCUDA struct. |
DW_API_PUBLIC dwStatus dwImageCUDA_getPlaneAsImage | ( | dwImageCUDA * | planeImage, |
const dwImageCUDA * | srcImage, | ||
uint32_t | planeIdx | ||
) |
Returns a specific plane of a CUDA image as its own single-plane CUDA image.
No data is copied, only the pointers are duplicated.
[out] | planeImage | dwImageCUDA to be filled with a single plane from srcImage |
[in] | srcImage | Source image to extract plane from |
[in] | planeIdx | Index of the plane to extract |
DW_API_PUBLIC dwStatus dwImageCUDA_mapToROI | ( | dwImageCUDA * | dstImg, |
const dwImageCUDA * | srcImg, | ||
dwRect | roi | ||
) |
Returns a dwImageCUDA that is mapped to a region of interest in the data of the srcImg.
NOTE: only single plane images are supported.
[out] | dstImg | A pointer to the dwImageCUDA containing the roi. NOTE: the properties will reflect the size of the roi. (NOTE: this is not a copy) |
[in] | srcImg | A pointer to the source dwImageCUDA. |
[in] | roi | A dwRect specifying the coordinates of the region of interest. |
DW_API_PUBLIC dwStatus dwImageCUDA_setFromPitch | ( | dwImageCUDA * | result, |
void * | devicePtr, | ||
uint32_t | width, | ||
uint32_t | height, | ||
size_t | pitchInBytes, | ||
dwImagePixelFormat | pixelFormat | ||
) |
Fill out given dwImageCUDA
structure from a raw pointer.
[out] | result | dwImageCUDA struct to be set up |
[in] | devicePtr | pointer into device memory |
[in] | width | Width of the image at devicePtr in pixels |
[in] | height | Height of the image at devicePtr in pixels |
[in] | pitchInBytes | Pitch in bytes of the image at devicePtr |
[in] | pixelFormat | Format of the pixels representing the image |
DW_API_PUBLIC dwStatus dwImageGL_create | ( | dwImageGL * | glImage, |
const dwImageProperties * | prop, | ||
GLenum | target | ||
) |
Generates a texture for a dwImageGL based on the dwImageProperties for a GL target.
. All variables in the struct will be automatically initialized. Timestamp is 0 by default.
[out] | glImage | A pointer to the dwImageGL struct. The tex pointed by it will be generated, if valid prop |
[in] | prop | Properties of the dwImageGL. |
[in] | target | GL target (usually GL_TEXTURE_2D). |
DW_API_PUBLIC dwStatus dwImageGL_destroy | ( | dwImageGL * | glImage | ) |
DW_API_PUBLIC dwStatus dwImageGL_setupTexture | ( | dwImageGL * | glImg, |
const uint8_t * | data, | ||
int32_t | level, | ||
uint32_t | depth | ||
) |
Sets up the texture defined in glImg->prop.tex from pixels stored in data.
[in] | glImg | A pointer to the dwImageGl struct. |
[in] | data | A pointer to the image data in cpu memory. |
[in] | level | Level at which the texture data has to be set. Should be 0 if texture is not MIPMAP. |
[in] | depth | Texel depth in case of a texture3D, should be 0 if 2D. |
DW_API_PUBLIC dwStatus dwImageNvMedia_create | ( | dwImageNvMedia * | nvmImage, |
const dwImageProperties * | prop, | ||
const dwContextHandle_t | context | ||
) |
Sets up an NvMediaImage based on the dwImageProperties for the NvMediaDevice in the current dwContext.
All variables in the struct will be automatically initialized. Timestamp is 0 by default.
[out] | nvmImage | A pointer to the dwImageNvMedia struct. The NvMediaImage pointed by it will be created, if the properties are valid. |
[in] | prop | A Pointer to the properties of the dwImageNvMedia. |
[in] | context | Current dwContext, contains current NvMediaDevice. |
DW_API_PUBLIC dwStatus dwImageNvMedia_destroy | ( | dwImageNvMedia * | nvmImage | ) |
Destroys the texture in a dwImageNvMedia.
[in] | nvmImage | A pointer to the dwImageNvMedia struct. |
DW_API_PUBLIC dwStatus dwImageNvMedia_setFromImage | ( | dwImageNvMedia * | dstImage, |
const NvMediaImage * | srcImage | ||
) |
Fills dwImageNvMedia
struct based on the contents of NvMediaImage
.
[out] | dstImage | dwImageNvMedia to be filled from srcImage |
[in] | srcImage | Source image |