PositionCameraSensor Class Reference

This CameraSensor calculates the position of the visible object(s) that is essentially the center of gravity of the image. More...

#include <camerasensors.h>

Inherits lpzrobots::CameraSensor.

Inherited by MotionCameraSensor.

Collaboration diagram for PositionCameraSensor:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ValueTypes { None = 0, Position = 1, Size = 2, SizeChange = 4 }
 

additional sensor values.

More...

Public Member Functions

 PositionCameraSensor (PositionCameraSensorConf conf=getDefaultConf())
 The camera image should be black and white (e.g.
virtual ~PositionCameraSensor ()
virtual void intern_init ()
 overload this function to initialized you data structures.
virtual bool sense (const GlobalData &globaldata)
 Performs the calculations.
virtual int getSensorNumber () const
 overload this function and return the number of sensor values
virtual int get (sensor *sensors, int length) const
 overload this function and return the sensor values

Static Public Member Functions

static PositionCameraSensorConf getDefaultConf ()

Protected Member Functions

virtual bool processAndFillData (double &x, double &y, double &size, int &k)
 process sensor information and fills

Static Protected Member Functions

static bool calcImgCOG (const osg::Image *img, double &x, double &y, double &size, int threshold=1)
 calculates the Center of Gravity (normalized to -1 to 1) of an image.

Protected Attributes

PositionCameraSensorConf conf
int num
sensordata
double oldsize

Detailed Description

This CameraSensor calculates the position of the visible object(s) that is essentially the center of gravity of the image.

The position in normalized to -1 to 1. Probably you want to use an image processor like ColorFilterImgProc before.


Member Enumeration Documentation

enum ValueTypes

additional sensor values.

Size is the size of the object (only one value, independent of the dimensions

Enumerator:
None 
Position 
Size 
SizeChange 

Constructor & Destructor Documentation

PositionCameraSensor ( PositionCameraSensorConf  conf = getDefaultConf()  )  [inline]

The camera image should be black and white (e.g.

See also:
BWImageProcessor or ColorFilterImgProc)
CameraSensor for further parameter explanation.
Parameters:
values sensor values to compute (
See also:
PositionCameraSensor::ValueTypes)
Parameters:
dims dimensions to return the position (X means horizonal, Y vertical)
border if >0 then the size and sizechange are zero if position is that far (border) away from image border
virtual ~PositionCameraSensor (  )  [inline, virtual]

Member Function Documentation

static bool calcImgCOG ( const osg::Image *  img,
double &  x,
double &  y,
double &  size,
int  threshold = 1 
) [inline, static, protected]

calculates the Center of Gravity (normalized to -1 to 1) of an image.

As a bonus it also calculates the sum of all pixels (normalizes to 0-2.5) in size

Returns:
false if image is too dark
virtual int get ( sensor sensors,
int  length 
) const [inline, virtual]

overload this function and return the sensor values

Implements CameraSensor.

static PositionCameraSensorConf getDefaultConf (  )  [inline, static]

Reimplemented in MotionCameraSensor.

virtual int getSensorNumber (  )  const [inline, virtual]

overload this function and return the number of sensor values

Implements CameraSensor.

virtual void intern_init (  )  [inline, virtual]

overload this function to initialized you data structures.

Use camera->getImage() to get the image from the camera

Implements CameraSensor.

virtual bool processAndFillData ( double &  x,
double &  y,
double &  size,
int &  k 
) [inline, protected, virtual]

process sensor information and fills

virtual bool sense ( const GlobalData globaldata  )  [inline, virtual]

Performs the calculations.

Implements CameraSensor.

Reimplemented in MotionCameraSensor.


Member Data Documentation

sensor* data [protected]
int num [protected]
double oldsize [protected]

The documentation for this class was generated from the following file:
Generated on Thu Jun 28 14:49:02 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3