25 #ifndef __OPTICALFLOW_H
26 #define __OPTICALFLOW_H
29 #include <selforg/controller_misc.h>
105 virtual int get(
sensor* sensors,
int length)
const;
120 const unsigned char*
const I2,
121 const Vec2i& field,
int size,
int width,
int height,
122 int bytesPerPixel,
int d_x,
int d_y);
129 const osg::Image* last,
double& minerror)
const;
OpticalFlow(OpticalFlowConf conf=getDefaultConf())
Definition: opticalflow.cpp:42
std::list< std::pair< Vec2i, int > > FlowDelList
Definition: opticalflow.h:70
Definition: opticalflow.h:60
configuration object for OpticalFlow
Definition: opticalflow.h:34
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 ...
Definition: opticalflow.cpp:195
double avgerror
Definition: opticalflow.h:143
int maxShiftX
Definition: opticalflow.h:138
Vec2i operator*(int i) const
Definition: opticalflow.cpp:35
int maxShiftY
Definition: opticalflow.h:139
static OpticalFlowConf getDefaultConf()
the default config has 2 points in and calculates the flow in X and Y
Definition: opticalflow.h:86
double sensor
Definition: types.h:29
std::list< Pos > points
points to measure optical flow in normalized coordinates [-1,1] however the points are placed suffici...
Definition: opticalflow.h:40
double maxFlow
maximum fraction of the image dimension to consider for a possible flow.
Definition: opticalflow.h:44
int y
Definition: opticalflow.h:64
static std::list< Pos > getDefaultPoints(int num)
calculates default positions for optical flow detection.
Definition: opticalflow.cpp:59
int fieldSize
size (edge length) of the measurement field (block) in pixel (if 0 then 1/12th of width) ...
Definition: opticalflow.h:47
Vec2i operator/(int i) const
Definition: opticalflow.cpp:38
sensor * data
Definition: opticalflow.h:135
virtual void intern_init()
overload this function to initialized you data structures.
Definition: opticalflow.cpp:73
virtual ~OpticalFlow()
Definition: opticalflow.cpp:52
std::list< Vec2i > fields
Definition: opticalflow.h:134
Data structure holding all essential global information.
Definition: globaldata.h:57
int num
Definition: opticalflow.h:133
osg::Image * lasts[4]
Definition: opticalflow.h:136
int cnt
Definition: opticalflow.h:142
int width
Definition: opticalflow.h:140
Vec2i(int x, int y)
Definition: opticalflow.h:62
Class to connect a Camera as a sensor to a robot.
Definition: camerasensor.h:43
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.
Definition: opticalflow.cpp:168
OpticalFlowConf conf
Definition: opticalflow.h:132
int verbose
verbosity level (0: quite, 1: initialization values, 2: warnings, 3: info, 4: debug) ...
Definition: opticalflow.h:50
int height
Definition: opticalflow.h:141
This CameraSensor calculates the optical flow at few points of the image based on a box matching tech...
Definition: opticalflow.h:57
std::vector< Vec2i > oldFlows
Definition: opticalflow.h:137
Sensor::Dimensions dims
dimensions to return the flow (X means horizonal, Y vertical)
Definition: opticalflow.h:36
int x
Definition: opticalflow.h:63
Dimensions
defines which dimensions should be sensed. The meaning is sensor specific.
Definition: sensor.h:46
Vec2i operator+(const Vec2i &v) const
Definition: opticalflow.cpp:32
virtual bool sense(const GlobalData &globaldata)
Performs the calculations.
Definition: opticalflow.cpp:108
int c
Definition: hexapod.cpp:56
Vec2i()
Definition: opticalflow.h:61
virtual int getSensorNumber() const
overload this function and return the number of sensor values
Definition: opticalflow.h:101