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>
57 static BeaconIDPredicate getDefaultBeaconFixedPredicate() {
58 return [](
int id) {
return id <= 4; };
81 void addSensor(LedIdentifierPtr &&identifier,
83 Point3Vector
const &locations,
84 Vec3Vector
const &emissionDirection,
double variance,
85 BeaconIDPredicate
const &autocalibrationFixedPredicate =
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,
103 BeaconIDPredicate
const &autocalibrationFixedPredicate,
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>{},
122 BeaconIDPredicate
const &autocalibrationFixedPredicate =
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;
205 CameraParameters m_camParams;
211 #endif // INCLUDED_VideoBasedTracker_h_GUID_831CC0DD_16A5_43AB_12D3_AE86E1998ED4
Helper class to keep track of the state of a blob over time. This is used to help determine the ident...
Header file for class that identifies LEDs based on blink codes.
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)
BeaconBasedPoseEstimator & getFirstEstimator()
For debug purposes.
Header file for class that tracks and identifies LEDs.
General configuration parameters.
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. Returns the transformation that takes points from the model coordinate system to the camera coordinate system.
bool processImage(cv::Mat frame, cv::Mat grayImage, OSVR_TimeValue const &tv, PoseHandler handler)
The main method that processes an image into tracked poses.
BeaconBasedPoseEstimator const & getFirstEstimator() const
For debug purposes.
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...