YARP
Yet Another Robot Platform
yarp::sig::ImageOf< T > Class Template Reference

Typed image class. More...

#include <yarp/sig/Image.h>

+ Inheritance diagram for yarp::sig::ImageOf< T >:

Public Member Functions

 ImageOf ()
 
size_t getPixelSize () const override
 Gets pixel size in memory in bytes. More...
 
int getPixelCode () const override
 Gets pixel type identifier. More...
 
T & pixel (size_t x, size_t y)
 
T & pixel (size_t x, size_t y) const
 
const T & operator() (size_t x, size_t y) const
 
T & operator() (size_t x, size_t y)
 
T & safePixel (size_t x, size_t y)
 
const T & safePixel (size_t x, size_t y) const
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
int getPixelCode () const
 Gets pixel type identifier. More...
 
- Public Member Functions inherited from yarp::sig::Image
 Image ()
 Default constructor. More...
 
 Image (const Image &alt)
 Copy constructor. More...
 
 Image (Image &&other) noexcept
 Move constructor. More...
 
Imageoperator= (const Image &alt)
 Assignment operator. More...
 
Imageoperator= (Image &&other) noexcept
 Move assignment operator. More...
 
 ~Image () override
 Destructor. More...
 
bool copy (const Image &alt)
 Copy operator. More...
 
bool copy (const Image &alt, size_t w, size_t h)
 Scaled copy. More...
 
bool move (Image &&alt) noexcept
 move operator. More...
 
bool swap (Image &alt)
 swap operator. More...
 
size_t width () const
 Gets width of image in pixels. More...
 
size_t height () const
 Gets height of image in pixels. More...
 
virtual size_t getPixelSize () const
 Gets pixel size in memory in bytes. More...
 
virtual int getPixelCode () const
 Gets pixel type identifier. More...
 
size_t getRowSize () const
 Size of the underlying image buffer rows. More...
 
size_t getQuantum () const
 The size of a row is constrained to be a multiple of the "quantum". More...
 
size_t getPadding () const
 Returns the number of padding bytes. More...
 
unsigned char * getRow (size_t r)
 Get the address of a the first byte of a row in memory. More...
 
const unsigned char * getRow (size_t r) const
 Get the address of a the first byte of a row in memory, const versions. More...
 
unsigned char * getPixelAddress (size_t x, size_t y) const
 Get address of a pixel in memory. More...
 
bool isPixel (size_t x, size_t y) const
 Check whether a coordinate lies within the image. More...
 
void zero ()
 Set all pixels to 0. More...
 
void resize (size_t imgWidth, size_t imgHeight)
 Reallocate an image to be of a desired size, throwing away its current contents. More...
 
void resize (const Image &alt)
 Reallocate the size of the image to match another, throwing away the actual content of the image. More...
 
void setExternal (const void *data, size_t imgWidth, size_t imgHeight)
 Use this to wrap an external image. More...
 
unsigned char * getRawImage () const
 Access to the internal image buffer. More...
 
size_t getRawImageSize () const
 Access to the internal buffer size information (this is how much memory has been allocated for the image). More...
 
void * getIplImage ()
 Returns IPL/OpenCV view of image, if possible. More...
 
const void * getIplImage () const
 Returns IPL/OpenCV view of image, if possible. More...
 
void wrapIplImage (void *iplImage)
 Act as a wrapper around an IPL/OpenCV image. More...
 
bool read (yarp::os::ConnectionReader &connection) override
 Read image from a connection. More...
 
bool write (yarp::os::ConnectionWriter &connection) const override
 Write image to a connection. More...
 
void setQuantum (size_t imgQuantum)
 
bool topIsLowIndex () const
 
void setTopIsLowIndex (bool flag)
 control whether image has origin at top left (default) or bottom left. More...
 
char ** getRowArray ()
 Get an array of pointers to the rows of the image. More...
 
yarp::os::Type getReadType () const override
 
- Public Member Functions inherited from yarp::os::Portable
bool read (ConnectionReader &reader) override=0
 Read this object from a network connection. More...
 
bool write (ConnectionWriter &writer) const override=0
 Write this object to a network connection. More...
 
virtual Type getType () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual bool read (ConnectionReader &reader)=0
 Read this object from a network connection. More...
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual bool write (ConnectionWriter &writer) const =0
 Write this object to a network connection. More...
 
virtual void onCompletion () const
 This is called when the port has finished all writing operations. More...
 
virtual void onCommencement () const
 This is called when the port is about to begin writing operations. More...
 
virtual yarp::os::Type getWriteType () const
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (const PortWriter &writer, PortReader &reader)
 Copy one portable to another, via writing and reading. More...
 
- Protected Member Functions inherited from yarp::sig::Image
void setPixelCode (int imgPixelCode)
 
void setPixelSize (size_t imgPixelSize)
 

Detailed Description

template<class T>
class yarp::sig::ImageOf< T >

Typed image class.

This is a wrapper over yarp::sig::Image providing type security for pixel access. "T" can be any of sig::PixelMono, sig::PixelMono16, sig::PixelRgb, sig::PixelHsv, sig::PixelBgr, sig::PixelMonoSigned, sig::PixelRgbSigned, sig::PixelFloat, sig::PixelRgbFloat, sig::PixelHsvFloat, sig::PixelInt. If ImageOf::copy is called for two such images, a reasonable casting operation will occur if the pixel types are different.

Examples
dev/file_grabber/file_grabber.cpp, and dev/grabber_client/grabber_client.cpp.

Definition at line 652 of file Image.h.

Constructor & Destructor Documentation

◆ ImageOf()

template<class T >
yarp::sig::ImageOf< T >::ImageOf ( )
inline

Definition at line 657 of file Image.h.

Member Function Documentation

◆ getPixelCode() [1/15]

int yarp::sig::ImageOf< yarp::sig::PixelMono >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 699 of file Image.h.

◆ getPixelCode() [2/15]

int yarp::sig::ImageOf< yarp::sig::PixelMono16 >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 704 of file Image.h.

◆ getPixelCode() [3/15]

int yarp::sig::ImageOf< yarp::sig::PixelRgb >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 709 of file Image.h.

◆ getPixelCode() [4/15]

int yarp::sig::ImageOf< yarp::sig::PixelRgba >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 714 of file Image.h.

◆ getPixelCode() [5/15]

int yarp::sig::ImageOf< yarp::sig::PixelHsv >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 719 of file Image.h.

◆ getPixelCode() [6/15]

int yarp::sig::ImageOf< yarp::sig::PixelBgr >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 724 of file Image.h.

◆ getPixelCode() [7/15]

int yarp::sig::ImageOf< yarp::sig::PixelBgra >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 729 of file Image.h.

◆ getPixelCode() [8/15]

int yarp::sig::ImageOf< yarp::sig::PixelMonoSigned >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 734 of file Image.h.

◆ getPixelCode() [9/15]

int yarp::sig::ImageOf< yarp::sig::PixelRgbSigned >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 739 of file Image.h.

◆ getPixelCode() [10/15]

int yarp::sig::ImageOf< yarp::sig::PixelFloat >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 744 of file Image.h.

◆ getPixelCode() [11/15]

int yarp::sig::ImageOf< yarp::sig::PixelRgbFloat >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 749 of file Image.h.

◆ getPixelCode() [12/15]

int yarp::sig::ImageOf< yarp::sig::PixelRgbInt >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 754 of file Image.h.

◆ getPixelCode() [13/15]

int yarp::sig::ImageOf< yarp::sig::PixelHsvFloat >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 759 of file Image.h.

◆ getPixelCode() [14/15]

int yarp::sig::ImageOf< yarp::sig::PixelInt >::getPixelCode ( ) const
inlinevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 764 of file Image.h.

◆ getPixelCode() [15/15]

template<typename T >
int yarp::sig::ImageOf< T >::getPixelCode
inlineoverridevirtual

Gets pixel type identifier.

Images have an associated type identifier to permit automatic casting between different image types.

Returns
the image type identifier

Reimplemented from yarp::sig::Image.

Definition at line 769 of file Image.h.

◆ getPixelSize()

template<class T >
size_t yarp::sig::ImageOf< T >::getPixelSize ( ) const
inlineoverridevirtual

Gets pixel size in memory in bytes.

Returns
the size of the pixels stored in the image, in bytes

Reimplemented from yarp::sig::Image.

Definition at line 663 of file Image.h.

◆ operator()() [1/2]

template<class T >
T & yarp::sig::ImageOf< T >::operator() ( size_t  x,
size_t  y 
)
inline

Definition at line 681 of file Image.h.

◆ operator()() [2/2]

template<class T >
const T & yarp::sig::ImageOf< T >::operator() ( size_t  x,
size_t  y 
) const
inline

Definition at line 677 of file Image.h.

◆ pixel() [1/2]

template<class T >
T & yarp::sig::ImageOf< T >::pixel ( size_t  x,
size_t  y 
)
inline

Definition at line 669 of file Image.h.

◆ pixel() [2/2]

template<class T >
T & yarp::sig::ImageOf< T >::pixel ( size_t  x,
size_t  y 
) const
inline

Definition at line 673 of file Image.h.

◆ safePixel() [1/2]

template<class T >
T & yarp::sig::ImageOf< T >::safePixel ( size_t  x,
size_t  y 
)
inline

Definition at line 685 of file Image.h.

◆ safePixel() [2/2]

template<class T >
const T & yarp::sig::ImageOf< T >::safePixel ( size_t  x,
size_t  y 
) const
inline

Definition at line 690 of file Image.h.


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