OpticalFlow Class Reference
This CameraSensor calculates the optical flow at few points of the image based on a box matching technique.
More...
#include <opticalflow.h>
Inherits lpzrobots::CameraSensor.
List of all members.
Classes |
struct | Vec2i |
Public Types |
typedef std::list< std::pair
< Vec2i, int > > | FlowDelList |
Public Member Functions |
| OpticalFlow (OpticalFlowConf conf=getDefaultConf()) |
virtual | ~OpticalFlow () |
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 std::list< Pos > | getDefaultPoints (int num) |
| calculates default positions for optical flow detection.
|
static OpticalFlowConf | getDefaultConf () |
| the default config has 2 points in and calculates the flow in X and Y
|
Protected Member Functions |
Vec2i | calcFieldTransRGB (const Vec2i &field, const osg::Image *current, const osg::Image *last, double &minerror) const |
| calculates the optimal transformation for one field in RGB using all three color channels
|
Static Protected Member Functions |
static double | compareSubImg (const unsigned char *const I1, const unsigned char *const I2, const Vec2i &field, int size, int width, int height, int bytesPerPixel, int d_x, int d_y) |
| compares a small part of two given images and returns the average absolute difference.
|
Protected Attributes |
OpticalFlowConf | conf |
int | num |
std::list< Vec2i > | fields |
sensor * | data |
osg::Image * | lasts [4] |
std::vector< Vec2i > | oldFlows |
int | maxShiftX |
int | maxShiftY |
int | width |
int | height |
int | cnt |
double | avgerror |
Detailed Description
This CameraSensor calculates the optical flow at few points of the image based on a box matching technique.
This can be applied directly to the camera image.
Member Typedef Documentation
Constructor & Destructor Documentation
Member Function Documentation
OpticalFlow::Vec2i calcFieldTransRGB |
( |
const Vec2i & |
field, |
|
|
const osg::Image * |
current, |
|
|
const osg::Image * |
last, |
|
|
double & |
minerror | |
|
) |
| | const [protected] |
calculates the optimal transformation for one field in RGB using all three color channels
- Parameters:
-
| minerror | (is to return the minimum error achieved during the matching) |
double compareSubImg |
( |
const unsigned char *const |
I1, |
|
|
const unsigned char *const |
I2, |
|
|
const Vec2i & |
field, |
|
|
int |
size, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
bytesPerPixel, |
|
|
int |
d_x, |
|
|
int |
d_y | |
|
) |
| | [static, protected] |
compares a small part of two given images and returns the average absolute difference.
Field center, size and shift have to be choosen, so that no clipping is required!
- Parameters:
-
| field | specifies position(center) of subimage to use for comparison |
| size | specifies the size of the field edged in pixels |
| d_x | shift in x direction |
| d_y | shift in y direction |
int get |
( |
sensor * |
sensors, |
|
|
int |
length | |
|
) |
| | const [virtual] |
overload this function and return the sensor values
Implements CameraSensor.
the default config has 2 points in and calculates the flow in X and Y
list< Pos > getDefaultPoints |
( |
int |
num |
) |
[static] |
calculates default positions for optical flow detection.
The points are in aranged horizontally in a line at the vertical center. For num 2 the points are at the border, 3 points there is additioanlly one is the center and so on.
virtual int getSensorNumber |
( |
|
) |
const [inline, virtual] |
overload this function and return the number of sensor values
Implements CameraSensor.
void intern_init |
( |
|
) |
[virtual] |
overload this function to initialized you data structures.
Use camera->getImage() to get the image from the camera
Implements CameraSensor.
bool sense |
( |
const GlobalData & |
globaldata |
) |
[virtual] |
Member Data Documentation
osg::Image* lasts[4] [protected] |
The documentation for this class was generated from the following files: