18 #include <mrpt/3rdparty/do_opencv_includes.h>    33     unsigned int nDesiredFeatures, [[maybe_unused]] 
const TImageROI& ROI)
    39 #if MRPT_OPENCV_VERSION_NUM < 0x300    44     vector<KeyPoint> cv_feats;  
    48 #if MRPT_OPENCV_VERSION_NUM >= 0x300    51     Ptr<AKAZE> akaze = AKAZE::create(
    52 #
if MRPT_OPENCV_VERSION_NUM >= 0x400
    53         static_cast<cv::AKAZE::DescriptorType>(
    54             options.AKAZEOptions.descriptor_type),
    56         options.AKAZEOptions.descriptor_type,
    58         options.AKAZEOptions.descriptor_size,
    59         options.AKAZEOptions.descriptor_channels,
    60         options.AKAZEOptions.threshold, options.AKAZEOptions.nOctaves,
    61         options.AKAZEOptions.nOctaveLayers,
    62 #
if MRPT_OPENCV_VERSION_NUM >= 0x400
    63         static_cast<cv::KAZE::DiffusivityType>(options.AKAZEOptions.diffusivity)
    65         options.AKAZEOptions.diffusivity
    69     akaze->detect(theImg, cv_feats);
    72     const size_t N = cv_feats.size();
    76     for (
size_t i = 0; i < N; i++)
    78         for (
size_t j = i + 1; j < N; j++)
    80             if (cv_feats.at(j).response > cv_feats.at(i).response)
    82                 KeyPoint temp_point = cv_feats.at(i);
    83                 cv_feats.at(i) = cv_feats.at(j);
    84                 cv_feats.at(j) = temp_point;
    90         (nDesiredFeatures != 0 && N > nDesiredFeatures) ? nDesiredFeatures : N;
    91     const int offset = (int)this->options.patchSize / 2 + 1;
    92     const size_t size_2 = options.patchSize / 2;
    94     const size_t imgW = inImg.
getWidth();
    96     unsigned int cont = 0;
    99     if (!options.addNewFeatures) feats.
clear();
   101     while (cont != nMax && i != N)
   104         const KeyPoint& kp = cv_feats[i];
   108         const int xBorderInf = (int)floor(kp.pt.x - size_2);
   109         const int xBorderSup = (int)floor(kp.pt.x + size_2);
   110         const int yBorderInf = (int)floor(kp.pt.y - size_2);
   111         const int yBorderSup = (int)floor(kp.pt.y + size_2);
   113         if (!(xBorderSup < (
int)imgW && xBorderInf > 0 &&
   114               yBorderSup < (int)imgH && yBorderInf > 0))
   128         if (options.patchSize > 0)
 Shallow copy: the copied object is a reference to the original one. 
 
uint64_t TFeatureID
Definition of a feature ID. 
 
#define THROW_EXCEPTION(msg)
 
A safe way to call enter() and leave() of a mrpt::system::CTimeLogger upon construction and destructi...
 
TKeyPointMethod type
Keypoint method used to detect this feature. 
 
size_t getHeight() const override
Returns the height of the image in pixels. 
 
TFeatureID ID
ID of the feature. 
 
void asCvMat(cv::Mat &out_img, copy_type_t copy_type) const
Makes a shallow or deep copy of this image into the provided cv::Mat. 
 
A structure for defining a ROI within an image. 
 
This base provides a set of functions for maths stuff. 
 
size_t getWidth() const override
Returns the width of the image in pixels. 
 
std::optional< mrpt::img::CImage > patch
A patch of the image surrounding the feature. 
 
Classes for computer vision, detectors, features, etc. 
 
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
 
A list of visual features, to be used as output by detectors, as input/output by trackers, etc. 
 
float response
A measure of the "goodness" of the feature. 
 
AKAZE detector, OpenCV's implementation. 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
uint8_t octave
The image octave the image was found in: 0=original image, 1=1/2 image, 2=1/4 image, etc. 
 
void extract_patch(CImage &patch, const unsigned int col=0, const unsigned int row=0, const unsigned int width=1, const unsigned int height=1) const
Extract a patch from this image, saveing it into "patch" (its previous contents will be overwritten)...
 
float orientation
Main orientation of the feature. 
 
uint16_t patchSize
Size of the patch (patchSize x patchSize) (it must be an odd number) 
 
void emplace_back(CFeature &&f)
 
pixel_coords_t pt
Coordinates in the image. 
 
A class for storing images as grayscale or RGB bitmaps. 
 
int round(const T value)
Returns the closer integer (int) to x.