Homepage Demos Overview Downloads Tutorials Reference
Credits

BallDetectionGenerator Class Reference

#include <BallDetectionGenerator.h>

Inheritance diagram for BallDetectionGenerator:

Inheritance graph
[legend]
List of all members.

Detailed Description

Uses segmented color region information to detect round objects.

This expects its events to come from a RegionGenerator (or a compatable subclass)

Sends a VisionObjectEvent only for the largest ball found (if one is found)

You can set the index of the color of the ball to look for in the constructor, so you can have several of these running looking for balls of different colors.

This is one of our oldest code segments, and has been hacked on a lot, so apologies for a bit of a mess...

Definition at line 23 of file BallDetectionGenerator.h.

Public Member Functions

 BallDetectionGenerator (EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid, unsigned int colorIdx, unsigned int threshmapChan, unsigned int noiseFiltering, float confidence)
 constructor
virtual void processEvent (const EventBase &event)
 see class notes above for what data this can handle

Static Public Member Functions

static std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Protected Types

typedef unsigned char uchar
 shorthand

Protected Member Functions

void testSendEvent (const FilterBankEvent &ev, float conf, int regcenX, int regcenY)
 decides wether to actually send the event based on confidence threshold.
void createEvent (EventBase::EventTypeID_t etid, float centerX, float centerY) const
 does the actual event sending

Static Protected Member Functions

static int calcEdgeMask (int x1, int x2, int y1, int y2, int width, int height)
 returns a bit mask corresponding to edges touched by the coordinates passed
static float pct_from_mean (float a, float b)
 returns

\[ \left|\frac{a-b}{a+b}\right| \]



Protected Attributes

unsigned int clrIdx
 the index of the color of the ball we're looking for
unsigned int tmIdx
 the index of the theshold map (channel) of the FilterBankEvent
VObject ball
 information about the best ball found
bool present
 if true, we think we have a ball in front of us
unsigned int count
 for each frame where we don't agree with present's value, this is incremented and compared against noiseFilter.
unsigned int noiseThreshold
 the number of frames to wait to make sure an object has dissappeared/reappeared
float confidenceThreshold
 how sure we should be it's a ball before declaring it as such.

Static Protected Attributes

static const unsigned int NUM_CHECK = 10
 the number of regions to check (from largest to smallest)
Edge masks
static const uchar OFF_EDGE_LEFT = 1<<1
 bitmask for calcEdgeMask results
static const uchar OFF_EDGE_RIGHT = 1<<2
 bitmask for calcEdgeMask results
static const uchar OFF_EDGE_TOP = 1<<3
 bitmask for calcEdgeMask results
static const uchar OFF_EDGE_BOTTOM = 1<<4
 bitmask for calcEdgeMask results

Private Member Functions

 BallDetectionGenerator (const BallDetectionGenerator &fbk)
 don't call
const BallDetectionGeneratoroperator= (const BallDetectionGenerator &fbk)
 don't call

Classes

struct  VObject
 High level vision ouput structure for detected objects. More...


Member Typedef Documentation

typedef unsigned char BallDetectionGenerator::uchar [protected]
 

shorthand

Definition at line 34 of file BallDetectionGenerator.h.


Constructor & Destructor Documentation

BallDetectionGenerator::BallDetectionGenerator EventBase::EventGeneratorID_t  gid,
unsigned int  sid,
unsigned int  mysid,
unsigned int  colorIdx,
unsigned int  threshmapChan,
unsigned int  noiseFiltering,
float  confidence
 

constructor

Definition at line 14 of file BallDetectionGenerator.cc.

BallDetectionGenerator::BallDetectionGenerator const BallDetectionGenerator fbk  )  [private]
 

don't call


Member Function Documentation

int BallDetectionGenerator::calcEdgeMask int  x1,
int  x2,
int  y1,
int  y2,
int  width,
int  height
[static, protected]
 

returns a bit mask corresponding to edges touched by the coordinates passed

Definition at line 256 of file BallDetectionGenerator.cc.

Referenced by processEvent().

void BallDetectionGenerator::createEvent EventBase::EventTypeID_t  etid,
float  centerX,
float  centerY
const [protected]
 

does the actual event sending

Definition at line 249 of file BallDetectionGenerator.cc.

Referenced by testSendEvent().

static std::string BallDetectionGenerator::getClassDescription  )  [inline, static]
 

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

If you do override this, also consider overriding getDescription() to return it

Reimplemented from BehaviorBase.

Definition at line 28 of file BallDetectionGenerator.h.

const BallDetectionGenerator& BallDetectionGenerator::operator= const BallDetectionGenerator fbk  )  [private]
 

don't call

static float BallDetectionGenerator::pct_from_mean float  a,
float  b
[inline, static, protected]
 

returns

\[ \left|\frac{a-b}{a+b}\right| \]

Definition at line 61 of file BallDetectionGenerator.h.

Referenced by processEvent().

void BallDetectionGenerator::processEvent const EventBase event  )  [virtual]
 

see class notes above for what data this can handle

Reimplemented from EventGeneratorBase.

Definition at line 19 of file BallDetectionGenerator.cc.

void BallDetectionGenerator::testSendEvent const FilterBankEvent ev,
float  conf,
int  regcenX,
int  regcenY
[protected]
 

decides wether to actually send the event based on confidence threshold.

Definition at line 216 of file BallDetectionGenerator.cc.

Referenced by processEvent().


Member Data Documentation

VObject BallDetectionGenerator::ball [protected]
 

information about the best ball found

Definition at line 68 of file BallDetectionGenerator.h.

Referenced by processEvent().

unsigned int BallDetectionGenerator::clrIdx [protected]
 

the index of the color of the ball we're looking for

Definition at line 66 of file BallDetectionGenerator.h.

Referenced by processEvent().

float BallDetectionGenerator::confidenceThreshold [protected]
 

how sure we should be it's a ball before declaring it as such.

Definition at line 72 of file BallDetectionGenerator.h.

Referenced by testSendEvent().

unsigned int BallDetectionGenerator::count [protected]
 

for each frame where we don't agree with present's value, this is incremented and compared against noiseFilter.

Definition at line 70 of file BallDetectionGenerator.h.

Referenced by testSendEvent().

unsigned int BallDetectionGenerator::noiseThreshold [protected]
 

the number of frames to wait to make sure an object has dissappeared/reappeared

Definition at line 71 of file BallDetectionGenerator.h.

Referenced by testSendEvent().

const unsigned int BallDetectionGenerator::NUM_CHECK = 10 [static, protected]
 

the number of regions to check (from largest to smallest)

Definition at line 43 of file BallDetectionGenerator.h.

Referenced by processEvent().

const uchar BallDetectionGenerator::OFF_EDGE_BOTTOM = 1<<4 [static, protected]
 

bitmask for calcEdgeMask results

Definition at line 40 of file BallDetectionGenerator.h.

Referenced by calcEdgeMask().

const uchar BallDetectionGenerator::OFF_EDGE_LEFT = 1<<1 [static, protected]
 

bitmask for calcEdgeMask results

Definition at line 37 of file BallDetectionGenerator.h.

Referenced by calcEdgeMask().

const uchar BallDetectionGenerator::OFF_EDGE_RIGHT = 1<<2 [static, protected]
 

bitmask for calcEdgeMask results

Definition at line 38 of file BallDetectionGenerator.h.

Referenced by calcEdgeMask().

const uchar BallDetectionGenerator::OFF_EDGE_TOP = 1<<3 [static, protected]
 

bitmask for calcEdgeMask results

Definition at line 39 of file BallDetectionGenerator.h.

Referenced by calcEdgeMask().

bool BallDetectionGenerator::present [protected]
 

if true, we think we have a ball in front of us

Definition at line 69 of file BallDetectionGenerator.h.

Referenced by testSendEvent().

unsigned int BallDetectionGenerator::tmIdx [protected]
 

the index of the theshold map (channel) of the FilterBankEvent

Definition at line 67 of file BallDetectionGenerator.h.

Referenced by processEvent().


The documentation for this class was generated from the following files:

Tekkotsu v2.2.2
Generated Tue Jan 4 15:45:21 2005 by Doxygen 1.4.0