YARP  2.3.68+225-20170329.5+gitb0d3289
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

virtual int getPixelSize () const
 Gets pixel size in memory in bytes. More...
 
virtual int getPixelCode () const
 Gets pixel type identifier. More...
 
T & pixel (int x, int y)
 
T & pixel (int x, int y) const
 
const T & operator() (int x, int y) const
 
T & operator() (int x, int y)
 
T & safePixel (int x, int y)
 
const T & safePixel (int x, int y) const
 
- Public Member Functions inherited from yarp::sig::Image
 Image ()
 Default constructor. More...
 
 Image (const Image &alt)
 Copy constructor. More...
 
virtual ~Image ()
 Destructor. More...
 
const Imageoperator= (const Image &alt)
 Assignment operator. More...
 
bool copy (const Image &alt)
 Copy operator. More...
 
bool copy (const Image &alt, int w, int h)
 Scaled copy. More...
 
int width () const
 Gets width of image in pixels. More...
 
int height () const
 Gets height of image in pixels. More...
 
int getRowSize () const
 Size of the underlying image buffer rows. More...
 
int getQuantum () const
 The size of a row is constrained to be a multiple of the "quantum". More...
 
int getPadding () const
 Returns the number of padding bytes. More...
 
unsigned char * getRow (int r)
 Get the address of a the first byte of a row in memory. More...
 
const unsigned char * getRow (int r) const
 Get the address of a the first byte of a row in memory, const versions. More...
 
unsigned char * getPixelAddress (int x, int y) const
 Get address of a pixel in memory. More...
 
bool isPixel (int x, int y) const
 Check whether a coordinate lies within the image. More...
 
void zero ()
 Set all pixels to 0. More...
 
void resize (int imgWidth, int 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, int imgWidth, int imgHeight)
 Use this to wrap an external image. More...
 
unsigned char * getRawImage () const
 Access to the internal image buffer. More...
 
int 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...
 
virtual bool read (yarp::os::ConnectionReader &connection)
 Read image from a connection. More...
 
virtual bool write (yarp::os::ConnectionWriter &connection)
 Write image to a connection. More...
 
void setQuantum (int 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...
 
virtual yarp::os::Type getReadType ()
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType ()
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual void onCompletion ()
 This is called when the port has finished all writing operations. More...
 
virtual void onCommencement ()
 This is called when the port is about to begin writing operations. More...
 
virtual Type getWriteType ()
 

Private Attributes

nullPixel
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (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 (int imgPixelSize)
 

Detailed Description

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

Typed image class.

This is a wrapper over YARPGenericImage 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:
opencv/main.cpp.

Definition at line 23 of file Image.h.

Member Function Documentation

◆ getPixelCode()

template<class T>
virtual int yarp::sig::ImageOf< T >::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 559 of file Image.h.

◆ getPixelSize()

template<class T>
virtual int yarp::sig::ImageOf< T >::getPixelSize ( ) const
inlinevirtual

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 555 of file Image.h.

◆ operator()() [1/2]

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

Definition at line 571 of file Image.h.

◆ operator()() [2/2]

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

Definition at line 575 of file Image.h.

◆ pixel() [1/2]

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

Definition at line 563 of file Image.h.

◆ pixel() [2/2]

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

Definition at line 567 of file Image.h.

◆ safePixel() [1/2]

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

Definition at line 579 of file Image.h.

◆ safePixel() [2/2]

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

Definition at line 584 of file Image.h.

Member Data Documentation

◆ nullPixel

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

Definition at line 552 of file Image.h.


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