roviz  0.7
Code Documentation of roviz
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Image Class Reference

A portable image class with smart memory management. More...

#include <image.h>

Inheritance diagram for Image:
Inheritance graph
Collaboration diagram for Image:
Collaboration graph

Public Types

enum  Format {
  NoFormat, RGB555, RGB888, Gray8,
  YUV422, YUV422_Flipped, BGR_CV
}
 Enum of all supported image formats.
 

Public Member Functions

 Image (const StreamObject &base)
 Converts a StreamObject to an Image. More...
 
 Image (std::initializer_list< SourceID > sources={})
 Standard constructor. More...
 
int width (void) const
 
int height (void) const
 
enum Format format (void) const
 
int bitsPerPixel (void) const
 
int bytesPerPixel (void) const
 
int dataLength (void) const
 
const unsigned char * data (void) const
 
- Public Member Functions inherited from StreamObject
SourceID id (void) const
 Get the SourceID of the object. More...
 

Static Public Member Functions

static StreamWidgetinitWidget (OutputPrivate *out)
 initWidget Returns a ImageWidget to display the image More...
 

Protected Member Functions

 Image (bool do_init, std::initializer_list< SourceID > sources)
 
- Protected Member Functions inherited from StreamObject
void initSources (std::initializer_list< SourceID > sources={})
 

Protected Attributes

ImagePrivate_this
 
- Protected Attributes inherited from StreamObject
std::shared_ptr< StreamObjectPrivate_this_base
 

Detailed Description

A portable image class with smart memory management.

This class is pseudo-const. It can be assigned, but the data cannot be altered. To alter the data of an image, use ImageMutable. If you are done manipulating the pixels, convert it to a Image and pass it to the receiver. The receiver has no way (unless he is really nasty) to go back and alter the data again. This means the image data is protected (and read-only access is thread safe). This prevents that two items that receive the same image manipulate each others data. You can also directly convert Qt images (QImage) and OpenCV images (cv::Mat) to Images.

See also
ImageMutable
ImagePrivate

Constructor & Destructor Documentation

◆ Image() [1/2]

Image::Image ( const StreamObject base)

Converts a StreamObject to an Image.

Parameters
baseThe StreamObject

This is only used internally, a plugin should never need to use that. Only use it if you're absolutely sure the StreamObject is in fact an Image!

Here is the caller graph for this function:

◆ Image() [2/2]

Image::Image ( std::initializer_list< SourceID >  sources = {})

Standard constructor.

Parameters
sourcesSource tree

Needed by some container classes. Not really useful otherwise.

Here is the call graph for this function:

Member Function Documentation

◆ bitsPerPixel()

int Image::bitsPerPixel ( void  ) const
Returns
The number of bits per pixel (not per channel!)

◆ bytesPerPixel()

int Image::bytesPerPixel ( void  ) const
Returns
The number of bytes per pixel

◆ data()

const unsigned char * Image::data ( void  ) const
Returns
A pointer to the pixel data
Here is the caller graph for this function:

◆ dataLength()

int Image::dataLength ( void  ) const
Returns
The lenght of the pixel data in bytes
Here is the caller graph for this function:

◆ format()

Image::Format Image::format ( void  ) const
Returns
The format of the image
Here is the caller graph for this function:

◆ height()

int Image::height ( void  ) const
Returns
The height of the image
Here is the caller graph for this function:

◆ initWidget()

StreamWidget * Image::initWidget ( OutputPrivate out)
static

initWidget Returns a ImageWidget to display the image

Parameters
streamThe asocciated stream
Returns
The QWidget to show

See 'How to create your own streams'

◆ width()

int Image::width ( void  ) const
Returns
The width of the image
Here is the caller graph for this function:

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