Flair
Framework Libre Air
flair::sensor::Camera Class Reference

Base class for Camera. More...

#include <Camera.h>

+ Inheritance diagram for flair::sensor::Camera:

Public Types

enum  LogFormat { LogFormat::NONE, LogFormat::RAW, LogFormat::JPG }
 log formats More...
 
- Public Types inherited from flair::core::Object
enum  color_t { Auto = 0, Red = 31, Green = 32, Orange = 33 }
 

Public Member Functions

 Camera (std::string name, uint16_t width, uint16_t height, core::cvimage::Type::Format format)
 Constructor. More...
 
 Camera (const core::IODevice *parent, std::string name)
 Constructor. More...
 
 ~Camera ()
 Destructor. More...
 
void UseDefaultPlot (const core::cvimage *image)
 Use default plot. More...
 
gui::GridLayoutGetLayout (void) const
 get Layout More...
 
gui::TabGetPlotTab (void) const
 plot tab More...
 
void SaveRawPictureToFile (std::string filename) const
 Save raw picture to file. More...
 
void SavePictureToFile (std::string filename="") const
 Save picture to file. More...
 
uint16_t Width (void) const
 Width. More...
 
uint16_t Height (void) const
 Height. More...
 
core::cvimageOutput (void)
 Output matrix. More...
 
core::DataType const & GetOutputDataType () const
 
void SetLogFormat (LogFormat logFormat)
 Set log format. More...
 
void ProcessUpdate (core::io_data *data)
 
- Public Member Functions inherited from flair::core::IODevice
 IODevice (const Object *parent, std::string name)
 Constructor. More...
 
virtual ~IODevice ()
 Destructor. More...
 
void AddDeviceToLog (const IODevice *device)
 Add an IODevice to the logs. More...
 
void AddDataToLog (const io_data *data)
 Add an io_data to the log. More...
 
void OutputToShMem (bool enabled)
 Send the output to a shared memory. More...
 
bool IsReady (void) const
 is device ready More...
 
virtual DataType const & GetInputDataType () const
 
- Public Member Functions inherited from flair::core::Object
 Object (const Object *parent=NULL, std::string name="", std::string type="")
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string ObjectName (void) const
 Name. More...
 
std::string ObjectType (void) const
 Type. More...
 
const ObjectParent (void) const
 Parent. More...
 
std::vector< const Object * > * TypeChilds (void) const
 Childs of the same type. More...
 
std::vector< const Object * > * Childs (void) const
 Childs. More...
 
void Information (const char *function, int line, const char *format,...) const
 Formatted information. More...
 
void Warning (const char *function, const char *format,...) const
 Formatted warning. More...
 
void Error (const char *function, const char *format,...) const
 Formatted error. More...
 
bool ErrorOccured (bool recursive=true) const
 Has an errror occured? More...
 

Protected Member Functions

gui::GroupBoxGetGroupBox (void) const
 get GroupBox More...
 
- Protected Member Functions inherited from flair::core::IODevice
void ProcessUpdate (io_data *data)
 Process the childs of type IODevice, and log if needed. More...
 
void SetIsReady (bool status)
 set is ready More...
 

Protected Attributes

core::cvimageoutput
 

Detailed Description

Base class for Camera.

Use this class to define a custom Camera.

Member Enumeration Documentation

log formats

Enumerator
NONE 

by default, no logging

RAW 

raw format

JPG 

jpg format

Constructor & Destructor Documentation

flair::sensor::Camera::Camera ( std::string  name,
uint16_t  width,
uint16_t  height,
core::cvimage::Type::Format  format 
)

Constructor.

Construct a Camera. It will be child of the FrameworkManager.

Parameters
namename
widthwidth
heightheight
formatimage format
flair::sensor::Camera::Camera ( const core::IODevice parent,
std::string  name 
)

Constructor.

Construct a Camera.
This contructor must only be called for a simulated device.

Parameters
parentparent
namename
flair::sensor::Camera::~Camera ( )

Destructor.

Member Function Documentation

void flair::sensor::Camera::UseDefaultPlot ( const core::cvimage image)

Use default plot.

Parameters
imageimage to display
gui::GridLayout* flair::sensor::Camera::GetLayout ( void  ) const

get Layout

Returns
a Layout available
gui::Tab* flair::sensor::Camera::GetPlotTab ( void  ) const

plot tab

Returns
plot tab
void flair::sensor::Camera::SaveRawPictureToFile ( std::string  filename) const

Save raw picture to file.

Parameters
filenamefilename
void flair::sensor::Camera::SavePictureToFile ( std::string  filename = "") const

Save picture to file.

Parameters
filenamefilename; if ommitted, current time is used and file is saved in current directory with jpg compression
uint16_t flair::sensor::Camera::Width ( void  ) const

Width.

Returns
width
uint16_t flair::sensor::Camera::Height ( void  ) const

Height.

Returns
height
core::cvimage* flair::sensor::Camera::Output ( void  )

Output matrix.

Output matrix is of the same size as declared in constructor.

Returns
the output matrix
void flair::sensor::Camera::SetLogFormat ( LogFormat  logFormat)

Set log format.

Set the log format.
Logging of the camera will be disabled if this method is not called.
Calling this method enables logging of camera.

Parameters
LogFormatlog format
gui::GroupBox* flair::sensor::Camera::GetGroupBox ( void  ) const
protected

get GroupBox

Returns
a GroupBox available