47 std::shared_ptr<cameras::CameraBase> & cameraGeometry,
48 std::shared_ptr<cv::FeatureDetector> & detector,
49 std::shared_ptr<cv::DescriptorExtractor> & extractor)
51 cameraGeometry_(cameraGeometry),
94 template<
class GEOMETRY_T>
99 Exception, std::dynamic_pointer_cast<const GEOMETRY_T>(
cameraGeometry_),
100 "incorrect pointer cast requested. " <<
cameraGeometry_->distortionType());
119 "Detector not initialised!");
132 "Detector not initialised!");
136 Eigen::Vector2d reprojection;
137 Eigen::Matrix<double, 2, 3> Jacobian;
138 Eigen::Vector2d eg_projected;
139 for (
size_t k = 0; k <
keypoints_.size(); ++k) {
142 cameraGeometry_->backProject(Eigen::Vector2d(ckp.pt.x, ckp.pt.y), &ep);
146 eg_projected = Jacobian * extractionDirection;
147 double angle = atan2(eg_projected[1], eg_projected[0]);
149 ckp.angle = angle / M_PI * 180.0;
161 template<
class GEOMETRY_T>
166 "Detector not initialised!");
170 Eigen::Vector2d reprojection;
171 Eigen::Matrix<double, 2, 3> Jacobian;
172 Eigen::Vector2d eg_projected;
173 for (
size_t k = 0; k <
keypoints_.size(); ++k) {
176 geometryAs<GEOMETRY_T>()->backProject(Eigen::Vector2d(ckp.pt.x, ckp.pt.y),
179 geometryAs<GEOMETRY_T>()->project(ep, &reprojection, &Jacobian);
181 eg_projected = Jacobian * extractionDirection;
182 double angle = atan2(eg_projected[1], eg_projected[0]);
184 ckp.angle = angle / M_PI * 180.0;
199 "keypointIdx " << keypointIdx <<
"out of range: keypoints has size "
216 "keypointIdx " << keypointIdx <<
"out of range: keypoints has size "
218 keypoint = Eigen::Vector2d(
keypoints_[keypointIdx].pt.x,
234 "keypointIdx " << keypointIdx <<
"out of range: keypoints has size "
252 "keypointIdx " << keypointIdx <<
"out of range: keypoints has size "
267 "keypointIdx " << keypointIdx <<
"out of range: landmarkIds_ has size "
284 "keypointIdx " << keypointIdx <<
"out of range: landmarkIds has size "
288 return landmarkIds_[keypointIdx];
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Frame()
a default constructor
Definition: Frame.hpp:71
uint64_t landmarkId(size_t keypointIdx) const
Access the landmark ID.
Definition: Frame.hpp:278
std::shared_ptr< const cameras::CameraBase > cameraGeometry_
the camera geometry
Definition: Frame.hpp:192
int describe(const Eigen::Vector3d &extractionDirection=Eigen::Vector3d(0, 0, 1))
Describe keypoints. This uses virtual function calls. That's a negligibly small overhead for many det...
Definition: Frame.hpp:128
cv::Mat descriptors_
we store the descriptors using OpenCV's matrices
Definition: Frame.hpp:196
cv::Mat image_
the image as OpenCV's matrix
Definition: Frame.hpp:191
bool resetDescriptors(const cv::Mat &descriptors)
provide descriptors externally
Definition: Frame.hpp:300
std::vector< uint64_t > landmarkIds_
landmark Id, if associated – 0 otherwise
Definition: Frame.hpp:197
int detect()
Detect keypoints. This uses virtual function calls. That's a negligibly small overhead for many detec...
Definition: Frame.hpp:110
bool getKeypoint(size_t keypointIdx, Eigen::Vector2d &keypoint) const
Get a specific keypoint.
Definition: Frame.hpp:210
const cv::Mat & image() const
Obtain the image.
Definition: Frame.hpp:82
bool getCvKeypoint(size_t keypointIdx, cv::KeyPoint &keypoint) const
Access a specific keypoint in OpenCV format.
Definition: Frame.hpp:193
std::shared_ptr< cv::FeatureDetector > detector_
the detector
Definition: Frame.hpp:193
bool getKeypointSize(size_t keypointIdx, double &keypointSize) const
Get the size of a specific keypoint.
Definition: Frame.hpp:228
std::vector< cv::KeyPoint > keypoints_
we store keypoints using OpenCV's struct
Definition: Frame.hpp:195
int describeAs(const Eigen::Vector3d &extractionDirection=Eigen::Vector3d(0, 0, 1))
Describe keypoints. This uses virtual function calls. That's a negligibly small overhead for many det...
Definition: Frame.hpp:162
std::shared_ptr< cv::DescriptorExtractor > extractor_
the extractor
Definition: Frame.hpp:194
std::shared_ptr< const cameras::CameraBase > geometry() const
get the base class geometry (will be slow to use)
Definition: Frame.hpp:88
void setExtractor(std::shared_ptr< cv::DescriptorExtractor > extractor)
Set the extractor.
Definition: Frame.hpp:76
bool resetKeypoints(const std::vector< cv::KeyPoint > &keypoints)
Provide keypoints externally.
Definition: Frame.hpp:293
const unsigned char * keypointDescriptor(size_t keypointIdx)
Access the descriptor – CAUTION: high-speed version.
Definition: Frame.hpp:246
bool setLandmarkId(size_t keypointIdx, uint64_t landmarkId)
Set the landmark ID.
Definition: Frame.hpp:261
std::shared_ptr< const GEOMETRY_T > geometryAs() const
Get the specific geometry (will be fast to use)
Definition: Frame.hpp:95
size_t numKeypoints() const
Get the number of keypoints.
Definition: Frame.hpp:305
void setDetector(std::shared_ptr< cv::FeatureDetector > detector)
Set the detector.
Definition: Frame.hpp:70
#define OKVIS_ASSERT_TRUE_DBG(exceptionType, condition, message)
Definition: assert_macros.hpp:211
void setGeometry(std::shared_ptr< const cameras::CameraBase > cameraGeometry)
Set the geometry.
Definition: Frame.hpp:64
void setImage(const cv::Mat &image)
Set the frame image;.
Definition: Frame.hpp:58
#define OKVIS_ASSERT_TRUE(exceptionType, condition, message)
Definition: assert_macros.hpp:111