21 #include <mrpt/otherlibs/do_opencv_includes.h> 23 #ifdef HAVE_OPENCV_NONFREE // MRPT_HAS_OPENCV_NONFREE 24 #include <opencv2/nonfree/nonfree.hpp> 27 #ifdef HAVE_OPENCV_XFEATURES2D 28 #include <opencv2/xfeatures2d.hpp> 30 #ifdef HAVE_OPENCV_LINE_DESCRIPTOR 31 #include <opencv2/line_descriptor.hpp> 32 using namespace cv::line_descriptor;
41 #if defined(HAVE_OPENCV_XFEATURES2D) && defined(HAVE_OPENCV_LINE_DESCRIPTOR) 42 #define HAVE_OPENCV_WITH_LATCH 1 44 #define HAVE_OPENCV_WITH_LATCH 0 50 void CFeatureExtraction::internal_computeLATCHDescriptors(
54 #if (!HAVE_OPENCV_WITH_LATCH) 56 "This function requires OpenCV modules: xfeatures2d,line_descriptor");
60 if (in_features.
empty())
return;
62 const size_t n_feats = in_features.
size();
67 vector<KeyPoint> cv_feats(n_feats);
68 for (
size_t k = 0; k < n_feats; ++k)
70 KeyPoint& kp = cv_feats[k];
71 kp.pt.x = in_features[k]->x;
72 kp.pt.y = in_features[k]->y;
73 kp.angle = in_features[k]->orientation;
74 kp.
size = in_features[k]->scale;
77 Mat cvImg(cv::cvarrToMat(inImg_gray.
getAs<IplImage>()));
80 Ptr<xfeatures2d::LATCH> latch = xfeatures2d::LATCH::create(
81 options.LATCHOptions.bytes, options.LATCHOptions.rotationInvariance,
82 options.LATCHOptions.half_ssd_size);
83 latch->compute(cvImg, cv_feats, cv_descs);
90 for (i = 0, itList = in_features.
begin(); itList != in_features.
end();
96 ft->descriptors.LATCH.resize(cv_descs.cols);
97 for (
int m = 0; m < cv_descs.cols; ++m)
98 ft->descriptors.LATCH[m] =
99 cv_descs.at<
int>(i, m);
std::shared_ptr< CFeature > Ptr
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
A class for storing images as grayscale or RGB bitmaps.
#define THROW_EXCEPTION(msg)
const T * getAs() const
Returns a pointer to a const T* containing the image - the idea is to call like "img.getAs<IplImage>()" so we can avoid here including OpenCV's headers.
This base provides a set of functions for maths stuff.
Classes for computer vision, detectors, features, etc.
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TInternalFeatList::iterator iterator