Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

VisionObjectEvent Class Reference

Extends EventBase to also include location in the visual field and distance (though distance is not implimented yet). More...

#include <VisionObjectEvent.h>

Inheritance diagram for VisionObjectEvent:

Detailed Description

Extends EventBase to also include location in the visual field and distance (though distance is not implimented yet).

Definition at line 8 of file VisionObjectEvent.h.

List of all members.

Public Member Functions

 VisionObjectEvent (size_t sid=0, EventTypeID_t tid=EventBase::deactivateETID)
 Constructor, pass a source id and type id -- mainly useful for deactivate events since all object parameters are going to be set to 0.
 VisionObjectEvent (size_t sid, EventTypeID_t tid, float x1, float x2, float y1, float y2, float objarea, float rx, float ry)
 Constructor, pass the type id, source id, left, right, top, bottom, x range, and y range.
 VisionObjectEvent (size_t sid, EventTypeID_t tid, float x1, float x2, float y1, float y2, float objarea, float rx, float ry, unsigned int frame)
 Constructor, pass the type id, source id, left, right, top, bottom, x range, y range, and frame_number.
virtual ~VisionObjectEvent ()
 destructor
virtual EventBaseclone () const
 allows a copy to be made of an event, supporting polymorphism
virtual unsigned int getClassTypeID () const
 All subclasses should override this and return a unique ID for their class.
virtual std::string getDescription (bool showTypeSpecific=true, unsigned int verbosity=0) const
 generates a description of the event with variable verbosity
virtual unsigned int getBinSize () const
 should return the minimum size needed if using binary format (i.e. not XML)
virtual unsigned int loadBinaryBuffer (const char buf[], unsigned int len)
 load from binary format
virtual unsigned int saveBinaryBuffer (char buf[], unsigned int len) const
 save to binary format
virtual void loadXML (xmlNode *node)
 load from XML format
virtual void saveXML (xmlNode *node) const
 save to XML format
Attribute Accessors

float getLeft () const
 returns the initial x (_x1) coordinate of the Bounding Box (inclusive value)
VisionObjectEventsetLeft (float x1)
 sets the initial x (_x1) coordinate of the Bounding Box
float getRight () const
 returns the final x (_x2) coordinate of the Bounding Box (inclusive value)
VisionObjectEventsetRight (float x2)
 sets the final x (_x2) coordinate of the Bounding Box
float getTop () const
 returns the initial y (_y1) coordinate of the Bounding Box (inclusive value)
VisionObjectEventsetTop (float y1)
 sets the initial y (_y1) coordinate of the Bounding Box
float getBottom () const
 returns the final y (_y2) coordinate of the Bounding Box (inclusive value)
VisionObjectEventsetBottom (float y2)
 sets the final y (_y2) coordinate of the Bounding Box
float getObjectArea () const
 returns the object's _area within the camera, in squared generalized coordinates. Multiply by the square of the major camera resolution (normally RobotInfo::CameraResolutionX if using full resolution) and divide by 4.0 to get pixel area.
VisionObjectEventsetObjectArea (float objarea)
 sets the object's _area within the camera, in squared generalized coordinates (multiply by the major camera resolution to get pixel area)
Object out of bounds Detection Functions

bool isClipped () const
 returns _clipLeft
bool isClippedLeft () const
 returns _clipLeft
bool isClippedRight () const
 returns _clipRight
bool isClippedTop () const
 returns _clipTop
bool isClippedBottom () const
 returns _clipBottom
void setClipping (bool left, bool right, bool top, bool bottom)
 sets clipping boundaries

Protected Attributes

float _x1
 a value representing location in visual field - from -1 if on the left edge to 1 if it's on the right edge, see Config::vision_config::x_range
float _x2
 a value representing location in visual field - from -1 if on the left edge to 1 if it's on the right edge, see Config::vision_config::x_range
float _y1
 top boundary, in range of ±1/Configvision_config::aspectRatio, see Config::vision_config::y_range
float _y2
 bottom boundary, in range of ±1/Configvision_config::aspectRatio, see Config::vision_config::y_range
float _area
 area of the actual object within bounding box as set by generator, in same units as getBoundaryArea(). Multiply by the square of the major camera resolution (normally RobotInfo::CameraResolutionX if using full resolution) and divide by 4.0 to get pixel area.
bool _clipLeft
 flag to indicate left boundary is on or beyond the camera image's boundary
bool _clipRight
 flag to indicate right boundary is on or beyond the camera image's boundary
bool _clipTop
 flag to indicate top boundary is on or beyond the camera image's boundary
bool _clipBottom
 flag to indicate bottom boundary is on or beyond the camera image's boundary
float _xRange
 Max range of X dimension (typically 1.0 for AIBO).
float _yRange
 Max range of Y dimension (typically around 0.8 for AIBO due to camera aspect ratio).
unsigned int _frame
 Number of frame when the event was generated.

Static Protected Attributes

static const
EventBase::classTypeID_t 
autoRegisterVisionObjectEvent = getTypeRegistry().registerType<VisionObjectEvent>(makeClassTypeID("VISO"))
 causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry())

Calculated Attributes



float getDistanceEstimate (float diaMajor, float diaMinor=0) const
 returns an estimate of how far away the object is if its major (larger) physical dimension is diaMajor and the other dimension is diaMinor; pass 0 if to only use the major dimension
float getCenterX () const
 returns the center along x
float getCenterY () const
 returns the center along y
float getWidth () const
 return width along x
float getHeight () const
 return height along y
float getBoundaryArea () const
 returns the area of the bounding box, just multiplication of width*height, (multiply by the major camera resolution to get pixel area)
float getXrange () const
 returns the maximum x value
float getYrange () const
 returns the maximum y value
unsigned int getFrame () const
 returns number of frame when the event was generated
static float calcDistance (float visArc, float physDia)
 returns the distance of an object, given that it takes up visArc of the camera's visual arc, and the physical crossection is physDia

Constructor & Destructor Documentation

VisionObjectEvent::VisionObjectEvent ( size_t  sid = 0,
EventTypeID_t  tid = EventBase::deactivateETID 
) [explicit]

Constructor, pass a source id and type id -- mainly useful for deactivate events since all object parameters are going to be set to 0.

Parameters:
sid The source ID for the object being detected -- you can define your own values, some are already set in ProjectInterface, but can be reassigned during your project's startup
tid The type ID for the event

Definition at line 14 of file VisionObjectEvent.h.

Referenced by clone().

VisionObjectEvent::VisionObjectEvent ( size_t  sid,
EventTypeID_t  tid,
float  x1,
float  x2,
float  y1,
float  y2,
float  objarea,
float  rx,
float  ry 
)

Constructor, pass the type id, source id, left, right, top, bottom, x range, and y range.

Parameters:
sid The source ID for the object being detected -- you can define your own values, some are already set in ProjectInterface, but can be reassigned during your project's startup
tid The type ID for the event
x1 The leftmost extent of the object, in generalized coordinates (see _x1)
x2 The rightmost extent of the object in generalized coordinates (see _x2)
y1 The topmost extent of the object, in generalized coordinates (see _y1)
y2 The bottommost extent of the object, in generalized coordinates (see _y2)
objarea The area of the object being detected, in squared generalized coordinates (see _area)
rx The plus/minus range of the x coordinates (generally xres/xres for cameras which are wider than they are high)
ry The plus/minus range of the y coordinates (camera yres/xres for cameras which are wider than they are high)

Definition at line 32 of file VisionObjectEvent.h.

VisionObjectEvent::VisionObjectEvent ( size_t  sid,
EventTypeID_t  tid,
float  x1,
float  x2,
float  y1,
float  y2,
float  objarea,
float  rx,
float  ry,
unsigned int  frame 
)

Constructor, pass the type id, source id, left, right, top, bottom, x range, y range, and frame_number.

Parameters:
sid The source ID for the object being detected -- you can define your own values, some are already set in ProjectInterface, but can be reassigned during your project's startup
tid The type ID for the event
x1 The leftmost extent of the object, in generalized coordinates (see _x1)
x2 The rightmost extent of the object in generalized coordinates (see _x2)
y1 The topmost extent of the object, in generalized coordinates (see _y1)
y2 The bottommost extent of the object, in generalized coordinates (see _y2)
objarea The area of the object being detected, in squared generalized coordinates (see _area)
rx The plus/minus range of the x coordinates (generally xres/xres for cameras which are wider than they are high)
ry The plus/minus range of the y coordinates (camera yres/xres for cameras which are wider than they are high)
frame The camera frame number the object was detected in (see _frame)

Definition at line 51 of file VisionObjectEvent.h.

virtual VisionObjectEvent::~VisionObjectEvent (  )  [virtual]

destructor

Definition at line 59 of file VisionObjectEvent.h.


Member Function Documentation

float VisionObjectEvent::calcDistance ( float  visArc,
float  physDia 
) [static]

returns the distance of an object, given that it takes up visArc of the camera's visual arc, and the physical crossection is physDia

Definition at line 44 of file VisionObjectEvent.cc.

Referenced by getDistanceEstimate().

virtual EventBase* VisionObjectEvent::clone (  )  const [virtual]

allows a copy to be made of an event, supporting polymorphism

Must be overridden by all subclasses to allow this to happen

I would like to switch this over to the cloneable interface once the compiler gets updated out of the 3.3 branch... see Cloneable::clone() for a discussion of the issue and implementation notes.

Reimplemented from EventBase.

Definition at line 61 of file VisionObjectEvent.h.

unsigned int VisionObjectEvent::getBinSize (  )  const [virtual]

should return the minimum size needed if using binary format (i.e. not XML)

Reimplemented from EventBase.

Definition at line 52 of file VisionObjectEvent.cc.

float VisionObjectEvent::getBottom (  )  const

returns the final y (_y2) coordinate of the Bounding Box (inclusive value)

Definition at line 75 of file VisionObjectEvent.h.

float VisionObjectEvent::getBoundaryArea (  )  const

returns the area of the bounding box, just multiplication of width*height, (multiply by the major camera resolution to get pixel area)

Definition at line 89 of file VisionObjectEvent.h.

float VisionObjectEvent::getCenterX (  )  const

returns the center along x

Definition at line 85 of file VisionObjectEvent.h.

Referenced by VisualTargetCloseTrans::doEvent(), DualCoding::Lookout::findLocationFor(), and Kinematics::projectToGround().

float VisionObjectEvent::getCenterY (  )  const

returns the center along y

Definition at line 86 of file VisionObjectEvent.h.

Referenced by VisualTargetCloseTrans::doEvent(), DualCoding::Lookout::findLocationFor(), and Kinematics::projectToGround().

virtual unsigned int VisionObjectEvent::getClassTypeID (  )  const [virtual]

All subclasses should override this and return a unique ID for their class.

All IDs corresponding to all-capital letters are reserved for future framework expansion. (Thus, user subclasses should contain at least one lower-case letter.) This code can be used when serializing to allow quick identification of the class type by the receiver.

Reimplemented from EventBase.

Definition at line 63 of file VisionObjectEvent.h.

std::string VisionObjectEvent::getDescription ( bool  showTypeSpecific = true,
unsigned int  verbosity = 0 
) const [virtual]

generates a description of the event with variable verbosity

Parameters:
showTypeSpecific should be read by subclasses to add additional information
verbosity can be one of the following values:

  • 0 - Basic: event_name \t generator_id \t source_id \t type_id
  • 1 - Numerics: event_name \t generator_id \t source_id \t type_id
  • 2 - Timing: event_name \t generator_id \t source_id \t type_id \t duration \t timestamp
  • 3 and above - Full: event_name \t generator_id \t source_id \t type_id \t duration \t timestamp \t magnitude if showTypeSpecific, additional fields will be added after the common fields listed above.

Reimplemented from EventBase.

Definition at line 10 of file VisionObjectEvent.cc.

float VisionObjectEvent::getDistanceEstimate ( float  diaMajor,
float  diaMinor = 0 
) const

returns an estimate of how far away the object is if its major (larger) physical dimension is diaMajor and the other dimension is diaMinor; pass 0 if to only use the major dimension

Definition at line 19 of file VisionObjectEvent.cc.

unsigned int VisionObjectEvent::getFrame (  )  const

returns number of frame when the event was generated

Definition at line 92 of file VisionObjectEvent.h.

float VisionObjectEvent::getHeight (  )  const

return height along y

Definition at line 88 of file VisionObjectEvent.h.

Referenced by getDistanceEstimate().

float VisionObjectEvent::getLeft (  )  const

returns the initial x (_x1) coordinate of the Bounding Box (inclusive value)

Definition at line 66 of file VisionObjectEvent.h.

float VisionObjectEvent::getObjectArea (  )  const

returns the object's _area within the camera, in squared generalized coordinates. Multiply by the square of the major camera resolution (normally RobotInfo::CameraResolutionX if using full resolution) and divide by 4.0 to get pixel area.

Definition at line 78 of file VisionObjectEvent.h.

float VisionObjectEvent::getRight (  )  const

returns the final x (_x2) coordinate of the Bounding Box (inclusive value)

Definition at line 69 of file VisionObjectEvent.h.

float VisionObjectEvent::getTop (  )  const

returns the initial y (_y1) coordinate of the Bounding Box (inclusive value)

Definition at line 72 of file VisionObjectEvent.h.

float VisionObjectEvent::getWidth (  )  const

return width along x

Definition at line 87 of file VisionObjectEvent.h.

Referenced by getDistanceEstimate().

float VisionObjectEvent::getXrange (  )  const

returns the maximum x value

Definition at line 90 of file VisionObjectEvent.h.

float VisionObjectEvent::getYrange (  )  const

returns the maximum y value

Definition at line 91 of file VisionObjectEvent.h.

bool VisionObjectEvent::isClipped (  )  const

returns _clipLeft

Definition at line 96 of file VisionObjectEvent.h.

bool VisionObjectEvent::isClippedBottom (  )  const

returns _clipBottom

Definition at line 100 of file VisionObjectEvent.h.

Referenced by isClipped().

bool VisionObjectEvent::isClippedLeft (  )  const

returns _clipLeft

Definition at line 97 of file VisionObjectEvent.h.

Referenced by isClipped().

bool VisionObjectEvent::isClippedRight (  )  const

returns _clipRight

Definition at line 98 of file VisionObjectEvent.h.

Referenced by isClipped().

bool VisionObjectEvent::isClippedTop (  )  const

returns _clipTop

Definition at line 99 of file VisionObjectEvent.h.

Referenced by isClipped().

unsigned int VisionObjectEvent::loadBinaryBuffer ( const char  buf[],
unsigned int  len 
) [virtual]

load from binary format

Reimplemented from EventBase.

Definition at line 66 of file VisionObjectEvent.cc.

void VisionObjectEvent::loadXML ( xmlNode node  )  [virtual]

load from XML format

Reimplemented from EventBase.

Definition at line 89 of file VisionObjectEvent.cc.

unsigned int VisionObjectEvent::saveBinaryBuffer ( char  buf[],
unsigned int  len 
) const [virtual]

save to binary format

Reimplemented from EventBase.

Definition at line 78 of file VisionObjectEvent.cc.

void VisionObjectEvent::saveXML ( xmlNode node  )  const [virtual]

save to XML format

Reimplemented from EventBase.

Definition at line 140 of file VisionObjectEvent.cc.

VisionObjectEvent& VisionObjectEvent::setBottom ( float  y2  ) 

sets the final y (_y2) coordinate of the Bounding Box

Definition at line 76 of file VisionObjectEvent.h.

void VisionObjectEvent::setClipping ( bool  left,
bool  right,
bool  top,
bool  bottom 
)

sets clipping boundaries

Definition at line 101 of file VisionObjectEvent.h.

VisionObjectEvent& VisionObjectEvent::setLeft ( float  x1  ) 

sets the initial x (_x1) coordinate of the Bounding Box

Definition at line 67 of file VisionObjectEvent.h.

VisionObjectEvent& VisionObjectEvent::setObjectArea ( float  objarea  ) 

sets the object's _area within the camera, in squared generalized coordinates (multiply by the major camera resolution to get pixel area)

Definition at line 79 of file VisionObjectEvent.h.

VisionObjectEvent& VisionObjectEvent::setRight ( float  x2  ) 

sets the final x (_x2) coordinate of the Bounding Box

Definition at line 70 of file VisionObjectEvent.h.

VisionObjectEvent& VisionObjectEvent::setTop ( float  y1  ) 

sets the initial y (_y1) coordinate of the Bounding Box

Definition at line 73 of file VisionObjectEvent.h.


Member Data Documentation

area of the actual object within bounding box as set by generator, in same units as getBoundaryArea(). Multiply by the square of the major camera resolution (normally RobotInfo::CameraResolutionX if using full resolution) and divide by 4.0 to get pixel area.

Definition at line 117 of file VisionObjectEvent.h.

Referenced by getObjectArea(), and setObjectArea().

flag to indicate bottom boundary is on or beyond the camera image's boundary

Definition at line 121 of file VisionObjectEvent.h.

Referenced by isClippedBottom(), loadXML(), saveXML(), and setClipping().

bool VisionObjectEvent::_clipLeft [protected]

flag to indicate left boundary is on or beyond the camera image's boundary

Definition at line 118 of file VisionObjectEvent.h.

Referenced by isClippedLeft(), loadXML(), saveXML(), and setClipping().

flag to indicate right boundary is on or beyond the camera image's boundary

Definition at line 119 of file VisionObjectEvent.h.

Referenced by isClippedRight(), loadXML(), saveXML(), and setClipping().

bool VisionObjectEvent::_clipTop [protected]

flag to indicate top boundary is on or beyond the camera image's boundary

Definition at line 120 of file VisionObjectEvent.h.

Referenced by isClippedTop(), loadXML(), saveXML(), and setClipping().

unsigned int VisionObjectEvent::_frame [protected]

Number of frame when the event was generated.

Definition at line 124 of file VisionObjectEvent.h.

Referenced by getDescription(), and getFrame().

a value representing location in visual field - from -1 if on the left edge to 1 if it's on the right edge, see Config::vision_config::x_range

Definition at line 113 of file VisionObjectEvent.h.

Referenced by getBinSize(), getBoundaryArea(), getCenterX(), getDescription(), getLeft(), getWidth(), loadBinaryBuffer(), loadXML(), saveBinaryBuffer(), saveXML(), and setLeft().

a value representing location in visual field - from -1 if on the left edge to 1 if it's on the right edge, see Config::vision_config::x_range

Definition at line 114 of file VisionObjectEvent.h.

Referenced by getBinSize(), getBoundaryArea(), getCenterX(), getDescription(), getRight(), getWidth(), loadBinaryBuffer(), loadXML(), saveBinaryBuffer(), saveXML(), and setRight().

Max range of X dimension (typically 1.0 for AIBO).

Definition at line 122 of file VisionObjectEvent.h.

Referenced by getXrange().

top boundary, in range of ±1/Configvision_config::aspectRatio, see Config::vision_config::y_range

Definition at line 115 of file VisionObjectEvent.h.

Referenced by getBinSize(), getBoundaryArea(), getCenterY(), getDescription(), getHeight(), getTop(), loadBinaryBuffer(), loadXML(), saveBinaryBuffer(), saveXML(), and setTop().

bottom boundary, in range of ±1/Configvision_config::aspectRatio, see Config::vision_config::y_range

Definition at line 116 of file VisionObjectEvent.h.

Referenced by getBinSize(), getBottom(), getBoundaryArea(), getCenterY(), getDescription(), getHeight(), loadBinaryBuffer(), loadXML(), saveBinaryBuffer(), saveXML(), and setBottom().

Max range of Y dimension (typically around 0.8 for AIBO due to camera aspect ratio).

Definition at line 123 of file VisionObjectEvent.h.

Referenced by getYrange().

const EventBase::classTypeID_t VisionObjectEvent::autoRegisterVisionObjectEvent = getTypeRegistry().registerType<VisionObjectEvent>(makeClassTypeID("VISO")) [static, protected]

causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry())

Definition at line 127 of file VisionObjectEvent.h.

Referenced by getClassTypeID().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:18 2016 by Doxygen 1.6.3