Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
optris::Image Class Reference

Encapsulates false color images with 8-bit color depth. More...

#include <Image.h>

Collaboration diagram for optris::Image:
Collaboration graph

Public Member Functions

OTC_SDK_API Image (ColorFormat colorFormat, WidthAlignment widthAlignment) noexcept
 Constructor.
 
OTC_SDK_API Pixel getPixel (int index) const
 Returns the pixel at the given index.
 
OTC_SDK_API Pixel getPixel (int x, int y) const
 Returns the pixel at the given coordinates.
 
OTC_SDK_API void setPixel (int index, const Pixel &pixel)
 Sets the pixel at the given index.
 
OTC_SDK_API void setPixel (int x, int y, const Pixel &pixel)
 Sets the pixel at the given coordinates.
 
OTC_SDK_API ImageIterator getIterator () noexcept
 Returns an iterator with read and write access.
 
OTC_SDK_API ConstImageIterator getConstIterator () const noexcept
 Returns an iterator with read access.
 
OTC_SDK_API int getWidth () const noexcept
 Returns the width of the image in pixels.
 
OTC_SDK_API int getStride () const noexcept
 Returns the stride of the image in bytes.
 
OTC_SDK_API int getHeight () const noexcept
 Returns the height of the image in pixels.
 
OTC_SDK_API int getSize () const noexcept
 Returns the size of the image as total number of pixels.
 
OTC_SDK_API int getSizeInBytes () const noexcept
 Returns the size of the internal storage in bytes.
 
OTC_SDK_API bool isEmpty () const noexcept
 Returns whether the image is empty.
 
OTC_SDK_API void clear ()
 Clears the image.
 
OTC_SDK_API void resize (int width, int height)
 Resizes the image to the given dimensions.
 
OTC_SDK_API ColorFormat getColorFormat () const noexcept
 Returns the color format.
 
OTC_SDK_API WidthAlignment getWidthAlignment () const noexcept
 Returns the width alignment.
 
OTC_SDK_API Image clone () const noexcept
 Returns a complete copy of this image.
 
OTC_SDK_API void copyDataTo (unsigned char *destination, int size) const noexcept
 Copies the internally stored pixel values to the given array.
 
OTC_SDK_API const unsigned char * getData () const noexcept
 Returns a pointer to the first element of the internal array.
 

Friends

class ImageIterator
 
class ConstImageIterator
 

Detailed Description

Encapsulates false color images with 8-bit color depth.

The individual pixel values, like red, green or blue, are stored in a one-dimensional array.

Depending on the width alignment additional bytes may be added at the end of each row to ensure that its size in bytes respects this alignment. The setter and getter functions as well as the iterators will skip this padding.

The origin of coordinates is located in the upper left corner with the x-axis pointing right and the y-axis pointing down.

Constructor & Destructor Documentation

◆ Image()

OTC_SDK_API optris::Image::Image ( ColorFormat colorFormat,
WidthAlignment widthAlignment )
noexcept

Constructor.

Parameters
[in]colorFormatdefines the sequence in which the pixel values are stored internally.
[in]widthAlignmentdefines the alignment of the row size in bytes. If, e.g., it is set to four bytes, the row size will potentially be padded at the end so that it is a multiple of four.

Member Function Documentation

◆ clone()

Image optris::Image::clone ( ) const
inlinenoexcept

Returns a complete copy of this image.

Returns
complete copy of this image.

◆ copyDataTo()

OTC_SDK_API void optris::Image::copyDataTo ( unsigned char * destination,
int size ) const
noexcept

Copies the internally stored pixel values to the given array.

This includes potential width padding.

Warning
No range checks are performed. The correct size of the destination array can be acquired with the getSizeInBytes() function.
Parameters
[out]destinationarray to copy the data to.
[in]sizein bytes. The specified size is limited to [0, frame size in bytes].
See also
getSizeInBytes()

◆ getColorFormat()

ColorFormat optris::Image::getColorFormat ( ) const
inlinenoexcept

Returns the color format.

Returns
color format.

◆ getConstIterator()

ConstImageIterator optris::Image::getConstIterator ( ) const
inlinenoexcept

Returns an iterator with read access.

The iterator traverses the image in a row major fashion and skips potential width padding.

Returns
iterator with read access.

◆ getData()

const unsigned char * optris::Image::getData ( ) const
inlinenoexcept

Returns a pointer to the first element of the internal array.

The size of the array can be acquired via the getSizeInBytes() function.

Returns
pointer to the first element of the internal array.
See also
getSizeInBytes()

◆ getHeight()

int optris::Image::getHeight ( ) const
inlinenoexcept

Returns the height of the image in pixels.

Returns
image height in pixels.

◆ getIterator()

ImageIterator optris::Image::getIterator ( )
inlinenoexcept

Returns an iterator with read and write access.

The iterator traverses the image in a row major fashion and skips potential width padding.

Returns
iterator with read and write access.

◆ getPixel() [1/2]

OTC_SDK_API Pixel optris::Image::getPixel ( int index) const

Returns the pixel at the given index.

Parameters
[in]indexof the desired pixel.
Returns
the pixel at the given index.
Exceptions
SDKExceptionif the index is out of bounds.

◆ getPixel() [2/2]

OTC_SDK_API Pixel optris::Image::getPixel ( int x,
int y ) const

Returns the pixel at the given coordinates.

Parameters
[in]xcoordinate.
[in]ycoordinate.
Returns
the pixel at the given coordinates.
Exceptions
SDKExceptionif the coordinates are out of bounds.

◆ getSize()

int optris::Image::getSize ( ) const
inlinenoexcept

Returns the size of the image as total number of pixels.

Returns
size of the image as total number of pixels.

◆ getSizeInBytes()

int optris::Image::getSizeInBytes ( ) const
inlinenoexcept

Returns the size of the internal storage in bytes.

This includes potential width padding.

Returns
size of the internal storage in bytes.

◆ getStride()

int optris::Image::getStride ( ) const
inlinenoexcept

Returns the stride of the image in bytes.

The stride is the image width in bytes including potential padding.

Returns
stride of the image in bytes.

◆ getWidth()

int optris::Image::getWidth ( ) const
inlinenoexcept

Returns the width of the image in pixels.

Returns
image width in pixels.

◆ getWidthAlignment()

WidthAlignment optris::Image::getWidthAlignment ( ) const
inlinenoexcept

Returns the width alignment.

Returns
width alignment.

◆ isEmpty()

bool optris::Image::isEmpty ( ) const
inlinenoexcept

Returns whether the image is empty.

Returns
true if the image is empty. False otherwise.

◆ resize()

OTC_SDK_API void optris::Image::resize ( int width,
int height )

Resizes the image to the given dimensions.

Parameters
[in]widthin pixels.
[in]heightin pixels.

◆ setPixel() [1/2]

OTC_SDK_API void optris::Image::setPixel ( int index,
const Pixel & pixel )

Sets the pixel at the given index.

Parameters
[in]indexof the pixel to set.
[in]pixelto set.
Exceptions
SDKExceptionif the index is out of bounds.

◆ setPixel() [2/2]

OTC_SDK_API void optris::Image::setPixel ( int x,
int y,
const Pixel & pixel )

Sets the pixel at the given coordinates.

Parameters
[in]xcoordinate.
[in]ycoordinate.
[in]pixelto set.
Exceptions
SDKExceptionif the coordinates are out of bounds.

The documentation for this class was generated from the following file: