commit x64 compilation from lulu cause the other branch dont seems to compile properly at home

This commit is contained in:
2026-07-17 16:08:20 +02:00
parent c0f3eeb00d
commit 0efa4ee6f7
625 changed files with 117283 additions and 4426 deletions

View File

@ -40,11 +40,15 @@
//
//M*/
#ifndef __OPENCV_FEATURES_2D_HPP__
#define __OPENCV_FEATURES_2D_HPP__
#ifndef OPENCV_FEATURES_2D_HPP
#define OPENCV_FEATURES_2D_HPP
#include "opencv2/opencv_modules.hpp"
#include "opencv2/core.hpp"
#ifdef HAVE_OPENCV_FLANN
#include "opencv2/flann/miniflann.hpp"
#endif
/**
@defgroup features2d 2D Features Framework
@ -74,7 +78,7 @@ This section describes approaches based on local 2D features and used to categor
- A complete Bag-Of-Words sample can be found at
opencv_source_code/samples/cpp/bagofwords_classification.cpp
- (Python) An example using the features2D framework to perform object categorization can be
found at opencv_source_code/samples/python2/find_obj.py
found at opencv_source_code/samples/python/find_obj.py
@}
*/
@ -117,6 +121,10 @@ public:
* Remove duplicated keypoints.
*/
static void removeDuplicated( std::vector<KeyPoint>& keypoints );
/*
* Remove duplicated keypoints and sort the remaining keypoints
*/
static void removeDuplicatedSorted( std::vector<KeyPoint>& keypoints );
/*
* Retain the specified number of the best keypoints (according to the response)
@ -129,7 +137,11 @@ public:
/** @brief Abstract base class for 2D image feature detectors and descriptor extractors
*/
#ifdef __EMSCRIPTEN__
class CV_EXPORTS_W Feature2D : public Algorithm
#else
class CV_EXPORTS_W Feature2D : public virtual Algorithm
#endif
{
public:
virtual ~Feature2D();
@ -153,8 +165,8 @@ public:
@param masks Masks for each input image specifying where to look for keypoints (optional).
masks[i] is a mask for images[i].
*/
virtual void detect( InputArrayOfArrays images,
std::vector<std::vector<KeyPoint> >& keypoints,
CV_WRAP virtual void detect( InputArrayOfArrays images,
CV_OUT std::vector<std::vector<KeyPoint> >& keypoints,
InputArrayOfArrays masks=noArray() );
/** @brief Computes the descriptors for a set of keypoints detected in an image (first variant) or image set
@ -182,8 +194,8 @@ public:
descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
descriptor for keypoint j-th keypoint.
*/
virtual void compute( InputArrayOfArrays images,
std::vector<std::vector<KeyPoint> >& keypoints,
CV_WRAP virtual void compute( InputArrayOfArrays images,
CV_OUT CV_IN_OUT std::vector<std::vector<KeyPoint> >& keypoints,
OutputArrayOfArrays descriptors );
/** Detects keypoints and computes the descriptors */
@ -196,8 +208,21 @@ public:
CV_WRAP virtual int descriptorType() const;
CV_WRAP virtual int defaultNorm() const;
CV_WRAP void write( const String& fileName ) const;
CV_WRAP void read( const String& fileName );
virtual void write( FileStorage&) const CV_OVERRIDE;
// see corresponding cv::Algorithm method
CV_WRAP virtual void read( const FileNode&) CV_OVERRIDE;
//! Return true if detector object is empty
CV_WRAP virtual bool empty() const;
CV_WRAP virtual bool empty() const CV_OVERRIDE;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
// see corresponding cv::Algorithm method
CV_WRAP inline void write(const Ptr<FileStorage>& fs, const String& name = String()) const { Algorithm::write(fs, name); }
};
/** Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch
@ -242,6 +267,24 @@ public:
@param indexChange index remapping of the bits. */
CV_WRAP static Ptr<BRISK> create(const std::vector<float> &radiusList, const std::vector<int> &numberList,
float dMax=5.85f, float dMin=8.2f, const std::vector<int>& indexChange=std::vector<int>());
/** @brief The BRISK constructor for a custom pattern, detection threshold and octaves
@param thresh AGAST detection threshold score.
@param octaves detection octaves. Use 0 to do single scale.
@param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
keypoint scale 1).
@param numberList defines the number of sampling points on the sampling circle. Must be the same
size as radiusList..
@param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
scale 1).
@param dMin threshold for the long pairings used for orientation determination (in pixels for
keypoint scale 1).
@param indexChange index remapping of the bits. */
CV_WRAP static Ptr<BRISK> create(int thresh, int octaves, const std::vector<float> &radiusList,
const std::vector<int> &numberList, float dMax=5.85f, float dMin=8.2f,
const std::vector<int>& indexChange=std::vector<int>());
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @brief Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor
@ -265,10 +308,11 @@ public:
will mean that to cover certain scale range you will need more pyramid levels and so the speed
will suffer.
@param nlevels The number of pyramid levels. The smallest level will have linear size equal to
input_image_linear_size/pow(scaleFactor, nlevels).
input_image_linear_size/pow(scaleFactor, nlevels - firstLevel).
@param edgeThreshold This is size of the border where the features are not detected. It should
roughly match the patchSize parameter.
@param firstLevel It should be 0 in the current implementation.
@param firstLevel The level of pyramid to put source image to. Previous layers are filled
with upscaled source image.
@param WTA_K The number of points that produce each element of the oriented BRIEF descriptor. The
default value 2 means the BRIEF where we take a random point pair and compare their brightnesses,
so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3
@ -315,30 +359,54 @@ public:
CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
CV_WRAP virtual int getFastThreshold() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @brief Maximally stable extremal region extractor. :
/** @brief Maximally stable extremal region extractor
The class encapsulates all the parameters of the MSER extraction algorithm (see
<http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions>). Also see
<http://code.opencv.org/projects/opencv/wiki/MSER> for useful comments and parameters description.
The class encapsulates all the parameters of the %MSER extraction algorithm (see [wiki
article](http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions)).
@note
- (Python) A complete example showing the use of the MSER detector can be found at
opencv_source_code/samples/python2/mser.py
*/
- there are two different implementation of %MSER: one for grey image, one for color image
- the grey image algorithm is taken from: @cite nister2008linear ; the paper claims to be faster
than union-find method; it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop.
- the color image algorithm is taken from: @cite forssen2007maximally ; it should be much slower
than grey image method ( 3~4 times ); the chi_table.h file is taken directly from paper's source
code which is distributed under GPL.
- (Python) A complete example showing the use of the %MSER detector can be found at samples/python/mser.py
*/
class CV_EXPORTS_W MSER : public Feature2D
{
public:
//! the full constructor
/** @brief Full consturctor for %MSER detector
@param _delta it compares \f$(size_{i}-size_{i-delta})/size_{i-delta}\f$
@param _min_area prune the area which smaller than minArea
@param _max_area prune the area which bigger than maxArea
@param _max_variation prune the area have similar size to its children
@param _min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
@param _max_evolution for color image, the evolution steps
@param _area_threshold for color image, the area threshold to cause re-initialize
@param _min_margin for color image, ignore too small margin
@param _edge_blur_size for color image, the aperture size for edge blur
*/
CV_WRAP static Ptr<MSER> create( int _delta=5, int _min_area=60, int _max_area=14400,
double _max_variation=0.25, double _min_diversity=.2,
int _max_evolution=200, double _area_threshold=1.01,
double _min_margin=0.003, int _edge_blur_size=5 );
/** @brief Detect %MSER regions
@param image input image (8UC1, 8UC3 or 8UC4, must be greater or equal than 3x3)
@param msers resulting list of point sets
@param bboxes resulting bounding boxes
*/
CV_WRAP virtual void detectRegions( InputArray image,
CV_OUT std::vector<std::vector<Point> >& msers,
std::vector<Rect>& bboxes ) = 0;
CV_OUT std::vector<Rect>& bboxes ) = 0;
CV_WRAP virtual void setDelta(int delta) = 0;
CV_WRAP virtual int getDelta() const = 0;
@ -351,6 +419,7 @@ public:
CV_WRAP virtual void setPass2Only(bool f) = 0;
CV_WRAP virtual bool getPass2Only() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @overload */
@ -406,6 +475,7 @@ public:
CV_WRAP virtual void setType(int type) = 0;
CV_WRAP virtual int getType() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @overload */
@ -424,6 +494,9 @@ circle around this pixel.
AgastFeatureDetector::AGAST_5_8, AgastFeatureDetector::AGAST_7_12d,
AgastFeatureDetector::AGAST_7_12s, AgastFeatureDetector::OAST_9_16
For non-Intel platforms, there is a tree optimised variant of AGAST with same numerical results.
The 32-bit binary tree tables were generated automatically from original code using perl script.
The perl script and examples of tree generation are placed in features2d/doc folder.
Detects corners using the AGAST algorithm by @cite mair2010_agast .
*/
@ -457,6 +530,7 @@ public:
CV_WRAP virtual void setType(int type) = 0;
CV_WRAP virtual int getType() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @brief Wrapping class for feature detection using the goodFeaturesToTrack function. :
@ -466,6 +540,8 @@ class CV_EXPORTS_W GFTTDetector : public Feature2D
public:
CV_WRAP static Ptr<GFTTDetector> create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
CV_WRAP static Ptr<GFTTDetector> create( int maxCorners, double qualityLevel, double minDistance,
int blockSize, int gradiantSize, bool useHarrisDetector=false, double k=0.04 );
CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
CV_WRAP virtual int getMaxFeatures() const = 0;
@ -483,6 +559,7 @@ public:
CV_WRAP virtual void setK(double k) = 0;
CV_WRAP virtual double getK() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @brief Class for extracting blobs from an image. :
@ -549,6 +626,7 @@ public:
CV_WRAP static Ptr<SimpleBlobDetector>
create(const SimpleBlobDetector::Params &parameters = SimpleBlobDetector::Params());
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
//! @} features2d_main
@ -605,15 +683,25 @@ public:
CV_WRAP virtual void setDiffusivity(int diff) = 0;
CV_WRAP virtual int getDiffusivity() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
/** @brief Class implementing the AKAZE keypoint detector and descriptor extractor, described in @cite ANB13 . :
/** @brief Class implementing the AKAZE keypoint detector and descriptor extractor, described in @cite ANB13.
@note AKAZE descriptors can only be used with KAZE or AKAZE keypoints. Try to avoid using *extract*
and *detect* instead of *operator()* due to performance reasons. .. [ANB13] Fast Explicit Diffusion
for Accelerated Features in Nonlinear Scale Spaces. Pablo F. Alcantarilla, Jesús Nuevo and Adrien
Bartoli. In British Machine Vision Conference (BMVC), Bristol, UK, September 2013.
*/
@details AKAZE descriptors can only be used with KAZE or AKAZE keypoints. This class is thread-safe.
@note When you need descriptors use Feature2D::detectAndCompute, which
provides better performance. When using Feature2D::detect followed by
Feature2D::compute scale space pyramid is computed twice.
@note AKAZE implements T-API. When image is passed as UMat some parts of the algorithm
will use OpenCL.
@note [ANB13] Fast Explicit Diffusion for Accelerated Features in Nonlinear
Scale Spaces. Pablo F. Alcantarilla, Jesús Nuevo and Adrien Bartoli. In
British Machine Vision Conference (BMVC), Bristol, UK, September 2013.
*/
class CV_EXPORTS_W AKAZE : public Feature2D
{
public:
@ -663,6 +751,7 @@ public:
CV_WRAP virtual void setDiffusivity(int diff) = 0;
CV_WRAP virtual int getDiffusivity() const = 0;
CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
};
//! @} features2d_main
@ -702,7 +791,7 @@ struct CV_EXPORTS SL2
* Euclidean distance functor
*/
template<class T>
struct CV_EXPORTS L2
struct L2
{
enum { normType = NORM_L2 };
typedef T ValueType;
@ -718,7 +807,7 @@ struct CV_EXPORTS L2
* Manhattan distance (city block distance) functor
*/
template<class T>
struct CV_EXPORTS L1
struct L1
{
enum { normType = NORM_L1 };
typedef T ValueType;
@ -745,6 +834,15 @@ an image set.
class CV_EXPORTS_W DescriptorMatcher : public Algorithm
{
public:
enum
{
FLANNBASED = 1,
BRUTEFORCE = 2,
BRUTEFORCE_L1 = 3,
BRUTEFORCE_HAMMING = 4,
BRUTEFORCE_HAMMINGLUT = 5,
BRUTEFORCE_SL2 = 6
};
virtual ~DescriptorMatcher();
/** @brief Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor
@ -763,11 +861,11 @@ public:
/** @brief Clears the train descriptor collections.
*/
CV_WRAP virtual void clear();
CV_WRAP virtual void clear() CV_OVERRIDE;
/** @brief Returns true if there are no train descriptors in the both collections.
*/
CV_WRAP virtual bool empty() const;
CV_WRAP virtual bool empty() const CV_OVERRIDE;
/** @brief Returns true if the descriptor matcher supports masking permissible matches.
*/
@ -842,8 +940,8 @@ public:
query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are
returned in the distance increasing order.
*/
void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
std::vector<std::vector<DMatch> >& matches, float maxDistance,
CV_WRAP void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
CV_OUT std::vector<std::vector<DMatch> >& matches, float maxDistance,
InputArray mask=noArray(), bool compactResult=false ) const;
/** @overload
@ -880,13 +978,26 @@ public:
false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
the matches vector does not contain matches for fully masked-out query descriptors.
*/
void radiusMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
CV_WRAP void radiusMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, float maxDistance,
InputArrayOfArrays masks=noArray(), bool compactResult=false );
CV_WRAP void write( const String& fileName ) const
{
FileStorage fs(fileName, FileStorage::WRITE);
write(fs);
}
CV_WRAP void read( const String& fileName )
{
FileStorage fs(fileName, FileStorage::READ);
read(fs.root());
}
// Reads matcher object from a file node
virtual void read( const FileNode& );
// see corresponding cv::Algorithm method
CV_WRAP virtual void read( const FileNode& ) CV_OVERRIDE;
// Writes matcher object to a file storage
virtual void write( FileStorage& ) const;
virtual void write( FileStorage& ) const CV_OVERRIDE;
/** @brief Clones the matcher.
@ -894,7 +1005,7 @@ public:
that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
object copy with the current parameters but with empty train data.
*/
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
CV_WRAP virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
/** @brief Creates a descriptor matcher of a given type with the default parameters (using default
constructor).
@ -908,6 +1019,13 @@ public:
- `FlannBased`
*/
CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
CV_WRAP static Ptr<DescriptorMatcher> create( int matcherType );
// see corresponding cv::Algorithm method
CV_WRAP inline void write(const Ptr<FileStorage>& fs, const String& name = String()) const { Algorithm::write(fs, name); }
protected:
/**
* Class to work with descriptors from several images as with one merged matrix.
@ -964,8 +1082,17 @@ sets.
class CV_EXPORTS_W BFMatcher : public DescriptorMatcher
{
public:
/** @brief Brute-force matcher constructor.
/** @brief Brute-force matcher constructor (obsolete). Please use BFMatcher.create()
*
*
*/
CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false );
virtual ~BFMatcher() {}
virtual bool isMaskSupported() const CV_OVERRIDE { return true; }
/** @brief Brute-force matcher create method.
@param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
@ -977,26 +1104,24 @@ public:
pairs. Such technique usually produces best results with minimal number of outliers when there are
enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
*/
CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false );
virtual ~BFMatcher() {}
CV_WRAP static Ptr<BFMatcher> create( int normType=NORM_L2, bool crossCheck=false ) ;
virtual bool isMaskSupported() const { return true; }
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const CV_OVERRIDE;
protected:
virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
InputArrayOfArrays masks=noArray(), bool compactResult=false );
InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
InputArrayOfArrays masks=noArray(), bool compactResult=false );
InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
int normType;
bool crossCheck;
};
#if defined(HAVE_OPENCV_FLANN) || defined(CV_DOXYGEN)
/** @brief Flann-based descriptor matcher.
This matcher trains flann::Index_ on a train descriptor collection and calls its nearest search
This matcher trains cv::flann::Index on a train descriptor collection and calls its nearest search
methods to find the best matches. So, this matcher may be faster when matching a large train
collection than the brute force matcher. FlannBasedMatcher does not support masking permissible
matches of descriptor sets because flann::Index does not support this. :
@ -1007,27 +1132,29 @@ public:
CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=makePtr<flann::KDTreeIndexParams>(),
const Ptr<flann::SearchParams>& searchParams=makePtr<flann::SearchParams>() );
virtual void add( InputArrayOfArrays descriptors );
virtual void clear();
virtual void add( InputArrayOfArrays descriptors ) CV_OVERRIDE;
virtual void clear() CV_OVERRIDE;
// Reads matcher object from a file node
virtual void read( const FileNode& );
virtual void read( const FileNode& ) CV_OVERRIDE;
// Writes matcher object to a file storage
virtual void write( FileStorage& ) const;
virtual void write( FileStorage& ) const CV_OVERRIDE;
virtual void train();
virtual bool isMaskSupported() const;
virtual void train() CV_OVERRIDE;
virtual bool isMaskSupported() const CV_OVERRIDE;
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
CV_WRAP static Ptr<FlannBasedMatcher> create();
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const CV_OVERRIDE;
protected:
static void convertToDMatches( const DescriptorCollection& descriptors,
const Mat& indices, const Mat& distances,
std::vector<std::vector<DMatch> >& matches );
virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
InputArrayOfArrays masks=noArray(), bool compactResult=false );
InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
InputArrayOfArrays masks=noArray(), bool compactResult=false );
InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
Ptr<flann::IndexParams> indexParams;
Ptr<flann::SearchParams> searchParams;
@ -1037,6 +1164,8 @@ protected:
int addedDescCount;
};
#endif
//! @} features2d_match
/****************************************************************************************\
@ -1202,8 +1331,8 @@ public:
virtual ~BOWKMeansTrainer();
// Returns trained vocabulary (i.e. cluster centers).
CV_WRAP virtual Mat cluster() const;
CV_WRAP virtual Mat cluster( const Mat& descriptors ) const;
CV_WRAP virtual Mat cluster() const CV_OVERRIDE;
CV_WRAP virtual Mat cluster( const Mat& descriptors ) const CV_OVERRIDE;
protected: