contains a set of visual events to which a set of tokens can be matched More...
#include <MBARI/VisualEvent.H>
Public Member Functions | |
VisualEventSet (const int maxDist, const uint minFrameNum, const int minSize, const std::string &filename) | |
constructor | |
VisualEventSet (std::istream &is) | |
read the VisualEventSet from the input stream is | |
void | writeToStream (std::ostream &os) const |
write the entire VisualEventSet to the output stream os | |
void | readFromStream (std::istream &is) |
read the VisualEventSet from the input stream is | |
void | writePositions (std::ostream &os) const |
write th positions of all events to the output stream os | |
void | updateEvents (const Image< byte > &binMap, const Vector2D &curFOE, int frameNum) |
extract BitObjects from binMap and assign them to the events | |
void | initiateEvents (std::list< BitObject > &bos, int frameNum) |
initiate new events for all BitObjects in bos if they aren't tracked yet | |
bool | doesIntersect (const BitObject &obj, int frameNum) const |
if obj intersects with any of the event at frameNum | |
Vector2D | getFOE (int frameNum) const |
update the focus of expansion | |
uint | numEvents () const |
return the number of stored events | |
void | reset () |
delete all stored events | |
void | cleanUp (uint currFrame, uint maxFrameSkip=1) |
clean up the event list - erase all unsuccessful candidates | |
void | closeAll () |
close all events (for clean-up at the end) | |
std::vector< Token > | getTokens (uint frameNum) |
returns a set of all tokens stored at a particular frame number | |
void | drawTokens (Image< PixRGB< byte > > &img, uint frameNum, PropertyVectorSet &pvs, int circleRadius, BitObjectDrawMode mode, float opacity, PixRGB< byte > colorInteresting, PixRGB< byte > colorCandidate, PixRGB< byte > colorPred, PixRGB< byte > colorFOE, bool showEventLabels) |
draw the tokens for a particular frame number into an image | |
PropertyVectorSet | getPropertyVectorSet () |
returns a PropertyVectorSet for this VisualEventSet | |
int | getAllClosedFrameNum (uint currFrame) |
return the latest frame number before currFrame for which events have been closed already | |
bool | isEventInteresting (std::vector< float > propVec) const |
whether event is "interesting" | |
bool | doesEventExist (uint eventNum) const |
test whether the event with eventNum exists in this set | |
VisualEvent | getEventByNumber (uint eventNum) const |
Returns the event with number eventNum. | |
Protected Member Functions | |
std::vector< std::list < VisualEvent >::iterator > | getEventsForFrame (uint framenum) |
Returns a vector with iterators pointing to all events at framenum. |
contains a set of visual events to which a set of tokens can be matched
Definition at line 236 of file VisualEvent.H.
VisualEventSet::VisualEventSet | ( | const int | maxDist, | |
const uint | minFrameNum, | |||
const int | minSize, | |||
const std::string & | filename | |||
) |
constructor
maxDist | the maximum distance that a token can have from an event and still be considered for becoming part of the event | |
minFrameNum | the minimum number of frames for which an event needs be present | |
minSize | the minimum size (in pixels) for an "interesting" event | |
fileName | the fileName for saving intermediate result |
Definition at line 406 of file VisualEvent.C.
VisualEventSet::VisualEventSet | ( | std::istream & | is | ) |
read the VisualEventSet from the input stream is
Definition at line 422 of file VisualEvent.C.
References readFromStream().
clean up the event list - erase all unsuccessful candidates
currFrame | - the current frame number in processing | |
maxFrameSkip | how many frames may be skipped using interpolation (default: 1) |
Definition at line 729 of file VisualEvent.C.
void VisualEventSet::closeAll | ( | ) |
close all events (for clean-up at the end)
Definition at line 747 of file VisualEvent.C.
bool VisualEventSet::doesEventExist | ( | uint | eventNum | ) | const |
test whether the event with eventNum exists in this set
Definition at line 948 of file VisualEvent.C.
bool VisualEventSet::doesIntersect | ( | const BitObject & | obj, | |
int | frameNum | |||
) | const |
if obj intersects with any of the event at frameNum
Definition at line 600 of file VisualEvent.C.
Referenced by initiateEvents(), and updateEvents().
void VisualEventSet::drawTokens | ( | Image< PixRGB< byte > > & | img, | |
uint | frameNum, | |||
PropertyVectorSet & | pvs, | |||
int | circleRadius, | |||
BitObjectDrawMode | mode, | |||
float | opacity, | |||
PixRGB< byte > | colorInteresting, | |||
PixRGB< byte > | colorCandidate, | |||
PixRGB< byte > | colorPred, | |||
PixRGB< byte > | colorFOE, | |||
bool | showEventLabels | |||
) |
draw the tokens for a particular frame number into an image
img | the image to draw on | |
frameNum | the frame number for which to draw the tokens | |
circleRadius | the radius of the circle used to mark the tokens | |
colorInteresting | the color for "interesting" tokens | |
colorCandidate | the color for unsuccessful candidate tokens | |
colorPred | the colot for event location predictions | |
showEventLabels | whether to write the event labels into the image |
Definition at line 771 of file VisualEvent.C.
References Token::bitObject, Image< T >::clear(), BitObject::draw(), drawCircle(), drawDisk(), BitObject::getArea(), BitObject::getBoundingBox(), Image< T >::getDims(), getFOE(), Rectangle::getOverlap(), Vector2D::getPoint2D(), PropertyVectorSet::getPropertyVectorForEvent(), Point2D< T >::i, isEventInteresting(), Vector2D::isValid(), BitObject::isValid(), Token::location, NO_INIT, pasteImage(), Token::prediction, replaceVals(), Image< T >::resize(), Rectangle::tlbrI(), toStr(), and writeText().
Referenced by MbariResultViewer::outputResultFrame().
int VisualEventSet::getAllClosedFrameNum | ( | uint | currFrame | ) |
return the latest frame number before currFrame for which events have been closed already
Definition at line 913 of file VisualEvent.C.
VisualEvent VisualEventSet::getEventByNumber | ( | uint | eventNum | ) | const |
Returns the event with number eventNum.
Definition at line 958 of file VisualEvent.C.
std::vector< std::list< VisualEvent >::iterator > VisualEventSet::getEventsForFrame | ( | uint | framenum | ) | [protected] |
Returns a vector with iterators pointing to all events at framenum.
Definition at line 971 of file VisualEvent.C.
Vector2D VisualEventSet::getFOE | ( | int | frameNum | ) | const |
update the focus of expansion
returns the current focus of expansion for frameNum
Definition at line 705 of file VisualEvent.C.
References ASSERT.
Referenced by drawTokens().
PropertyVectorSet VisualEventSet::getPropertyVectorSet | ( | ) |
returns a PropertyVectorSet for this VisualEventSet
Definition at line 899 of file VisualEvent.C.
References PropertyVectorSet::itsVectors.
std::vector< Token > VisualEventSet::getTokens | ( | uint | frameNum | ) |
returns a set of all tokens stored at a particular frame number
Definition at line 755 of file VisualEvent.C.
initiate new events for all BitObjects in bos if they aren't tracked yet
Definition at line 561 of file VisualEvent.C.
References ASSERT, and doesIntersect().
bool VisualEventSet::isEventInteresting | ( | std::vector< float > | propVec | ) | const |
whether event is "interesting"
Definition at line 934 of file VisualEvent.C.
Referenced by drawTokens().
uint VisualEventSet::numEvents | ( | ) | const |
return the number of stored events
Definition at line 717 of file VisualEvent.C.
void VisualEventSet::readFromStream | ( | std::istream & | is | ) |
read the VisualEventSet from the input stream is
Definition at line 450 of file VisualEvent.C.
Referenced by MbariResultViewer::loadVisualEventSet(), and VisualEventSet().
void VisualEventSet::reset | ( | ) |
delete all stored events
Definition at line 723 of file VisualEvent.C.
void VisualEventSet::updateEvents | ( | const Image< byte > & | binMap, | |
const Vector2D & | curFOE, | |||
int | frameNum | |||
) |
extract BitObjects from binMap and assign them to the events
curFOE | the current focus of expansion for detecting unusual motion |
Definition at line 480 of file VisualEvent.C.
References ASSERT, doesIntersect(), extractBitObjects(), Image< T >::getBounds(), Image< T >::getHeight(), Rectangle::getOverlap(), Image< T >::getWidth(), Point2D< T >::i, and Rectangle::tlbrI().
void VisualEventSet::writePositions | ( | std::ostream & | os | ) | const |
write th positions of all events to the output stream os
Definition at line 472 of file VisualEvent.C.
Referenced by MbariResultViewer::savePositions().
void VisualEventSet::writeToStream | ( | std::ostream & | os | ) | const |
write the entire VisualEventSet to the output stream os
Definition at line 428 of file VisualEvent.C.
Referenced by MbariResultViewer::saveVisualEventSet().