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.

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 |
| sensor * | data |
| double | oldsize |
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.
| enum ValueTypes |
| PositionCameraSensor | ( | PositionCameraSensorConf | conf = getDefaultConf() |
) | [inline] |
The camera image should be black and white (e.g.
| values | sensor values to compute ( |
| 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] |
| 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
| 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] |
PositionCameraSensorConf conf [protected] |
int num [protected] |
double oldsize [protected] |
1.6.3