Finds edges in an image using the [Canny86] algorithm.
| Parameters: |
|
|---|
See also
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_OCL_base
{
public:
enum DistType {L1Dist = 0, L2Dist, HammingDist};
// Add descriptors to train descriptor collection.
void add(const std::vector<oclMat>& descCollection);
// Get train descriptors collection.
const std::vector<oclMat>& 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 oclMat& query, const oclMat& train,
oclMat& trainIdx, oclMat& distance,
const oclMat& mask = oclMat());
static void matchDownload(const oclMat& trainIdx,
const oclMat& distance, std::vector<DMatch>& matches);
static void matchConvert(const Mat& trainIdx,
const Mat& distance, std::vector<DMatch>& matches);
void match(const oclMat& query, const oclMat& train,
std::vector<DMatch>& matches, const oclMat& mask = oclMat());
void makeGpuCollection(oclMat& trainCollection, oclMat& maskCollection,
const vector<oclMat>& masks = std::vector<oclMat>());
void matchCollection(const oclMat& query, const oclMat& trainCollection,
oclMat& trainIdx, oclMat& imgIdx, oclMat& distance,
const oclMat& maskCollection);
static void matchDownload(const oclMat& trainIdx, oclMat& imgIdx,
const oclMat& distance, std::vector<DMatch>& matches);
static void matchConvert(const Mat& trainIdx, const Mat& imgIdx,
const Mat& distance, std::vector<DMatch>& matches);
void match(const oclMat& query, std::vector<DMatch>& matches,
const std::vector<oclMat>& masks = std::vector<oclMat>());
void knnMatchSingle(const oclMat& query, const oclMat& train,
oclMat& trainIdx, oclMat& distance, oclMat& allDist, int k,
const oclMat& mask = oclMat());
static void knnMatchDownload(const oclMat& trainIdx, const oclMat& 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 oclMat& query, const oclMat& train,
std::vector< std::vector<DMatch> >& matches, int k,
const oclMat& mask = oclMat(), bool compactResult = false);
void knnMatch2Collection(const oclMat& query, const oclMat& trainCollection,
oclMat& trainIdx, oclMat& imgIdx, oclMat& distance,
const oclMat& maskCollection = oclMat());
static void knnMatch2Download(const oclMat& trainIdx, const oclMat& imgIdx, const oclMat& 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 oclMat& query, std::vector< std::vector<DMatch> >& matches, int k,
const std::vector<oclMat>& masks = std::vector<oclMat>(),
bool compactResult = false);
void radiusMatchSingle(const oclMat& query, const oclMat& train,
oclMat& trainIdx, oclMat& distance, oclMat& nMatches, float maxDistance,
const oclMat& mask = oclMat());
static void radiusMatchDownload(const oclMat& trainIdx, const oclMat& distance, const oclMat& 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 oclMat& query, const oclMat& train,
std::vector< std::vector<DMatch> >& matches, float maxDistance,
const oclMat& mask = oclMat(), bool compactResult = false);
void radiusMatchCollection(const oclMat& query, oclMat& trainIdx, oclMat& imgIdx, oclMat& distance, oclMat& nMatches, float maxDistance,
const std::vector<oclMat>& masks = std::vector<oclMat>());
static void radiusMatchDownload(const oclMat& trainIdx, const oclMat& imgIdx, const oclMat& distance, const oclMat& 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 oclMat& query, std::vector< std::vector<DMatch> >& matches, float maxDistance,
const std::vector<oclMat>& masks = std::vector<oclMat>(), bool compactResult = false);
DistType distType;
private:
std::vector<oclMat> trainDescCollection;
};
The class BruteForceMatcher_OCL_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. BruteForceMatcher_OCL_base supports only the L1<float>, L2<float>, and Hamming distance types.
See also
Finds the best match for each descriptor from a query set with train descriptors.
See also
Performs a GPU collection of train descriptors and masks in a suitable format for the ocl::BruteForceMatcher_OCL_base::matchCollection() function.
Downloads matrices obtained via ocl::BruteForceMatcher_OCL_base::matchSingle() or ocl::BruteForceMatcher_OCL_base::matchCollection() to vector with DMatch.
Converts matrices obtained via ocl::BruteForceMatcher_OCL_base::matchSingle() or ocl::BruteForceMatcher_OCL_base::matchCollection() to vector with DMatch.
Finds the k best matches for each descriptor from a query set with train descriptors.
| 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 ocl::BruteForceMatcher_OCL_base::knnMatchSingle() or ocl::BruteForceMatcher_OCL_base::knnMatch2Collection() to vector with DMatch.
If compactResult is true , the matches vector does not contain matches for fully masked-out query descriptors.
Converts matrices obtained via ocl::BruteForceMatcher_OCL_base::knnMatchSingle() or ocl::BruteForceMatcher_OCL_base::knnMatch2Collection() to CPU vector with DMatch.
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.
| 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 ocl::BruteForceMatcher_OCL_base::radiusMatchSingle() or ocl::BruteForceMatcher_OCL_base::radiusMatchCollection() to vector with DMatch.
If compactResult is true , the matches vector does not contain matches for fully masked-out query descriptors.
Converts matrices obtained via ocl::BruteForceMatcher_OCL_base::radiusMatchSingle() or ocl::BruteForceMatcher_OCL_base::radiusMatchCollection() to vector with DMatch.
If compactResult is true , the matches vector does not contain matches for fully masked-out query descriptors.
Class used for corner detection using the FAST algorithm.
class CV_EXPORTS FAST_OCL
{
public:
enum
{
X_ROW = 0,
Y_ROW,
RESPONSE_ROW,
ROWS_COUNT
};
// all features have same size
static const int FEATURE_SIZE = 7;
explicit FAST_OCL(int threshold, bool nonmaxSupression = true, double keypointsRatio = 0.05);
//! finds the keypoints using FAST detector
//! supports only CV_8UC1 images
void operator ()(const oclMat& image, const oclMat& mask, oclMat& keypoints);
void operator ()(const oclMat& image, const oclMat& mask, std::vector<KeyPoint>& keypoints);
//! download keypoints from device to host memory
static void downloadKeypoints(const oclMat& d_keypoints, std::vector<KeyPoint>& keypoints);
//! convert keypoints to KeyPoint vector
static void convertKeypoints(const Mat& h_keypoints, std::vector<KeyPoint>& keypoints);
//! release temporary buffer's memory
void release();
bool nonmaxSupression;
int threshold;
//! max keypoints = keypointsRatio * img.size().area()
double keypointsRatio;
//! find keypoints and compute it's response if nonmaxSupression is true
//! return count of detected keypoints
int calcKeyPointsLocation(const oclMat& image, const oclMat& mask);
//! get final array of keypoints
//! performs nonmax supression if needed
//! return final count of keypoints
int getKeyPoints(oclMat& keypoints);
private:
// Hidden
};
The class FAST_OCL implements FAST corner detection algorithm.
See also
Constructor.
| Parameters: |
|
|---|
Finds the keypoints using FAST detector.
| Parameters: |
|
|---|
Download keypoints from device to host memory.
Converts keypoints from OpenCL representation to vector of KeyPoint.
Find keypoints. If nonmaxSupression is true, responses are computed and eliminates keypoints with the smaller responses from 9-neighborhood regions.
| Parameters: |
|
|---|
The function returns the amount of detected keypoints.
Gets final array of keypoints.
| Parameters: |
|
|---|
The function performs non-max suppression if needed and returns the final amount of keypoints.
Class for computing BRIEF descriptors described in a paper of Calonder M., Lepetit V., Strecha C., Fua P. BRIEF: Binary Robust Independent Elementary Features , 11th European Conference on Computer Vision (ECCV), Heraklion, Crete. LNCS Springer, September 2010.
class CV_EXPORTS BRIEF_OCL
{
public:
static const int PATCH_SIZE = 48;
static const int KERNEL_SIZE = 9;
explicit BRIEF_OCL(int _bytes = 32);
//!computes the brief descriptor for a set of given keypoints
//! supports only CV_8UC1 images
void compute(const oclMat& image, const oclMat& keypoints, oclMat& mask, oclMat& descriptors) const;
static int getBorderSize();
protected:
...
};
Constructor.
| Parameters: |
|
|---|
Computes BRIEF descriptors.
| Parameters: |
|
|---|
Returns the size of the image border where descriptors cannot be computed
The class implements Histogram of Oriented Gradients ([Dalal2005]) object detector.
struct CV_EXPORTS HOGDescriptor
{
enum { DEFAULT_WIN_SIGMA = -1 };
enum { DEFAULT_NLEVELS = 64 };
enum { DESCR_FORMAT_ROW_BY_ROW, DESCR_FORMAT_COL_BY_COL };
HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16),
Size block_stride=Size(8, 8), Size cell_size=Size(8, 8),
int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA,
double threshold_L2hys=0.2, bool gamma_correction=true,
int nlevels=DEFAULT_NLEVELS);
size_t getDescriptorSize() const;
size_t getBlockHistogramSize() const;
void setSVMDetector(const vector<float>& detector);
static vector<float> getDefaultPeopleDetector();
static vector<float> getPeopleDetector48x96();
static vector<float> getPeopleDetector64x128();
void detect(const oclMat& img, vector<Point>& found_locations,
double hit_threshold=0, Size win_stride=Size(),
Size padding=Size());
void detectMultiScale(const oclMat& img, vector<Rect>& found_locations,
double hit_threshold=0, Size win_stride=Size(),
Size padding=Size(), double scale0=1.05,
int group_threshold=2);
void getDescriptors(const oclMat& img, Size win_stride,
oclMat& descriptors,
int descr_format=DESCR_FORMAT_COL_BY_COL);
Size win_size;
Size block_size;
Size block_stride;
Size cell_size;
int nbins;
double win_sigma;
double threshold_L2hys;
bool gamma_correction;
int nlevels;
private:
// Hidden
}
Interfaces of all methods are kept similar to the CPU HOG descriptor and detector analogues as much as possible.
Note
(Ocl) An example using the HOG descriptor can be found at opencv_source_code/samples/ocl/hog.cpp
Creates the HOG descriptor and detector.
| Parameters: |
|
|---|
Returns the number of coefficients required for the classification.
Returns the block histogram size.
Sets coefficients for the linear SVM classifier.
Returns coefficients of the classifier trained for people detection (for default window size).
Returns coefficients of the classifier trained for people detection (for 48x96 windows).
Returns coefficients of the classifier trained for people detection (for 64x128 windows).
Performs object detection without a multi-scale window.
| Parameters: |
|
|---|
Performs object detection with a multi-scale window.
| Parameters: |
|
|---|
Returns block descriptors computed for the whole image.
| Parameters: |
|
|---|
The function is mainly used to learn the classifier.
Class for extracting ORB features and descriptors from an image.
class ORB_OCL
{
public:
enum
{
X_ROW = 0,
Y_ROW,
RESPONSE_ROW,
ANGLE_ROW,
OCTAVE_ROW,
SIZE_ROW,
ROWS_COUNT
};
enum
{
DEFAULT_FAST_THRESHOLD = 20
};
explicit ORB_OCL(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 oclMat& image, const oclMat& mask,
std::vector<KeyPoint>& keypoints);
void operator()(const oclMat& image, const oclMat& mask, oclMat& keypoints);
void operator()(const oclMat& image, const oclMat& mask,
std::vector<KeyPoint>& keypoints, oclMat& descriptors);
void operator()(const oclMat& image, const oclMat& mask,
oclMat& keypoints, oclMat& descriptors);
void downloadKeyPoints(oclMat& d_keypoints, std::vector<KeyPoint>& keypoints);
void convertKeyPoints(Mat& d_keypoints, std::vector<KeyPoint>& keypoints);
int descriptorSize() const;
int descriptorType() const;
int defaultNorm() const;
void setFastParams(int threshold, bool nonmaxSupression = true);
void release();
bool blurForDescriptor;
};
The class implements ORB feature detection and description algorithm.
Constructor.
| Parameters: |
|
|---|
Detects keypoints and computes descriptors for them.
| Parameters: |
|
|---|
Download keypoints from device to host memory.