Remove all using directives for STL namespace and members
Made all STL usages explicit to be able automatically find all usages of particular class or function.
This commit is contained in:
@@ -44,8 +44,6 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class CSMatrixGenerator {
|
||||
public:
|
||||
typedef enum { PDT_GAUSS=1, PDT_BERNOULLI, PDT_DBFRIENDLY } PHI_DISTR_TYPE;
|
||||
|
@@ -123,7 +123,7 @@ void CvEM::set_mat_hdrs()
|
||||
int K = emObj.get<int>("nclusters");
|
||||
covsHdrs.resize(K);
|
||||
covsPtrs.resize(K);
|
||||
const std::vector<Mat>& covs = emObj.get<vector<Mat> >("covs");
|
||||
const std::vector<Mat>& covs = emObj.get<std::vector<Mat> >("covs");
|
||||
for(size_t i = 0; i < covsHdrs.size(); i++)
|
||||
{
|
||||
covsHdrs[i] = covs[i];
|
||||
@@ -137,7 +137,7 @@ void CvEM::set_mat_hdrs()
|
||||
static
|
||||
void init_params(const CvEMParams& src,
|
||||
Mat& prbs, Mat& weights,
|
||||
Mat& means, vector<Mat>& covsHdrs)
|
||||
Mat& means, std::vector<Mat>& covsHdrs)
|
||||
{
|
||||
prbs = src.probs;
|
||||
weights = src.weights;
|
||||
@@ -244,9 +244,9 @@ Mat CvEM::getMeans() const
|
||||
return emObj.get<Mat>("means");
|
||||
}
|
||||
|
||||
void CvEM::getCovs(vector<Mat>& _covs) const
|
||||
void CvEM::getCovs(std::vector<Mat>& _covs) const
|
||||
{
|
||||
_covs = emObj.get<vector<Mat> >("covs");
|
||||
_covs = emObj.get<std::vector<Mat> >("covs");
|
||||
}
|
||||
|
||||
Mat CvEM::getWeights() const
|
||||
|
@@ -69,7 +69,7 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
|
||||
Mat img = cvarrToMat(_img), mask;
|
||||
if(_mask)
|
||||
mask = cvarrToMat(_mask);
|
||||
vector<KeyPoint> kpt;
|
||||
std::vector<KeyPoint> kpt;
|
||||
Mat descr;
|
||||
|
||||
Ptr<Feature2D> surf = Algorithm::create<Feature2D>("Feature2D.SURF");
|
||||
@@ -111,7 +111,7 @@ cvGetStarKeypoints( const CvArr* _img, CvMemStorage* storage,
|
||||
params.lineThresholdProjected,
|
||||
params.lineThresholdBinarized,
|
||||
params.suppressNonmaxSize);
|
||||
vector<KeyPoint> kpts;
|
||||
std::vector<KeyPoint> kpts;
|
||||
star->detect(cvarrToMat(_img), kpts, Mat());
|
||||
|
||||
CvSeq* seq = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvStarKeypoint), storage);
|
||||
|
@@ -145,9 +145,9 @@ namespace cv{
|
||||
void readPCAFeatures(const char *filename, CvMat** avg, CvMat** eigenvectors, const char *postfix = "");
|
||||
void readPCAFeatures(const FileNode &fn, CvMat** avg, CvMat** eigenvectors, const char* postfix = "");
|
||||
void savePCAFeatures(FileStorage &fs, const char* postfix, CvMat* avg, CvMat* eigenvectors);
|
||||
void calcPCAFeatures(vector<IplImage*>& patches, FileStorage &fs, const char* postfix, CvMat** avg,
|
||||
void calcPCAFeatures(std::vector<IplImage*>& patches, FileStorage &fs, const char* postfix, CvMat** avg,
|
||||
CvMat** eigenvectors);
|
||||
void loadPCAFeatures(const char* path, const char* images_list, vector<IplImage*>& patches, CvSize patch_size);
|
||||
void loadPCAFeatures(const char* path, const char* images_list, std::vector<IplImage*>& patches, CvSize patch_size);
|
||||
void generatePCAFeatures(const char* path, const char* img_filename, FileStorage& fs, const char* postfix,
|
||||
CvSize patch_size, CvMat** avg, CvMat** eigenvectors);
|
||||
|
||||
@@ -1287,8 +1287,8 @@ namespace cv{
|
||||
|
||||
}
|
||||
|
||||
OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const string &pca_filename,
|
||||
const string &train_path, const string &images_list, float _scale_min, float _scale_max,
|
||||
OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const std::string &pca_filename,
|
||||
const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max,
|
||||
float _scale_step, int pyr_levels,
|
||||
int pca_dim_high, int pca_dim_low)
|
||||
: m_pca_dim_high(pca_dim_high), m_pca_dim_low(pca_dim_low), scale_min(_scale_min), scale_max(_scale_max), scale_step(_scale_step)
|
||||
@@ -1695,7 +1695,7 @@ namespace cv{
|
||||
fs.writeObj(buf, eigenvectors);
|
||||
}
|
||||
|
||||
void calcPCAFeatures(vector<IplImage*>& patches, FileStorage &fs, const char* postfix, CvMat** avg,
|
||||
void calcPCAFeatures(std::vector<IplImage*>& patches, FileStorage &fs, const char* postfix, CvMat** avg,
|
||||
CvMat** eigenvectors)
|
||||
{
|
||||
int width = patches[0]->width;
|
||||
@@ -1732,9 +1732,9 @@ namespace cv{
|
||||
cvReleaseMat(&eigenvalues);
|
||||
}
|
||||
|
||||
static void extractPatches (IplImage *img, vector<IplImage*>& patches, CvSize patch_size)
|
||||
static void extractPatches (IplImage *img, std::vector<IplImage*>& patches, CvSize patch_size)
|
||||
{
|
||||
vector<KeyPoint> features;
|
||||
std::vector<KeyPoint> features;
|
||||
Ptr<FeatureDetector> surf_extractor = FeatureDetector::create("SURF");
|
||||
if( surf_extractor.empty() )
|
||||
CV_Error(CV_StsNotImplemented, "OpenCV was built without SURF support");
|
||||
@@ -1767,7 +1767,7 @@ namespace cv{
|
||||
}
|
||||
|
||||
/*
|
||||
void loadPCAFeatures(const FileNode &fn, vector<IplImage*>& patches, CvSize patch_size)
|
||||
void loadPCAFeatures(const FileNode &fn, std::vector<IplImage*>& patches, CvSize patch_size)
|
||||
{
|
||||
FileNodeIterator begin = fn.begin();
|
||||
for (FileNodeIterator i = fn.begin(); i != fn.end(); i++)
|
||||
@@ -1779,7 +1779,7 @@ namespace cv{
|
||||
}
|
||||
*/
|
||||
|
||||
void loadPCAFeatures(const char* path, const char* images_list, vector<IplImage*>& patches, CvSize patch_size)
|
||||
void loadPCAFeatures(const char* path, const char* images_list, std::vector<IplImage*>& patches, CvSize patch_size)
|
||||
{
|
||||
char images_filename[1024];
|
||||
sprintf(images_filename, "%s/%s", path, images_list);
|
||||
@@ -1819,7 +1819,7 @@ namespace cv{
|
||||
void generatePCAFeatures(const char* path, const char* img_filename, FileStorage& fs, const char* postfix,
|
||||
CvSize patch_size, CvMat** avg, CvMat** eigenvectors)
|
||||
{
|
||||
vector<IplImage*> patches;
|
||||
std::vector<IplImage*> patches;
|
||||
loadPCAFeatures(path, img_filename, patches, patch_size);
|
||||
calcPCAFeatures(patches, fs, postfix, avg, eigenvectors);
|
||||
}
|
||||
@@ -1828,7 +1828,7 @@ namespace cv{
|
||||
void generatePCAFeatures(const FileNode &fn, const char* postfix,
|
||||
CvSize patch_size, CvMat** avg, CvMat** eigenvectors)
|
||||
{
|
||||
vector<IplImage*> patches;
|
||||
std::vector<IplImage*> patches;
|
||||
loadPCAFeatures(fn, patches, patch_size);
|
||||
calcPCAFeatures(patches, fs, postfix, avg, eigenvectors);
|
||||
}
|
||||
@@ -1951,7 +1951,7 @@ namespace cv{
|
||||
}
|
||||
}
|
||||
|
||||
void OneWayDescriptorBase::InitializeDescriptors(IplImage* train_image, const vector<KeyPoint>& features,
|
||||
void OneWayDescriptorBase::InitializeDescriptors(IplImage* train_image, const std::vector<KeyPoint>& features,
|
||||
const char* feature_label, int desc_start_idx)
|
||||
{
|
||||
for(int i = 0; i < (int)features.size(); i++)
|
||||
@@ -2027,7 +2027,7 @@ namespace cv{
|
||||
}
|
||||
|
||||
|
||||
void OneWayDescriptorObject::InitializeObjectDescriptors(IplImage* train_image, const vector<KeyPoint>& features,
|
||||
void OneWayDescriptorObject::InitializeObjectDescriptors(IplImage* train_image, const std::vector<KeyPoint>& features,
|
||||
const char* feature_label, int desc_start_idx, float scale, int is_background)
|
||||
{
|
||||
InitializeDescriptors(train_image, features, feature_label, desc_start_idx);
|
||||
@@ -2080,8 +2080,8 @@ namespace cv{
|
||||
m_part_id = 0;
|
||||
}
|
||||
|
||||
OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const string &pca_filename,
|
||||
const string &train_path, const string &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) :
|
||||
OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const std::string &pca_filename,
|
||||
const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) :
|
||||
OneWayDescriptorBase(patch_size, pose_count, pca_filename, train_path, images_list, _scale_min, _scale_max, _scale_step, pyr_levels)
|
||||
{
|
||||
m_part_id = 0;
|
||||
@@ -2093,9 +2093,9 @@ namespace cv{
|
||||
delete []m_part_id;
|
||||
}
|
||||
|
||||
vector<KeyPoint> OneWayDescriptorObject::_GetLabeledFeatures() const
|
||||
std::vector<KeyPoint> OneWayDescriptorObject::_GetLabeledFeatures() const
|
||||
{
|
||||
vector<KeyPoint> features;
|
||||
std::vector<KeyPoint> features;
|
||||
for(size_t i = 0; i < m_train_features.size(); i++)
|
||||
{
|
||||
features.push_back(m_train_features[i]);
|
||||
@@ -2166,8 +2166,8 @@ namespace cv{
|
||||
* OneWayDescriptorMatcher *
|
||||
\****************************************************************************************/
|
||||
|
||||
OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, string _pcaFilename,
|
||||
string _trainPath, string _trainImagesList,
|
||||
OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, std::string _pcaFilename,
|
||||
std::string _trainPath, std::string _trainImagesList,
|
||||
float _minScale, float _maxScale, float _stepScale ) :
|
||||
poseCount(_poseCount), patchSize(_patchSize), pcaFilename(_pcaFilename),
|
||||
trainPath(_trainPath), trainImagesList(_trainImagesList),
|
||||
@@ -2212,7 +2212,7 @@ namespace cv{
|
||||
base->Allocate( (int)trainPointCollection.keypointCount() );
|
||||
prevTrainCount = (int)trainPointCollection.keypointCount();
|
||||
|
||||
const vector<vector<KeyPoint> >& points = trainPointCollection.getKeypoints();
|
||||
const std::vector<std::vector<KeyPoint> >& points = trainPointCollection.getKeypoints();
|
||||
int count = 0;
|
||||
for( size_t i = 0; i < points.size(); i++ )
|
||||
{
|
||||
@@ -2232,9 +2232,9 @@ namespace cv{
|
||||
return false;
|
||||
}
|
||||
|
||||
void OneWayDescriptorMatcher::knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
|
||||
vector<vector<DMatch> >& matches, int knn,
|
||||
const vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
void OneWayDescriptorMatcher::knnMatchImpl( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
const std::vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
{
|
||||
train();
|
||||
|
||||
@@ -2251,9 +2251,9 @@ namespace cv{
|
||||
}
|
||||
}
|
||||
|
||||
void OneWayDescriptorMatcher::radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
|
||||
vector<vector<DMatch> >& matches, float maxDistance,
|
||||
const vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
void OneWayDescriptorMatcher::radiusMatchImpl( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
const std::vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
{
|
||||
train();
|
||||
|
||||
@@ -2271,7 +2271,7 @@ namespace cv{
|
||||
|
||||
void OneWayDescriptorMatcher::read( const FileNode &fn )
|
||||
{
|
||||
base = new OneWayDescriptorObject( params.patchSize, params.poseCount, string (), string (), string (),
|
||||
base = new OneWayDescriptorObject( params.patchSize, params.poseCount, std::string (), std::string (), std::string (),
|
||||
params.minScale, params.maxScale, params.stepScale );
|
||||
base->Read (fn);
|
||||
}
|
||||
|
@@ -99,7 +99,7 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
|
||||
const int BIG_DIFF=128;
|
||||
|
||||
// scanning scheme coordinates
|
||||
cv::vector<CvPoint> _ss((2 * maxRange.width + 1) * (2 * maxRange.height + 1));
|
||||
std::vector<CvPoint> _ss((2 * maxRange.width + 1) * (2 * maxRange.height + 1));
|
||||
CvPoint* ss = &_ss[0];
|
||||
int ss_count = 0;
|
||||
|
||||
@@ -110,7 +110,7 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
|
||||
|
||||
int i, j;
|
||||
|
||||
cv::vector<uchar> _blockA(cvAlign(blSize + 16, 16));
|
||||
std::vector<uchar> _blockA(cvAlign(blSize + 16, 16));
|
||||
uchar* blockA = (uchar*)cvAlignPtr(&_blockA[0], 16);
|
||||
|
||||
// Calculate scanning scheme
|
||||
|
@@ -253,7 +253,7 @@ LDetector::LDetector(int _radius, int _threshold, int _nOctaves, int _nViews,
|
||||
{
|
||||
}
|
||||
|
||||
static void getDiscreteCircle(int R, vector<Point>& circle, vector<int>& filledHCircle)
|
||||
static void getDiscreteCircle(int R, std::vector<Point>& circle, std::vector<int>& filledHCircle)
|
||||
{
|
||||
int x = R, y = 0;
|
||||
for( ;;y++ )
|
||||
@@ -310,7 +310,7 @@ struct CmpKeypointScores
|
||||
};
|
||||
|
||||
|
||||
void LDetector::getMostStable2D(const Mat& image, vector<KeyPoint>& keypoints,
|
||||
void LDetector::getMostStable2D(const Mat& image, std::vector<KeyPoint>& keypoints,
|
||||
int maxPoints, const PatchGenerator& _patchGenerator) const
|
||||
{
|
||||
PatchGenerator patchGenerator = _patchGenerator;
|
||||
@@ -321,7 +321,7 @@ void LDetector::getMostStable2D(const Mat& image, vector<KeyPoint>& keypoints,
|
||||
double *M = (double*)matM.data, *iM = (double*)_iM.data;
|
||||
RNG& rng = theRNG();
|
||||
int i, k;
|
||||
vector<KeyPoint> tempKeypoints;
|
||||
std::vector<KeyPoint> tempKeypoints;
|
||||
double d2 = clusteringDistance*clusteringDistance;
|
||||
keypoints.clear();
|
||||
|
||||
@@ -427,21 +427,21 @@ static Point2f adjustCorner(const float* fval, float& fvaln)
|
||||
return Point2f((float)dx, (float)dy);
|
||||
}
|
||||
|
||||
void LDetector::operator()(const Mat& image, vector<KeyPoint>& keypoints, int maxCount, bool scaleCoords) const
|
||||
void LDetector::operator()(const Mat& image, std::vector<KeyPoint>& keypoints, int maxCount, bool scaleCoords) const
|
||||
{
|
||||
vector<Mat> pyr;
|
||||
std::vector<Mat> pyr;
|
||||
buildPyramid(image, pyr, std::max(nOctaves-1, 0));
|
||||
(*this)(pyr, keypoints, maxCount, scaleCoords);
|
||||
}
|
||||
|
||||
void LDetector::operator()(const vector<Mat>& pyr, vector<KeyPoint>& keypoints, int maxCount, bool scaleCoords) const
|
||||
void LDetector::operator()(const std::vector<Mat>& pyr, std::vector<KeyPoint>& keypoints, int maxCount, bool scaleCoords) const
|
||||
{
|
||||
const int lthreshold = 3;
|
||||
int L, x, y, i, j, k, tau = lthreshold;
|
||||
Mat scoreBuf(pyr[0].size(), CV_16S), maskBuf(pyr[0].size(), CV_8U);
|
||||
int scoreElSize = (int)scoreBuf.elemSize();
|
||||
vector<Point> circle0;
|
||||
vector<int> fhcircle0, circle, fcircle_s, fcircle;
|
||||
std::vector<Point> circle0;
|
||||
std::vector<int> fhcircle0, circle, fcircle_s, fcircle;
|
||||
getDiscreteCircle(radius, circle0, fhcircle0);
|
||||
CV_Assert(fhcircle0.size() == (size_t)(radius+1) && circle0.size() % 2 == 0);
|
||||
keypoints.clear();
|
||||
@@ -617,7 +617,7 @@ void LDetector::read(const FileNode& objnode)
|
||||
clusteringDistance = (int)objnode["clustering-distance"];
|
||||
}
|
||||
|
||||
void LDetector::write(FileStorage& fs, const String& name) const
|
||||
void LDetector::write(FileStorage& fs, const std::string& name) const
|
||||
{
|
||||
WriteStructContext ws(fs, name, CV_NODE_MAP);
|
||||
|
||||
@@ -691,9 +691,9 @@ Size FernClassifier::getPatchSize() const
|
||||
}
|
||||
|
||||
|
||||
FernClassifier::FernClassifier(const vector<vector<Point2f> >& points,
|
||||
const vector<Mat>& refimgs,
|
||||
const vector<vector<int> >& labels,
|
||||
FernClassifier::FernClassifier(const std::vector<std::vector<Point2f> >& points,
|
||||
const std::vector<Mat>& refimgs,
|
||||
const std::vector<std::vector<int> >& labels,
|
||||
int _nclasses, int _patchSize,
|
||||
int _signatureSize, int _nstructs,
|
||||
int _structSize, int _nviews, int _compressionMethod,
|
||||
@@ -707,7 +707,7 @@ FernClassifier::FernClassifier(const vector<vector<Point2f> >& points,
|
||||
}
|
||||
|
||||
|
||||
void FernClassifier::write(FileStorage& fs, const String& objname) const
|
||||
void FernClassifier::write(FileStorage& fs, const std::string& objname) const
|
||||
{
|
||||
WriteStructContext ws(fs, objname, CV_NODE_MAP);
|
||||
|
||||
@@ -767,8 +767,8 @@ void FernClassifier::read(const FileNode& objnode)
|
||||
void FernClassifier::clear()
|
||||
{
|
||||
signatureSize = nclasses = nstructs = structSize = compressionMethod = leavesPerStruct = 0;
|
||||
vector<Feature>().swap(features);
|
||||
vector<float>().swap(posteriors);
|
||||
std::vector<Feature>().swap(features);
|
||||
std::vector<float>().swap(posteriors);
|
||||
}
|
||||
|
||||
bool FernClassifier::empty() const
|
||||
@@ -815,9 +815,9 @@ void FernClassifier::prepare(int _nclasses, int _patchSize, int _signatureSize,
|
||||
|
||||
int i, nfeatures = structSize*nstructs;
|
||||
|
||||
features = vector<Feature>( nfeatures );
|
||||
posteriors = vector<float>( leavesPerStruct*nstructs*nclasses, 1.f );
|
||||
classCounters = vector<int>( nclasses, leavesPerStruct );
|
||||
features = std::vector<Feature>( nfeatures );
|
||||
posteriors = std::vector<float>( leavesPerStruct*nstructs*nclasses, 1.f );
|
||||
classCounters = std::vector<int>( nclasses, leavesPerStruct );
|
||||
|
||||
CV_Assert( patchSize.width <= 256 && patchSize.height <= 256 );
|
||||
RNG& rng = theRNG();
|
||||
@@ -832,7 +832,7 @@ void FernClassifier::prepare(int _nclasses, int _patchSize, int _signatureSize,
|
||||
}
|
||||
}
|
||||
|
||||
static int calcNumPoints( const vector<vector<Point2f> >& points )
|
||||
static int calcNumPoints( const std::vector<std::vector<Point2f> >& points )
|
||||
{
|
||||
size_t count = 0;
|
||||
for( size_t i = 0; i < points.size(); i++ )
|
||||
@@ -840,9 +840,9 @@ static int calcNumPoints( const vector<vector<Point2f> >& points )
|
||||
return (int)count;
|
||||
}
|
||||
|
||||
void FernClassifier::train(const vector<vector<Point2f> >& points,
|
||||
const vector<Mat>& refimgs,
|
||||
const vector<vector<int> >& labels,
|
||||
void FernClassifier::train(const std::vector<std::vector<Point2f> >& points,
|
||||
const std::vector<Mat>& refimgs,
|
||||
const std::vector<std::vector<int> >& labels,
|
||||
int _nclasses, int _patchSize,
|
||||
int _signatureSize, int _nstructs,
|
||||
int _structSize, int _nviews, int _compressionMethod,
|
||||
@@ -892,7 +892,7 @@ void FernClassifier::train(const vector<vector<Point2f> >& points,
|
||||
|
||||
|
||||
void FernClassifier::trainFromSingleView(const Mat& image,
|
||||
const vector<KeyPoint>& keypoints,
|
||||
const std::vector<KeyPoint>& keypoints,
|
||||
int _patchSize, int _signatureSize,
|
||||
int _nstructs, int _structSize,
|
||||
int _nviews, int _compressionMethod,
|
||||
@@ -911,7 +911,7 @@ void FernClassifier::trainFromSingleView(const Mat& image,
|
||||
Mat canvas(cvRound(std::max(image.cols,image.rows)*maxScale + patchSize.width*2 + 10),
|
||||
cvRound(std::max(image.cols,image.rows)*maxScale + patchSize.width*2 + 10), image.type());
|
||||
Mat noisebuf;
|
||||
vector<Mat> pyrbuf(maxOctave+1), pyr(maxOctave+1);
|
||||
std::vector<Mat> pyrbuf(maxOctave+1), pyr(maxOctave+1);
|
||||
Point2f center0((image.cols-1)*0.5f, (image.rows-1)*0.5f),
|
||||
center1((canvas.cols - 1)*0.5f, (canvas.rows - 1)*0.5f);
|
||||
Mat matM(2, 3, CV_64F);
|
||||
@@ -997,7 +997,7 @@ void FernClassifier::trainFromSingleView(const Mat& image,
|
||||
}
|
||||
|
||||
|
||||
int FernClassifier::operator()(const Mat& img, Point2f pt, vector<float>& signature) const
|
||||
int FernClassifier::operator()(const Mat& img, Point2f pt, std::vector<float>& signature) const
|
||||
{
|
||||
Mat patch;
|
||||
getRectSubPix(img, patchSize, pt, patch, img.type());
|
||||
@@ -1005,7 +1005,7 @@ int FernClassifier::operator()(const Mat& img, Point2f pt, vector<float>& signat
|
||||
}
|
||||
|
||||
|
||||
int FernClassifier::operator()(const Mat& patch, vector<float>& signature) const
|
||||
int FernClassifier::operator()(const Mat& patch, std::vector<float>& signature) const
|
||||
{
|
||||
if( posteriors.empty() )
|
||||
CV_Error(CV_StsNullPtr,
|
||||
@@ -1051,7 +1051,7 @@ int FernClassifier::operator()(const Mat& patch, vector<float>& signature) const
|
||||
void FernClassifier::finalize(RNG&)
|
||||
{
|
||||
int i, j, k, n = nclasses;
|
||||
vector<double> invClassCounters(n);
|
||||
std::vector<double> invClassCounters(n);
|
||||
Mat_<double> _temp(1, n);
|
||||
double* temp = &_temp(0,0);
|
||||
|
||||
@@ -1093,7 +1093,7 @@ void FernClassifier::finalize(RNG&)
|
||||
csmatrix.create(m, n);
|
||||
rng.fill(csmatrix, RNG::UNIFORM, Scalar::all(0), Scalar::all(2));
|
||||
}
|
||||
vector<float> dst(m);
|
||||
std::vector<float> dst(m);
|
||||
|
||||
for( i = 0; i < totalLeaves; i++ )
|
||||
{
|
||||
@@ -1228,7 +1228,7 @@ nstructs(_nstructs), structSize(_structSize), nviews(_nviews),
|
||||
compressionMethod(_compressionMethod), patchGenerator(_patchGenerator)
|
||||
{}
|
||||
|
||||
FernDescriptorMatcher::Params::Params( const string& _filename )
|
||||
FernDescriptorMatcher::Params::Params( const std::string& _filename )
|
||||
{
|
||||
filename = _filename;
|
||||
}
|
||||
@@ -1263,11 +1263,11 @@ void FernDescriptorMatcher::train()
|
||||
{
|
||||
assert( params.filename.empty() );
|
||||
|
||||
vector<vector<Point2f> > points( trainPointCollection.imageCount() );
|
||||
std::vector<std::vector<Point2f> > points( trainPointCollection.imageCount() );
|
||||
for( size_t imgIdx = 0; imgIdx < trainPointCollection.imageCount(); imgIdx++ )
|
||||
KeyPoint::convert( trainPointCollection.getKeypoints((int)imgIdx), points[imgIdx] );
|
||||
|
||||
classifier = new FernClassifier( points, trainPointCollection.getImages(), vector<vector<int> >(), 0, // each points is a class
|
||||
classifier = new FernClassifier( points, trainPointCollection.getImages(), std::vector<std::vector<int> >(), 0, // each points is a class
|
||||
params.patchSize, params.signatureSize, params.nstructs, params.structSize,
|
||||
params.nviews, params.compressionMethod, params.patchGenerator );
|
||||
}
|
||||
@@ -1279,7 +1279,7 @@ bool FernDescriptorMatcher::isMaskSupported()
|
||||
}
|
||||
|
||||
void FernDescriptorMatcher::calcBestProbAndMatchIdx( const Mat& image, const Point2f& pt,
|
||||
float& bestProb, int& bestMatchIdx, vector<float>& signature )
|
||||
float& bestProb, int& bestMatchIdx, std::vector<float>& signature )
|
||||
{
|
||||
(*classifier)( image, pt, signature);
|
||||
|
||||
@@ -1295,14 +1295,14 @@ void FernDescriptorMatcher::calcBestProbAndMatchIdx( const Mat& image, const Poi
|
||||
}
|
||||
}
|
||||
|
||||
void FernDescriptorMatcher::knnMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
|
||||
vector<vector<DMatch> >& matches, int knn,
|
||||
const vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
void FernDescriptorMatcher::knnMatchImpl( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, int knn,
|
||||
const std::vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
{
|
||||
train();
|
||||
|
||||
matches.resize( queryKeypoints.size() );
|
||||
vector<float> signature( (size_t)classifier->getClassCount() );
|
||||
std::vector<float> signature( (size_t)classifier->getClassCount() );
|
||||
|
||||
for( size_t queryIdx = 0; queryIdx < queryKeypoints.size(); queryIdx++ )
|
||||
{
|
||||
@@ -1331,13 +1331,13 @@ void FernDescriptorMatcher::knnMatchImpl( const Mat& queryImage, vector<KeyPoint
|
||||
}
|
||||
}
|
||||
|
||||
void FernDescriptorMatcher::radiusMatchImpl( const Mat& queryImage, vector<KeyPoint>& queryKeypoints,
|
||||
vector<vector<DMatch> >& matches, float maxDistance,
|
||||
const vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
void FernDescriptorMatcher::radiusMatchImpl( const Mat& queryImage, std::vector<KeyPoint>& queryKeypoints,
|
||||
std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
||||
const std::vector<Mat>& /*masks*/, bool /*compactResult*/ )
|
||||
{
|
||||
train();
|
||||
matches.resize( queryKeypoints.size() );
|
||||
vector<float> signature( (size_t)classifier->getClassCount() );
|
||||
std::vector<float> signature( (size_t)classifier->getClassCount() );
|
||||
|
||||
for( size_t i = 0; i < queryKeypoints.size(); i++ )
|
||||
{
|
||||
@@ -1413,7 +1413,7 @@ PlanarObjectDetector::PlanarObjectDetector(const FileNode& node)
|
||||
read(node);
|
||||
}
|
||||
|
||||
PlanarObjectDetector::PlanarObjectDetector(const vector<Mat>& pyr, int npoints,
|
||||
PlanarObjectDetector::PlanarObjectDetector(const std::vector<Mat>& pyr, int npoints,
|
||||
int patchSize, int nstructs, int structSize,
|
||||
int nviews, const LDetector& detector,
|
||||
const PatchGenerator& patchGenerator)
|
||||
@@ -1426,12 +1426,12 @@ PlanarObjectDetector::~PlanarObjectDetector()
|
||||
{
|
||||
}
|
||||
|
||||
vector<KeyPoint> PlanarObjectDetector::getModelPoints() const
|
||||
std::vector<KeyPoint> PlanarObjectDetector::getModelPoints() const
|
||||
{
|
||||
return modelPoints;
|
||||
}
|
||||
|
||||
void PlanarObjectDetector::train(const vector<Mat>& pyr, int npoints,
|
||||
void PlanarObjectDetector::train(const std::vector<Mat>& pyr, int npoints,
|
||||
int patchSize, int nstructs, int structSize,
|
||||
int nviews, const LDetector& detector,
|
||||
const PatchGenerator& patchGenerator)
|
||||
@@ -1448,7 +1448,7 @@ void PlanarObjectDetector::train(const vector<Mat>& pyr, int npoints,
|
||||
FernClassifier::COMPRESSION_NONE, patchGenerator);
|
||||
}
|
||||
|
||||
void PlanarObjectDetector::train(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
|
||||
void PlanarObjectDetector::train(const std::vector<Mat>& pyr, const std::vector<KeyPoint>& keypoints,
|
||||
int patchSize, int nstructs, int structSize,
|
||||
int nviews, const LDetector& detector,
|
||||
const PatchGenerator& patchGenerator)
|
||||
@@ -1476,7 +1476,7 @@ void PlanarObjectDetector::read(const FileNode& node)
|
||||
}
|
||||
|
||||
|
||||
void PlanarObjectDetector::write(FileStorage& fs, const String& objname) const
|
||||
void PlanarObjectDetector::write(FileStorage& fs, const std::string& objname) const
|
||||
{
|
||||
WriteStructContext ws(fs, objname, CV_NODE_MAP);
|
||||
|
||||
@@ -1493,24 +1493,24 @@ void PlanarObjectDetector::write(FileStorage& fs, const String& objname) const
|
||||
}
|
||||
|
||||
|
||||
bool PlanarObjectDetector::operator()(const Mat& image, Mat& H, vector<Point2f>& corners) const
|
||||
bool PlanarObjectDetector::operator()(const Mat& image, Mat& H, std::vector<Point2f>& corners) const
|
||||
{
|
||||
vector<Mat> pyr;
|
||||
std::vector<Mat> pyr;
|
||||
buildPyramid(image, pyr, ldetector.nOctaves - 1);
|
||||
vector<KeyPoint> keypoints;
|
||||
std::vector<KeyPoint> keypoints;
|
||||
ldetector(pyr, keypoints);
|
||||
|
||||
return (*this)(pyr, keypoints, H, corners);
|
||||
}
|
||||
|
||||
bool PlanarObjectDetector::operator()(const vector<Mat>& pyr, const vector<KeyPoint>& keypoints,
|
||||
Mat& matH, vector<Point2f>& corners, vector<int>* pairs) const
|
||||
bool PlanarObjectDetector::operator()(const std::vector<Mat>& pyr, const std::vector<KeyPoint>& keypoints,
|
||||
Mat& matH, std::vector<Point2f>& corners, std::vector<int>* pairs) const
|
||||
{
|
||||
int i, j, m = (int)modelPoints.size(), n = (int)keypoints.size();
|
||||
vector<int> bestMatches(m, -1);
|
||||
vector<float> maxLogProb(m, -FLT_MAX);
|
||||
vector<float> signature;
|
||||
vector<Point2f> fromPt, toPt;
|
||||
std::vector<int> bestMatches(m, -1);
|
||||
std::vector<float> maxLogProb(m, -FLT_MAX);
|
||||
std::vector<float> signature;
|
||||
std::vector<Point2f> fromPt, toPt;
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
@@ -1539,7 +1539,7 @@ bool PlanarObjectDetector::operator()(const vector<Mat>& pyr, const vector<KeyPo
|
||||
if( fromPt.size() < 4 )
|
||||
return false;
|
||||
|
||||
vector<uchar> mask;
|
||||
std::vector<uchar> mask;
|
||||
matH = findHomography(fromPt, toPt, RANSAC, 10, mask);
|
||||
if( matH.data )
|
||||
{
|
||||
|
@@ -41,8 +41,6 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#undef INFINITY
|
||||
#define INFINITY 10000
|
||||
#define OCCLUSION_PENALTY 10000
|
||||
|
Reference in New Issue
Block a user