gpu::
FAST_GPU
¶Class used for corner detection using the FAST algorithm.
class FAST_GPU
{
public:
enum
{
LOCATION_ROW = 0,
RESPONSE_ROW,
ROWS_COUNT
};
// all features have same size
static const int FEATURE_SIZE = 7;
explicit FAST_GPU(int threshold, bool nonmaxSuppression = true,
double keypointsRatio = 0.05);
void operator ()(const GpuMat& image, const GpuMat& mask, GpuMat& keypoints);
void operator ()(const GpuMat& image, const GpuMat& mask,
std::vector<KeyPoint>& keypoints);
void downloadKeypoints(const GpuMat& d_keypoints,
std::vector<KeyPoint>& keypoints);
void convertKeypoints(const Mat& h_keypoints,
std::vector<KeyPoint>& keypoints);
void release();
bool nonmaxSuppression;
int threshold;
double keypointsRatio;
int calcKeyPointsLocation(const GpuMat& image, const GpuMat& mask);
int getKeyPoints(GpuMat& keypoints);
};
The class FAST_GPU
implements FAST corner detection algorithm.
See also
Constructor.
gpu::FAST_GPU::
FAST_GPU
(int threshold, bool nonmaxSuppression=true, double keypointsRatio=0.05)¶Parameters: |
|
---|
Finds the keypoints using FAST detector.
void gpu::FAST_GPU::
operator()
(const GpuMat& image, const GpuMat& mask, GpuMat& keypoints)¶
void gpu::FAST_GPU::
operator()
(const GpuMat& image, const GpuMat& mask, std::vector<KeyPoint>& keypoints)¶Parameters: |
|
---|
Download keypoints from GPU to CPU memory.
void gpu::FAST_GPU::
downloadKeypoints
(const GpuMat& d_keypoints, std::vector<KeyPoint>& keypoints)¶Converts keypoints from GPU representation to vector of KeyPoint
.
void gpu::FAST_GPU::
convertKeypoints
(const Mat& h_keypoints, std::vector<KeyPoint>& keypoints)¶Find keypoints and compute it’s response if nonmaxSuppression
is true.
int gpu::FAST_GPU::
calcKeyPointsLocation
(const GpuMat& image, const GpuMat& mask)¶Parameters: |
|
---|
The function returns count of detected keypoints.
Gets final array of keypoints.
int gpu::FAST_GPU::
getKeyPoints
(GpuMat& keypoints)¶Parameters: |
|
---|
The function performs non-max suppression if needed and returns final count of keypoints.
gpu::
ORB_GPU
¶Class for extracting ORB features and descriptors from an image.
class ORB_GPU
{
public:
enum
{
X_ROW = 0,
Y_ROW,
RESPONSE_ROW,
ANGLE_ROW,
OCTAVE_ROW,
SIZE_ROW,
ROWS_COUNT
};
enum
{
DEFAULT_FAST_THRESHOLD = 20
};
explicit ORB_GPU(int nFeatures = 500, float scaleFactor = 1.2f,
int nLevels = 8, int edgeThreshold = 31,
int firstLevel = 0, int WTA_K = 2,
int scoreType = 0, int patchSize = 31);
void operator()(const GpuMat& image, const GpuMat& mask,
std::vector<KeyPoint>& keypoints);
void operator()(const GpuMat& image, const GpuMat& mask, GpuMat& keypoints);
void operator()(const GpuMat& image, const GpuMat& mask,
std::vector<KeyPoint>& keypoints, GpuMat& descriptors);
void operator()(const GpuMat& image, const GpuMat& mask,
GpuMat& keypoints, GpuMat& descriptors);
void downloadKeyPoints(GpuMat& d_keypoints, std::vector<KeyPoint>& keypoints);
void convertKeyPoints(Mat& d_keypoints, std::vector<KeyPoint>& keypoints);
int descriptorSize() const;
void setParams(size_t n_features, const ORB::CommonParams& detector_params);
void setFastParams(int threshold, bool nonmaxSuppression = true);
void release();
bool blurForDescriptor;
};
The class implements ORB feature detection and description algorithm.
Constructor.
gpu::ORB_GPU::
ORB_GPU
(int nFeatures=500, float scaleFactor=1.2f, int nLevels=8, int edgeThreshold=31, int firstLevel=0, int WTA_K=2, int scoreType=0, int patchSize=31)¶Parameters: |
|
---|
Detects keypoints and computes descriptors for them.
void gpu::ORB_GPU::
operator()
(const GpuMat& image, const GpuMat& mask, std::vector<KeyPoint>& keypoints)¶
void gpu::ORB_GPU::
operator()
(const GpuMat& image, const GpuMat& mask, GpuMat& keypoints)¶
void gpu::ORB_GPU::
operator()
(const GpuMat& image, const GpuMat& mask, std::vector<KeyPoint>& keypoints, GpuMat& descriptors)¶
void gpu::ORB_GPU::
operator()
(const GpuMat& image, const GpuMat& mask, GpuMat& keypoints, GpuMat& descriptors)¶Parameters: |
|
---|
Download keypoints from GPU to CPU memory.
void gpu::ORB_GPU::
downloadKeyPoints
(GpuMat& d_keypoints, std::vector<KeyPoint>& keypoints)¶Converts keypoints from GPU representation to vector of KeyPoint
.
void gpu::ORB_GPU::
convertKeyPoints
(Mat& d_keypoints, std::vector<KeyPoint>& keypoints)¶gpu::
BruteForceMatcher_GPU_base
¶Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets.
class BruteForceMatcher_GPU_base
{
public:
explicit BruteForceMatcher_GPU_base(int norm = cv::NORM_L2);
// Add descriptors to train descriptor collection.
void add(const std::vector<GpuMat>& descCollection);
// Get train descriptors collection.
const std::vector<GpuMat>& getTrainDescriptors() const;
// Clear train descriptors collection.
void clear();
// Return true if there are no train descriptors in collection.
bool empty() const;
// Return true if the matcher supports mask in match methods.
bool isMaskSupported() const;
void matchSingle(const GpuMat& query, const GpuMat& train,
GpuMat& trainIdx, GpuMat& distance,
const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());
static void matchDownload(const GpuMat& trainIdx,
const GpuMat& distance, std::vector<DMatch>& matches);
static void matchConvert(const Mat& trainIdx,
const Mat& distance, std::vector<DMatch>& matches);
void match(const GpuMat& query, const GpuMat& train,
std::vector<DMatch>& matches, const GpuMat& mask = GpuMat());
void makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection,
const vector<GpuMat>& masks = std::vector<GpuMat>());
void matchCollection(const GpuMat& query, const GpuMat& trainCollection,
GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
const GpuMat& maskCollection, Stream& stream = Stream::Null());
static void matchDownload(const GpuMat& trainIdx, GpuMat& imgIdx,
const GpuMat& distance, std::vector<DMatch>& matches);
static void matchConvert(const Mat& trainIdx, const Mat& imgIdx,
const Mat& distance, std::vector<DMatch>& matches);
void match(const GpuMat& query, std::vector<DMatch>& matches,
const std::vector<GpuMat>& masks = std::vector<GpuMat>());
void knnMatchSingle(const GpuMat& query, const GpuMat& train,
GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k,
const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());
static void knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
static void knnMatchConvert(const Mat& trainIdx, const Mat& distance,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
void knnMatch(const GpuMat& query, const GpuMat& train,
std::vector< std::vector<DMatch> >& matches, int k,
const GpuMat& mask = GpuMat(), bool compactResult = false);
void knnMatch2Collection(const GpuMat& query, const GpuMat& trainCollection,
GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
const GpuMat& maskCollection = GpuMat(), Stream& stream = Stream::Null());
static void knnMatch2Download(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
static void knnMatch2Convert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
void knnMatch(const GpuMat& query, std::vector< std::vector<DMatch> >& matches, int k,
const std::vector<GpuMat>& masks = std::vector<GpuMat>(),
bool compactResult = false);
void radiusMatchSingle(const GpuMat& query, const GpuMat& train,
GpuMat& trainIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance,
const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());
static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, const GpuMat& nMatches,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
static void radiusMatchConvert(const Mat& trainIdx, const Mat& distance, const Mat& nMatches,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
void radiusMatch(const GpuMat& query, const GpuMat& train,
std::vector< std::vector<DMatch> >& matches, float maxDistance,
const GpuMat& mask = GpuMat(), bool compactResult = false);
void radiusMatchCollection(const GpuMat& query, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance,
const std::vector<GpuMat>& masks = std::vector<GpuMat>(), Stream& stream = Stream::Null());
static void radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, const GpuMat& nMatches,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
static void radiusMatchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, const Mat& nMatches,
std::vector< std::vector<DMatch> >& matches, bool compactResult = false);
void radiusMatch(const GpuMat& query, std::vector< std::vector<DMatch> >& matches, float maxDistance,
const std::vector<GpuMat>& masks = std::vector<GpuMat>(), bool compactResult = false);
private:
std::vector<GpuMat> trainDescCollection;
};
The class BruteForceMatcher_GPU_base
has an interface similar to the class DescriptorMatcher
. It has two groups of match
methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory.
See also
Finds the best match for each descriptor from a query set with train descriptors.
void gpu::BruteForceMatcher_GPU_base::
match
(const GpuMat& query, const GpuMat& train, std::vector<DMatch>& matches, const GpuMat& mask=GpuMat())¶
void gpu::BruteForceMatcher_GPU_base::
matchSingle
(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, const GpuMat& mask=GpuMat(), Stream& stream=Stream::Null())¶
void gpu::BruteForceMatcher_GPU_base::
match
(const GpuMat& query, std::vector<DMatch>& matches, const std::vector<GpuMat>& masks=std::vector<GpuMat>())¶
void gpu::BruteForceMatcher_GPU_base::
matchCollection
(const GpuMat& query, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& masks=GpuMat(), Stream& stream=Stream::Null() )¶See also
Performs a GPU collection of train descriptors and masks in a suitable format for the gpu::BruteForceMatcher_GPU_base::matchCollection()
function.
void gpu::BruteForceMatcher_GPU_base::
makeGpuCollection
(GpuMat& trainCollection, GpuMat& maskCollection, const vector<GpuMat>& masks=std::vector<GpuMat>())¶Downloads matrices obtained via gpu::BruteForceMatcher_GPU_base::matchSingle()
or gpu::BruteForceMatcher_GPU_base::matchCollection()
to vector with DMatch
.
static void gpu::BruteForceMatcher_GPU_base::
matchDownload
(const GpuMat& trainIdx, const GpuMat& distance, std::vector<DMatch>& matches)¶
static void gpu::BruteForceMatcher_GPU_base::
matchDownload
(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector<DMatch>& matches)¶Converts matrices obtained via gpu::BruteForceMatcher_GPU_base::matchSingle()
or gpu::BruteForceMatcher_GPU_base::matchCollection()
to vector with DMatch
.
void gpu::BruteForceMatcher_GPU_base::
matchConvert
(const Mat& trainIdx, const Mat& distance, std::vector<DMatch>& matches)¶
void gpu::BruteForceMatcher_GPU_base::
matchConvert
(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector<DMatch>& matches)¶Finds the k
best matches for each descriptor from a query set with train descriptors.
void gpu::BruteForceMatcher_GPU_base::
knnMatch
(const GpuMat& query, const GpuMat& train, std::vector<std::vector<DMatch>>& matches, int k, const GpuMat& mask=GpuMat(), bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
knnMatchSingle
(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask=GpuMat(), Stream& stream=Stream::Null())¶
void gpu::BruteForceMatcher_GPU_base::
knnMatch
(const GpuMat& query, std::vector<std::vector<DMatch>>& matches, int k, const std::vector<GpuMat>& masks=std::vector<GpuMat>(), bool compactResult=false )¶
void gpu::BruteForceMatcher_GPU_base::
knnMatch2Collection
(const GpuMat& query, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& maskCollection=GpuMat(), Stream& stream=Stream::Null())¶Parameters: |
|
---|
The function returns detected k
(or less if not possible) matches in the increasing order by distance.
The third variant of the method stores the results in GPU memory.
See also
Downloads matrices obtained via gpu::BruteForceMatcher_GPU_base::knnMatchSingle()
or gpu::BruteForceMatcher_GPU_base::knnMatch2Collection()
to vector with DMatch
.
void gpu::BruteForceMatcher_GPU_base::
knnMatchDownload
(const GpuMat& trainIdx, const GpuMat& distance, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
knnMatch2Download
(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶If compactResult
is true
, the matches
vector does not contain matches for fully masked-out query descriptors.
Converts matrices obtained via gpu::BruteForceMatcher_GPU_base::knnMatchSingle()
or gpu::BruteForceMatcher_GPU_base::knnMatch2Collection()
to CPU vector with DMatch
.
void gpu::BruteForceMatcher_GPU_base::
knnMatchConvert
(const Mat& trainIdx, const Mat& distance, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
knnMatch2Convert
(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶If compactResult
is true
, the matches
vector does not contain matches for fully masked-out query descriptors.
For each query descriptor, finds the best matches with a distance less than a given threshold.
void gpu::BruteForceMatcher_GPU_base::
radiusMatch
(const GpuMat& query, const GpuMat& train, std::vector<std::vector<DMatch>>& matches, float maxDistance, const GpuMat& mask=GpuMat(), bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
radiusMatchSingle
(const GpuMat& query, const GpuMat& train, GpuMat& trainIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance, const GpuMat& mask=GpuMat(), Stream& stream=Stream::Null())¶
void gpu::BruteForceMatcher_GPU_base::
radiusMatch
(const GpuMat& query, std::vector<std::vector<DMatch>>& matches, float maxDistance, const std::vector<GpuMat>& masks=std::vector<GpuMat>(), bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
radiusMatchCollection
(const GpuMat& query, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, GpuMat& nMatches, float maxDistance, const std::vector<GpuMat>& masks=std::vector<GpuMat>(), Stream& stream=Stream::Null())¶Parameters: |
|
---|
The function returns detected matches in the increasing order by distance.
The methods work only on devices with the compute capability 1.1.
The third variant of the method stores the results in GPU memory and does not store the points by the distance.
See also
Downloads matrices obtained via gpu::BruteForceMatcher_GPU_base::radiusMatchSingle()
or gpu::BruteForceMatcher_GPU_base::radiusMatchCollection()
to vector with DMatch
.
void gpu::BruteForceMatcher_GPU_base::
radiusMatchDownload
(const GpuMat& trainIdx, const GpuMat& distance, const GpuMat& nMatches, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
radiusMatchDownload
(const GpuMat& trainIdx, const GpuMat& imgIdx, const GpuMat& distance, const GpuMat& nMatches, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶If compactResult
is true
, the matches
vector does not contain matches for fully masked-out query descriptors.
Converts matrices obtained via gpu::BruteForceMatcher_GPU_base::radiusMatchSingle()
or gpu::BruteForceMatcher_GPU_base::radiusMatchCollection()
to vector with DMatch
.
void gpu::BruteForceMatcher_GPU_base::
radiusMatchConvert
(const Mat& trainIdx, const Mat& distance, const Mat& nMatches, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void gpu::BruteForceMatcher_GPU_base::
radiusMatchConvert
(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, const Mat& nMatches, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶If compactResult
is true
, the matches
vector does not contain matches for fully masked-out query descriptors.