25 #ifndef INCLUDED_VideoBasedTracker_h_GUID_831CC0DD_16A5_43AB_12D3_AE86E1998ED4 26 #define INCLUDED_VideoBasedTracker_h_GUID_831CC0DD_16A5_43AB_12D3_AE86E1998ED4 38 #include <opencv2/core/core.hpp> 39 #include <boost/assert.hpp> 58 return [](
int id) {
return id <= 4; };
81 void addSensor(LedIdentifierPtr &&identifier,
83 Point3Vector
const &locations,
84 Vec3Vector
const &emissionDirection,
double variance,
86 getDefaultBeaconFixedPredicate(),
87 size_t requiredInliers = 4,
88 size_t permittedOutliers = 2) {
89 addSensor(std::move(identifier), camParams, locations,
90 emissionDirection, std::vector<double>{variance},
91 autocalibrationFixedPredicate, requiredInliers,
101 Point3Vector
const &locations,
102 Vec3Vector
const &emissionDirection,
104 size_t requiredInliers = 4,
105 size_t permittedOutliers = 2) {
106 addSensor(std::move(identifier), camParams, locations,
107 emissionDirection, std::vector<double>{},
108 autocalibrationFixedPredicate, requiredInliers,
120 Point3Vector
const &locations, Vec3Vector
const &emissionDirection,
121 std::vector<double>
const &variance = std::vector<double>{},
123 getDefaultBeaconFixedPredicate(),
124 size_t requiredInliers = 4,
size_t permittedOutliers = 2,
125 double beaconAutocalibErrorScale = 1);
128 typedef std::function<void(OSVR_ChannelCount, OSVR_Pose3 const &)>
139 return *(m_estimators.front());
144 return *(m_estimators.front());
154 size_t requiredInliers = 4,
size_t permittedOutliers = 2);
156 void dumpKeypointDebugData(std::vector<cv::KeyPoint>
const &keypoints);
158 void drawLedCircleOnStatusImage(
Led const &led,
bool filled,
160 void drawRecognizedLedIdOnStatusImage(
Led const &led);
162 bool m_debugHelpDisplayed =
false;
167 cv::Mat m_thresholdImage;
168 cv::Mat m_imageWithBlobs;
169 cv::Mat m_statusImage;
170 cv::Mat *m_shownImage = &m_statusImage;
171 int m_debugFrame = 0;
176 cv::SimpleBlobDetector::Params m_sbdParams;
180 void m_assertInvariants()
const {
182 m_identifiers.size() == m_led_groups.size(),
183 "Expected to have as many identifier objects as LED groups");
184 BOOST_ASSERT_MSG(m_identifiers.size() == m_estimators.size(),
185 "Expected to have as many identifier objects as " 186 "estimator objects");
188 for (
auto &e : m_estimators) {
190 e->getNumBeacons() > 4,
191 "Expected each estimator to have at least 4 beacons");
196 LedIdentifierList m_identifiers;
197 LedGroupList m_led_groups;
198 EstimatorList m_estimators;
211 #endif // INCLUDED_VideoBasedTracker_h_GUID_831CC0DD_16A5_43AB_12D3_AE86E1998ED4 Helper class to keep track of the state of a blob over time.
Definition: LED.h:47
BeaconBasedPoseEstimator const & getFirstEstimator() const
For debug purposes.
Definition: VideoBasedTracker.h:138
Header file for class that identifies LEDs based on blink codes.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: CameraParameters.h:41
Header file for class that tracks and identifies LEDs.
void addSensor(LedIdentifierPtr &&identifier, CameraParameters const &camParams, Point3Vector const &locations, Vec3Vector const &emissionDirection, BeaconIDPredicate const &autocalibrationFixedPredicate, size_t requiredInliers=4, size_t permittedOutliers=2)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: VideoBasedTracker.h:99
Definition: VideoBasedTracker.h:53
BeaconBasedPoseEstimator & getFirstEstimator()
For debug purposes.
Definition: VideoBasedTracker.h:143
Header file for class that tracks and identifies LEDs.
std::function< bool(int)> BeaconIDPredicate
Takes in a 1-based index, returns true or false (true if the beacon should be considered fixed - not ...
Definition: Types.h:81
General configuration parameters.
Definition: ConfigParams.h:82
Class to track an object that has identified LED beacons on it as seen in a camera, where the absolute location of the LEDs with respect to a common frame of reference is known.
Definition: BeaconBasedPoseEstimator.h:63
bool processImage(cv::Mat frame, cv::Mat grayImage, OSVR_TimeValue const &tv, PoseHandler handler)
The main method that processes an image into tracked poses.
Definition: VideoBasedTracker.cpp:132
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Definition: Pose3C.h:54
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81