Finds edges in an image using the [Canny86] algorithm.
void ocl::
Canny
(const oclMat& image, oclMat& edges, double low_thresh, double high_thresh, int apperture_size=3, bool L2gradient=false)¶
void ocl::
Canny
(const oclMat& image, CannyBuf& buf, oclMat& edges, double low_thresh, double high_thresh, int apperture_size=3, bool L2gradient=false)¶
void ocl::
Canny
(const oclMat& dx, const oclMat& dy, oclMat& edges, double low_thresh, double high_thresh, bool L2gradient=false)¶
void ocl::
Canny
(const oclMat& dx, const oclMat& dy, CannyBuf& buf, oclMat& edges, double low_thresh, double high_thresh, bool L2gradient=false)¶Parameters: |
|
---|
See also
ocl::
BruteForceMatcher_OCL_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_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.
void ocl::BruteForceMatcher_OCL_base::
match
(const oclMat& query, const oclMat& train, std::vector<DMatch>& matches, const oclMat& mask=oclMat())¶
void ocl::BruteForceMatcher_OCL_base::
matchSingle
(const oclMat& query, const oclMat& train, oclMat& trainIdx, oclMat& distance, const oclMat& mask=oclMat())¶
void ocl::BruteForceMatcher_OCL_base::
match
(const oclMat& query, std::vector<DMatch>& matches, const std::vector<oclMat>& masks=std::vector<oclMat>())¶
void ocl::BruteForceMatcher_OCL_base::
matchCollection
(const oclMat& query, const oclMat& trainCollection, oclMat& trainIdx, oclMat& imgIdx, oclMat& distance, const oclMat& masks=oclMat() )¶See also
Performs a GPU collection of train descriptors and masks in a suitable format for the ocl::BruteForceMatcher_OCL_base::matchCollection()
function.
void ocl::BruteForceMatcher_OCL_base::
makeGpuCollection
(oclMat& trainCollection, oclMat& maskCollection, const vector<oclMat>& masks=std::vector<oclMat>())¶Downloads matrices obtained via ocl::BruteForceMatcher_OCL_base::matchSingle()
or ocl::BruteForceMatcher_OCL_base::matchCollection()
to vector with DMatch
.
static void ocl::BruteForceMatcher_OCL_base::
matchDownload
(const oclMat& trainIdx, const oclMat& distance, std::vector<DMatch>& matches)¶
static void ocl::BruteForceMatcher_OCL_base::
matchDownload
(const oclMat& trainIdx, const oclMat& imgIdx, const oclMat& distance, std::vector<DMatch>& matches)¶Converts matrices obtained via ocl::BruteForceMatcher_OCL_base::matchSingle()
or ocl::BruteForceMatcher_OCL_base::matchCollection()
to vector with DMatch
.
void ocl::BruteForceMatcher_OCL_base::
matchConvert
(const Mat& trainIdx, const Mat& distance, std::vector<DMatch>& matches)¶
void ocl::BruteForceMatcher_OCL_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 ocl::BruteForceMatcher_OCL_base::
knnMatch
(const oclMat& query, const oclMat& train, std::vector<std::vector<DMatch>>& matches, int k, const oclMat& mask=oclMat(), bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_base::
knnMatchSingle
(const oclMat& query, const oclMat& train, oclMat& trainIdx, oclMat& distance, oclMat& allDist, int k, const oclMat& mask=oclMat())¶
void ocl::BruteForceMatcher_OCL_base::
knnMatch
(const oclMat& query, std::vector<std::vector<DMatch>>& matches, int k, const std::vector<oclMat>& masks=std::vector<oclMat>(), bool compactResult=false )¶
void ocl::BruteForceMatcher_OCL_base::
knnMatch2Collection
(const oclMat& query, const oclMat& trainCollection, oclMat& trainIdx, oclMat& imgIdx, oclMat& distance, const oclMat& maskCollection=oclMat())¶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
.
void ocl::BruteForceMatcher_OCL_base::
knnMatchDownload
(const oclMat& trainIdx, const oclMat& distance, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_base::
knnMatch2Download
(const oclMat& trainIdx, const oclMat& imgIdx, const oclMat& 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 ocl::BruteForceMatcher_OCL_base::knnMatchSingle()
or ocl::BruteForceMatcher_OCL_base::knnMatch2Collection()
to CPU vector with DMatch
.
void ocl::BruteForceMatcher_OCL_base::
knnMatchConvert
(const Mat& trainIdx, const Mat& distance, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_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 ocl::BruteForceMatcher_OCL_base::
radiusMatch
(const oclMat& query, const oclMat& train, std::vector<std::vector<DMatch>>& matches, float maxDistance, const oclMat& mask=oclMat(), bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_base::
radiusMatchSingle
(const oclMat& query, const oclMat& train, oclMat& trainIdx, oclMat& distance, oclMat& nMatches, float maxDistance, const oclMat& mask=oclMat())¶
void ocl::BruteForceMatcher_OCL_base::
radiusMatch
(const oclMat& query, std::vector<std::vector<DMatch>>& matches, float maxDistance, const std::vector<oclMat>& masks=std::vector<oclMat>(), bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_base::
radiusMatchCollection
(const oclMat& query, oclMat& trainIdx, oclMat& imgIdx, oclMat& distance, oclMat& nMatches, float maxDistance, const std::vector<oclMat>& masks=std::vector<oclMat>())¶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
.
void ocl::BruteForceMatcher_OCL_base::
radiusMatchDownload
(const oclMat& trainIdx, const oclMat& distance, const oclMat& nMatches, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_base::
radiusMatchDownload
(const oclMat& trainIdx, const oclMat& imgIdx, const oclMat& distance, const oclMat& 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 ocl::BruteForceMatcher_OCL_base::radiusMatchSingle()
or ocl::BruteForceMatcher_OCL_base::radiusMatchCollection()
to vector with DMatch
.
void ocl::BruteForceMatcher_OCL_base::
radiusMatchConvert
(const Mat& trainIdx, const Mat& distance, const Mat& nMatches, std::vector<std::vector<DMatch>>& matches, bool compactResult=false)¶
void ocl::BruteForceMatcher_OCL_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.
ocl::
HOGDescriptor
¶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.
ocl::HOGDescriptor::
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)¶Parameters: |
|
---|
Returns the number of coefficients required for the classification.
size_t ocl::HOGDescriptor::
getDescriptorSize
() const
¶Returns the block histogram size.
size_t ocl::HOGDescriptor::
getBlockHistogramSize
() const
¶Sets coefficients for the linear SVM classifier.
void ocl::HOGDescriptor::
setSVMDetector
(const vector<float>& detector)¶Returns coefficients of the classifier trained for people detection (for default window size).
static vector<float> ocl::HOGDescriptor::
getDefaultPeopleDetector
()¶Returns coefficients of the classifier trained for people detection (for 48x96 windows).
static vector<float> ocl::HOGDescriptor::
getPeopleDetector48x96
()¶Returns coefficients of the classifier trained for people detection (for 64x128 windows).
static vector<float> ocl::HOGDescriptor::
getPeopleDetector64x128
()¶Performs object detection without a multi-scale window.
void ocl::HOGDescriptor::
detect
(const oclMat& img, vector<Point>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size())¶Parameters: |
|
---|
Performs object detection with a multi-scale window.
void ocl::HOGDescriptor::
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)¶Parameters: |
|
---|
Returns block descriptors computed for the whole image.
void ocl::HOGDescriptor::
getDescriptors
(const oclMat& img, Size win_stride, oclMat& descriptors, int descr_format=DESCR_FORMAT_COL_BY_COL)¶Parameters: |
|
---|
The function is mainly used to learn the classifier.