Namespace: Rx – Class: CRxImage – Header: Rx.Core.Ex/RxImage.h

CRxImage Class

C++
#include "Rx.Core.Ex/RxImage.h"
class CRxImage : public IImage

Image class. Implements the interface Rx::IImage.

This class implements only the basic functionality for an image like create, delete and convert. All image processing has to be implemented separately.

The format of an image is described by the class CRxImageFormat. It consist of an image width, height, a pixel type and a data type. The pixel type defines the number and order of color channels, and the data type specifies the data type of each color channel. For example, the pixel type can be RGBA or BGRA and the data type may be unsigned byte (8bit) or unsigned short (16bit). The various pixel types available are defined in Rx::EPixelType and the data types in Rx::EDataType. Note that the values of the data type and pixel type defines are identical to the corresponding OpenGL IDs.

All possible pixel and data types are represented by the TPixeltemplate structure. Specializations of this template structure cover all possible combinations of the defined pixel types and data types. The specialization names have the form TPixel_[PixelType]_[Data Type]. For example, the pixel structure for an RGBA unsigned char image is TPixel_RGBA_uc.

The main advantage of using the TPixel_* typedefs to access the pixels of an image is, that you can write template functions that work on many different pixel types. The TPixel structure defines functions to access the various color channels that map to the correct element within a pixel.

The pointer to the image data can be obtained with the function GetDataPtr().

See also

Constructors

CRxImage()

Default constructor. Creates an invalid image without using any memory.

CRxImage(xImage)

Copy constructor. Creates a copy of the given image.

CRxImage(xImage)

Move constructor.

CRxImage(xFormat)

Constructor. Creates a valid image within the given format and allocates memory accordingly.

CRxImage(pxAllocator)

Constructor.

CRxImage(xFormat, pxAllocator)

Constructor. Creates a valid image within the given format and allocator and allocates memory accordingly.

Destructor

~CRxImage()

Destructor. All used memory is freed.

Methods

Set(pvImgData)

Copies the content of the given image data into this image.

SetZero()

Sets the image data to contain only zeros.

CreateMoniker(xFormat, pvImgData, dTimestamp, uID)

Creates an image of the given format. This copies only the image data pointer. Does not allocate memory.

Create(xFormat)

Creates an image of the given format. Only (re)allocates memory if required.

Create(xFormat, pvImgData)

Creates an image of the given format. Only (re)allocates memory if required. Copies the image data into this image.

Create(xImage)

Creates a copy of the given image. Only (re)allocates memory if required.

Create(xImage)

Creates this image by moving the data of the given image into this image.

Create(iWidth, iHeight, ePixelType, eDataType)

Creates an image of given type and size and reserve the appropriate amount of memory.

Create(iWidth, iHeight, ePixelType, eDataType, pvData)

Creates an image of given type and size and copies the data from the given pointer.

Destroy()

Destroys this image if one has been created. Resets all internal variables.

IsValid()

Query if this image is valid.

IsMoniker()

Query if this image is a moniker.

GetBytesPerPixel()

Get number of bytes per pixel.

GetPixelCount()

Gets the number of pixels.

GetByteCount()

Gets the number of bytes of the whole image.

GetSize(iWidth, iHeight)

Gets the size of the image.

GetType(ePixelType, eDataType)

Gets the type of the image.

GetDataPtr()

Return the pointer to the data array.

GetDataPtr()

Return the constant pointer to the data array.

GetFormat()

Returns the format that describes this image.

GetID()

Gets the ID of this image. Is used to represent images captured by a camera or read from a sequence.

SetID(uID)

Sets the ID of this image. Is used to represent images captured by a camera or read from a sequence.

GetTimestamp()

Gets the timestamp of the image capture. Is 0.0 if this image has no timestamp.

SetTimestamp(dTimestamp)

Sets the timestamp of the image capture.

SetTimestampID(dTimestamp, uID)

Sets the timestamp and the ID of the image.

ConvertType(xImage, ePixelType, eDataType)

Convert this image to a different type and store result in xImage.

ConvertCustomType(xTrgImg)

Converts this image from a custom data type into the corresponding primitive data type.

IsOfType(ePixelType, eDataType)

Test whether image is of a particular pixel and data type.

Normalize()

Find minimal and maximal value of image and normalize image to range [0,1].

Swap(xImage)

Swaps the data between this and the given image.

GetPixel(iX, iY)

Gets the value of the pixel at location (iX, iY).

GetPixel(tPixel, iX, iY)

Gets the value of the pixel at location (iX, iY).

SetPixel(tPixel, iX, iY)

Sets the value of the pixel at location (iX, iY).

SetROIDefinition(piROIDefinition)

Sets the ROI definition.

Static Methods

ConvertType(xDstImg, xSrcImg, ePixelType, eDataType)

Convert the pSrcImage to a different type and store result in pDstImage.

ConvertMemory(pTrgMem, pSrcMem, xTrgFormat, xSrcFormat)

Convert the pSrcMem memory to a different type and store result in memory pTrgMem.

Operators

operator=(xImage)

Assignment operator. Copies the contents of the given image.

operator=(xImage)

Move assignment operator.