OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::vbtracker::Led Class Reference

Helper class to keep track of the state of a blob over time. This is used to help determine the identity of each LED in the scene. The LEDs are identified by their blink codes. A steady one is presumed to be a light source. More...

#include </home/jenkins/root/workspace/OSVR-Core-Docs/plugins/unifiedvideoinertialtracker/LED.h>

Public Types

typedef int ID
 

Public Member Functions

void addMeasurement (LedMeasurement const &meas, bool blobsKeepId)
 Add a new measurement for this LED, which must be for a frame that is just following the previous measurement, so that the encoding of brightness and darkness can be used to identify it. More...
 
LedMeasurement const & getMeasurement () const
 
ZeroBasedBeaconId getID () const
 Tells which LED I am. More...
 
OneBasedBeaconId getOneBasedID () const
 Gets either the raw negative sentinel ID or a 1-based ID (for display purposes)
 
bool identified () const
 Do we have a positive identification as a known LED?
 
uint8_t novelty () const
 Returns a value (decreasing per frame from some maximum down to a minimum of zero) indicating how new the identification of this blob with its current ID is. This can be used to compensate for accidental mis-identifications, identity switching, or the simple fact that new identifications might contain highly novel information that would otherwise "shock" the tracked state.
 
cv::Point2f getLocation () const
 Reports the most-recently-added position.
 
cv::Point2f getInverseLocation () const
 Gets the most-recently-added position, in a xy-origin-at-bottom-left coordinate system.
 
cv::Point2f getLocationForTracking () const
 Gets the most-recently-added position in the coordinate system to be used for tracking. More...
 
KeyPointIterator nearest (KeyPointList &keypoints, double threshold) const
 Find the nearest KeyPoint from a container of points to me, if there is one within the specified threshold. Runtime: O(n) where n is the number of elements in keypoints. More...
 
LedMeasurementVecIterator nearest (LedMeasurementVec &meas, double threshold) const
 
bool isBright () const
 Returns the most-recent boolean "bright" state according to the LED identifier. Note that the value is only meaningful if identified() is true.
 
bool wasUsedLastFrame () const
 Used for a status display in debug windows.
 
void markAsUsed ()
 Call from inside the tracking algorithm to mark that it was used.
 
void resetUsed ()
 
void markMisidentified ()
 
void addMeasurement (LedMeasurement const &meas, bool blobsKeepId)
 Add a new measurement for this LED, which must be for a frame that is just following the previous measurement, so that the encoding of brightness and darkness can be used to identify it. More...
 
LedMeasurement const & getMeasurement () const
 
int getID () const
 Tells which LED I am. More...
 
int getOneBasedID () const
 Gets either the raw negative sentinel ID or a 1-based ID (for display purposes)
 
bool identified () const
 Do we have a positive identification as a known LED?
 
uint8_t novelty () const
 Returns a value (decreasing per frame from some maximum down to a minimum of zero) indicating how new the identification of this blob with its current ID is. This can be used to compensate for accidental mis-identifications, identity switching, or the simple fact that new identifications might contain highly novel information that would otherwise "shock" the tracked state.
 
cv::Point2f getLocation () const
 Reports the most-recently-added position.
 
KeyPointIterator nearest (KeyPointList &keypoints, double threshold) const
 Find the nearest KeyPoint from a container of points to me, if there is one within the specified threshold. Runtime: O(n) where n is the number of elements in keypoints. More...
 
LedMeasurementIterator nearest (LedMeasurementList &meas, double threshold) const
 
bool isBright () const
 Returns the most-recent boolean "bright" state according to the LED identifier. Note that the value is only meaningful if identified() is true.
 
bool wasUsedLastFrame () const
 Used for a status display in debug windows.
 
void markAsUsed ()
 Call from inside the tracking algorithm to mark that it was used.
 
void resetUsed ()
 
void markMisidentified ()
 
Constructors

Constructor takes initial values for the location and brightness, and a pointer to an object that will be used to identify the LEDs based on their brightness over time.

 Led (LedIdentifier *identifier, LedMeasurement const &meas)
 
 Led (LedIdentifier *identifier, LedMeasurement const &meas)
 

Static Public Attributes

static const int SENTINEL_NO_IDENTIFIER_OBJECT_OR_INSUFFICIENT_DATA
 
static const int SENTINEL_INSUFFICIENT_EXTREMA_DIFFERENCE = -2
 
static const int SENTINEL_NO_PATTERN_RECOGNIZED_DESPITE_SUFFICIENT_DATA = -3
 
static const int SENTINEL_NO_IDENTIFIER_OBJECT = -4
 
static const int SENTINEL_MARKED_MISIDENTIFIED = -5
 
static const uint8_t MAX_NOVELTY = 4
 
static const ID SENTINEL_NO_IDENTIFIER_OBJECT_OR_INSUFFICIENT_DATA = -1
 
static const ID SENTINEL_INSUFFICIENT_EXTREMA_DIFFERENCE = -2
 
static const ID SENTINEL_NO_PATTERN_RECOGNIZED_DESPITE_SUFFICIENT_DATA
 

Detailed Description

Helper class to keep track of the state of a blob over time. This is used to help determine the identity of each LED in the scene. The LEDs are identified by their blink codes. A steady one is presumed to be a light source.

Definition at line 47 of file LED.h.

Constructor & Destructor Documentation

osvr::vbtracker::Led::Led ( LedIdentifier identifier,
LedMeasurement const &  meas 
)

Doesn't matter what the blobs keep ID pref is here, because this is a new blob so there's no ID to keep.

Doesn't matter what the blobs keep ID pref is here, because this is a new blob so there's no ID to keep.

Definition at line 30 of file LED.cpp.

Member Function Documentation

void osvr::vbtracker::Led::addMeasurement ( LedMeasurement const &  meas,
bool  blobsKeepId 
)

Add a new measurement for this LED, which must be for a frame that is just following the previous measurement, so that the encoding of brightness and darkness can be used to identify it.

Parameters
measA number of measurement parameters, of which only brightness and location are used in identifying beacon patterns. brightness is an abstract quantity that is fed into the identity detector; it may be area or summed brightness or another useful estimate of the LED state. The other parameters are carried along in the hope that they may be useful to later code. (For instance, not all identified beacons may be good choices to use in determining tracking pose)

Make the "misidentified" sentinel a little stickier than "insufficient data" or "no pattern recognized" so we can see it on the debug view.

Todo:
Identify "theft" is possible and takes place - right now it's handled just the same as any other change in ID.

Right now, any change in ID is considered being "newly recognized".

If newly recognized, start at max novelty

Novelty decays linearly to 0

Todo:
it seems like LEDs are re-recognized every frame? so presumably it's possible that oldId != m_id without one being a sentinel.

Right now, any change in ID is considered being "newly recognized".

If newly recognized, start at max novelty

Novelty decays linearly to 0

Definition at line 37 of file LED.cpp.

ZeroBasedBeaconId osvr::vbtracker::Led::getID ( ) const
inline

Tells which LED I am.

  • An index of -1 means not yet determined.
  • An index below -1 means known not to be an LED (different identifiers use different codes to differentiate between cases).
  • An index of 0 or higher is determined based on the flash pattern.

Definition at line 89 of file LED.h.

cv::Point2f osvr::vbtracker::Led::getLocationForTracking ( ) const
inline

Gets the most-recently-added position in the coordinate system to be used for tracking.

Provides a centralized place to switch between getLocation() and getInverseLocation() for tracking purposes.

Definition at line 123 of file LED.h.

KeyPointIterator osvr::vbtracker::Led::nearest ( KeyPointList &  keypoints,
double  threshold 
) const

Find the nearest KeyPoint from a container of points to me, if there is one within the specified threshold. Runtime: O(n) where n is the number of elements in keypoints.

Returns
end() if there is not a nearest within threshold (or an empty container).

Definition at line 74 of file LED.cpp.

LedMeasurementIterator osvr::vbtracker::Led::nearest ( LedMeasurementVec &  meas,
double  threshold 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 113 of file LED.cpp.

void osvr::vbtracker::Led::markMisidentified ( )

Called from within pose estimation or elsewhere with model-based knowledge that can refute the identification of this blob.

Definition at line 76 of file LED.cpp.

void osvr::vbtracker::Led::addMeasurement ( LedMeasurement const &  meas,
bool  blobsKeepId 
)

Add a new measurement for this LED, which must be for a frame that is just following the previous measurement, so that the encoding of brightness and darkness can be used to identify it.

Parameters
measA number of measurement parameters, of which only brightness and location are used in identifying beacon patterns. brightness is an abstract quantity that is fed into the identity detector; it may be area or summed brightness or another useful estimate of the LED state. The other parameters are carried along in the hope that they may be useful to later code. (For instance, not all identified beacons may be good choices to use in determining tracking pose)
int osvr::vbtracker::Led::getID ( ) const
inline

Tells which LED I am.

  • An index of -1 means not yet determined.
  • An index below -1 means known not to be an LED (different identifiers use different codes to differentiate between cases).
  • An index of 0 or higher is determined based on the flash pattern.

Definition at line 84 of file LED.h.

KeyPointIterator osvr::vbtracker::Led::nearest ( KeyPointList &  keypoints,
double  threshold 
) const

Find the nearest KeyPoint from a container of points to me, if there is one within the specified threshold. Runtime: O(n) where n is the number of elements in keypoints.

Returns
end() if there is not a nearest within threshold (or an empty container).
LedMeasurementIterator osvr::vbtracker::Led::nearest ( LedMeasurementList &  meas,
double  threshold 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void osvr::vbtracker::Led::markMisidentified ( )

Called from within pose estimation or elsewhere with model-based knowledge that can refute the identification of this blob.

Member Data Documentation

const int osvr::vbtracker::Led::SENTINEL_NO_IDENTIFIER_OBJECT_OR_INSUFFICIENT_DATA
static
Initial value:
=
-1

Definition at line 49 of file LED.h.

const ID osvr::vbtracker::Led::SENTINEL_NO_PATTERN_RECOGNIZED_DESPITE_SUFFICIENT_DATA
static
Initial value:
=
-3

Definition at line 58 of file LED.h.


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