This source file includes following definitions.
- descriptorSize
- setAngularBins
- setRadialBins
- setInnerRadius
- setOuterRadius
- setRotationInvariant
- getAngularBins
- getRadialBins
- getInnerRadius
- getOuterRadius
- getRotationInvariant
- getMeanDistance
- getMatchingCost
#include <stdlib.h>
#include <math.h>
#include <vector>
namespace cv
{
class SCD
{
public:
explicit SCD(int _nAngularBins=12, int _nRadialBins=5,
double _innerRadius=0.1, double _outerRadius=1, bool _rotationInvariant=false)
{
setAngularBins(_nAngularBins);
setRadialBins(_nRadialBins);
setInnerRadius(_innerRadius);
setOuterRadius(_outerRadius);
setRotationInvariant(_rotationInvariant);
}
void extractSCD(cv::Mat& contour, cv::Mat& descriptors,
const std::vector<int>& queryInliers=std::vector<int>(),
const float _meanDistance=-1);
int descriptorSize() {return nAngularBins*nRadialBins;}
void setAngularBins(int angularBins) { nAngularBins=angularBins; }
void setRadialBins(int radialBins) { nRadialBins=radialBins; }
void setInnerRadius(double _innerRadius) { innerRadius=_innerRadius; }
void setOuterRadius(double _outerRadius) { outerRadius=_outerRadius; }
void setRotationInvariant(bool _rotationInvariant) { rotationInvariant=_rotationInvariant; }
int getAngularBins() const { return nAngularBins; }
int getRadialBins() const { return nRadialBins; }
double getInnerRadius() const { return innerRadius; }
double getOuterRadius() const { return outerRadius; }
bool getRotationInvariant() const { return rotationInvariant; }
float getMeanDistance() const { return meanDistance; }
private:
int nAngularBins;
int nRadialBins;
double innerRadius;
double outerRadius;
bool rotationInvariant;
float meanDistance;
protected:
void logarithmicSpaces(std::vector<double>& vecSpaces) const;
void angularSpaces(std::vector<double>& vecSpaces) const;
void buildNormalizedDistanceMatrix(cv::Mat& contour,
cv::Mat& disMatrix, const std::vector<int> &queryInliers,
const float _meanDistance=-1);
void buildAngleMatrix(cv::Mat& contour,
cv::Mat& angleMatrix) const;
};
class SCDMatcher
{
public:
SCDMatcher()
{
}
void matchDescriptors(cv::Mat& descriptors1, cv::Mat& descriptors2, std::vector<cv::DMatch>& matches, cv::Ptr<cv::HistogramCostExtractor>& comparer,
std::vector<int>& inliers1, std::vector<int> &inliers2);
float getMatchingCost() const {return minMatchCost;}
private:
float minMatchCost;
protected:
void buildCostMatrix(const cv::Mat& descriptors1, const cv::Mat& descriptors2,
cv::Mat& costMatrix, cv::Ptr<cv::HistogramCostExtractor>& comparer) const;
void hungarian(cv::Mat& costMatrix, std::vector<cv::DMatch>& outMatches, std::vector<int> &inliers1,
std::vector<int> &inliers2, int sizeScd1=0, int sizeScd2=0);
};
}