Drop cv:: prefix from cv::String used inside the cv namespace
This commit is contained in:
@@ -307,24 +307,24 @@ public:
|
||||
};
|
||||
|
||||
LatentSvmDetector();
|
||||
LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::String>& classNames=std::vector<cv::String>() );
|
||||
LatentSvmDetector( const std::vector<String>& filenames, const std::vector<String>& classNames=std::vector<String>() );
|
||||
virtual ~LatentSvmDetector();
|
||||
|
||||
virtual void clear();
|
||||
virtual bool empty() const;
|
||||
bool load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& classNames=std::vector<cv::String>() );
|
||||
bool load( const std::vector<String>& filenames, const std::vector<String>& classNames=std::vector<String>() );
|
||||
|
||||
virtual void detect( const Mat& image,
|
||||
std::vector<ObjectDetection>& objectDetections,
|
||||
float overlapThreshold=0.5f,
|
||||
int numThreads=-1 );
|
||||
|
||||
const std::vector<cv::String>& getClassNames() const;
|
||||
const std::vector<String>& getClassNames() const;
|
||||
size_t getClassCount() const;
|
||||
|
||||
private:
|
||||
std::vector<CvLatentSvmDetector*> detectors;
|
||||
std::vector<cv::String> classNames;
|
||||
std::vector<String> classNames;
|
||||
};
|
||||
|
||||
CV_EXPORTS void groupRectangles(CV_OUT CV_IN_OUT std::vector<Rect>& rectList, int groupThreshold, double eps=0.2);
|
||||
@@ -369,11 +369,11 @@ class CV_EXPORTS_W CascadeClassifier
|
||||
{
|
||||
public:
|
||||
CV_WRAP CascadeClassifier();
|
||||
CV_WRAP CascadeClassifier( const cv::String& filename );
|
||||
CV_WRAP CascadeClassifier( const String& filename );
|
||||
virtual ~CascadeClassifier();
|
||||
|
||||
CV_WRAP virtual bool empty() const;
|
||||
CV_WRAP bool load( const cv::String& filename );
|
||||
CV_WRAP bool load( const String& filename );
|
||||
virtual bool read( const FileNode& node );
|
||||
CV_WRAP virtual void detectMultiScale( const Mat& image,
|
||||
CV_OUT std::vector<Rect>& objects,
|
||||
@@ -524,7 +524,7 @@ public:
|
||||
gammaCorrection(_gammaCorrection), nlevels(_nlevels)
|
||||
{}
|
||||
|
||||
CV_WRAP HOGDescriptor(const cv::String& filename)
|
||||
CV_WRAP HOGDescriptor(const String& filename)
|
||||
{
|
||||
load(filename);
|
||||
}
|
||||
@@ -543,10 +543,10 @@ public:
|
||||
CV_WRAP virtual void setSVMDetector(InputArray _svmdetector);
|
||||
|
||||
virtual bool read(FileNode& fn);
|
||||
virtual void write(FileStorage& fs, const cv::String& objname) const;
|
||||
virtual void write(FileStorage& fs, const String& objname) const;
|
||||
|
||||
CV_WRAP virtual bool load(const cv::String& filename, const cv::String& objname=cv::String());
|
||||
CV_WRAP virtual void save(const cv::String& filename, const cv::String& objname=cv::String()) const;
|
||||
CV_WRAP virtual bool load(const String& filename, const String& objname=String());
|
||||
CV_WRAP virtual void save(const String& filename, const String& objname=String()) const;
|
||||
virtual void copyTo(HOGDescriptor& c) const;
|
||||
|
||||
CV_WRAP virtual void compute(const Mat& img,
|
||||
@@ -609,16 +609,16 @@ public:
|
||||
int groupThreshold = 0) const;
|
||||
|
||||
// read/parse Dalal's alt model file
|
||||
void readALTModel(cv::String modelfile);
|
||||
void readALTModel(String modelfile);
|
||||
};
|
||||
|
||||
|
||||
CV_EXPORTS_W void findDataMatrix(InputArray image,
|
||||
CV_OUT std::vector<cv::String>& codes,
|
||||
CV_OUT std::vector<String>& codes,
|
||||
OutputArray corners=noArray(),
|
||||
OutputArrayOfArrays dmtx=noArray());
|
||||
CV_EXPORTS_W void drawDataMatrixCodes(InputOutputArray image,
|
||||
const std::vector<cv::String>& codes,
|
||||
const std::vector<String>& codes,
|
||||
InputArray corners);
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ public:
|
||||
return processImpl(src, mask);
|
||||
}
|
||||
|
||||
virtual cv::String name() const =0;
|
||||
virtual String name() const =0;
|
||||
|
||||
virtual void read(const FileNode& fn) =0;
|
||||
virtual void write(FileStorage& fs) const =0;
|
||||
@@ -770,7 +770,7 @@ public:
|
||||
* - "ColorGradient"
|
||||
* - "DepthNormal"
|
||||
*/
|
||||
static Ptr<Modality> create(const cv::String& modality_type);
|
||||
static Ptr<Modality> create(const String& modality_type);
|
||||
|
||||
/**
|
||||
* \brief Load a modality from file.
|
||||
@@ -804,7 +804,7 @@ public:
|
||||
*/
|
||||
ColorGradient(float weak_threshold, size_t num_features, float strong_threshold);
|
||||
|
||||
virtual cv::String name() const;
|
||||
virtual String name() const;
|
||||
|
||||
virtual void read(const FileNode& fn);
|
||||
virtual void write(FileStorage& fs) const;
|
||||
@@ -842,7 +842,7 @@ public:
|
||||
DepthNormal(int distance_threshold, int difference_threshold, size_t num_features,
|
||||
int extract_threshold);
|
||||
|
||||
virtual cv::String name() const;
|
||||
virtual String name() const;
|
||||
|
||||
virtual void read(const FileNode& fn);
|
||||
virtual void write(FileStorage& fs) const;
|
||||
@@ -871,7 +871,7 @@ struct CV_EXPORTS Match
|
||||
{
|
||||
}
|
||||
|
||||
Match(int x, int y, float similarity, const cv::String& class_id, int template_id);
|
||||
Match(int x, int y, float similarity, const String& class_id, int template_id);
|
||||
|
||||
/// Sort matches with high similarity to the front
|
||||
bool operator<(const Match& rhs) const
|
||||
@@ -891,11 +891,11 @@ struct CV_EXPORTS Match
|
||||
int x;
|
||||
int y;
|
||||
float similarity;
|
||||
cv::String class_id;
|
||||
String class_id;
|
||||
int template_id;
|
||||
};
|
||||
|
||||
inline Match::Match(int _x, int _y, float _similarity, const cv::String& _class_id, int _template_id)
|
||||
inline Match::Match(int _x, int _y, float _similarity, const String& _class_id, int _template_id)
|
||||
: x(_x), y(_y), similarity(_similarity), class_id(_class_id), template_id(_template_id)
|
||||
{
|
||||
}
|
||||
@@ -937,7 +937,7 @@ public:
|
||||
* empty or the same size as its corresponding source.
|
||||
*/
|
||||
void match(const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches,
|
||||
const std::vector<cv::String>& class_ids = std::vector<cv::String>(),
|
||||
const std::vector<String>& class_ids = std::vector<String>(),
|
||||
OutputArrayOfArrays quantized_images = noArray(),
|
||||
const std::vector<Mat>& masks = std::vector<Mat>()) const;
|
||||
|
||||
@@ -951,13 +951,13 @@ public:
|
||||
*
|
||||
* \return Template ID, or -1 if failed to extract a valid template.
|
||||
*/
|
||||
int addTemplate(const std::vector<Mat>& sources, const cv::String& class_id,
|
||||
int addTemplate(const std::vector<Mat>& sources, const String& class_id,
|
||||
const Mat& object_mask, Rect* bounding_box = NULL);
|
||||
|
||||
/**
|
||||
* \brief Add a new object template computed by external means.
|
||||
*/
|
||||
int addSyntheticTemplate(const std::vector<Template>& templates, const cv::String& class_id);
|
||||
int addSyntheticTemplate(const std::vector<Template>& templates, const String& class_id);
|
||||
|
||||
/**
|
||||
* \brief Get the modalities used by this detector.
|
||||
@@ -983,23 +983,23 @@ public:
|
||||
* For example, with 2 modalities (Gradient, Normal) and two pyramid levels
|
||||
* (L0, L1), the order is (GradientL0, NormalL0, GradientL1, NormalL1).
|
||||
*/
|
||||
const std::vector<Template>& getTemplates(const cv::String& class_id, int template_id) const;
|
||||
const std::vector<Template>& getTemplates(const String& class_id, int template_id) const;
|
||||
|
||||
int numTemplates() const;
|
||||
int numTemplates(const cv::String& class_id) const;
|
||||
int numTemplates(const String& class_id) const;
|
||||
int numClasses() const { return static_cast<int>(class_templates.size()); }
|
||||
|
||||
std::vector<cv::String> classIds() const;
|
||||
std::vector<String> classIds() const;
|
||||
|
||||
void read(const FileNode& fn);
|
||||
void write(FileStorage& fs) const;
|
||||
|
||||
cv::String readClass(const FileNode& fn, const cv::String &class_id_override = "");
|
||||
void writeClass(const cv::String& class_id, FileStorage& fs) const;
|
||||
String readClass(const FileNode& fn, const String &class_id_override = "");
|
||||
void writeClass(const String& class_id, FileStorage& fs) const;
|
||||
|
||||
void readClasses(const std::vector<cv::String>& class_ids,
|
||||
const cv::String& format = "templates_%s.yml.gz");
|
||||
void writeClasses(const cv::String& format = "templates_%s.yml.gz") const;
|
||||
void readClasses(const std::vector<String>& class_ids,
|
||||
const String& format = "templates_%s.yml.gz");
|
||||
void writeClasses(const String& format = "templates_%s.yml.gz") const;
|
||||
|
||||
protected:
|
||||
std::vector< Ptr<Modality> > modalities;
|
||||
@@ -1007,7 +1007,7 @@ protected:
|
||||
std::vector<int> T_at_level;
|
||||
|
||||
typedef std::vector<Template> TemplatePyramid;
|
||||
typedef std::map<cv::String, std::vector<TemplatePyramid> > TemplatesMap;
|
||||
typedef std::map<String, std::vector<TemplatePyramid> > TemplatesMap;
|
||||
TemplatesMap class_templates;
|
||||
|
||||
typedef std::vector<Mat> LinearMemories;
|
||||
@@ -1017,7 +1017,7 @@ protected:
|
||||
void matchClass(const LinearMemoryPyramid& lm_pyramid,
|
||||
const std::vector<Size>& sizes,
|
||||
float threshold, std::vector<Match>& matches,
|
||||
const cv::String& class_id,
|
||||
const String& class_id,
|
||||
const std::vector<TemplatePyramid>& template_pyramids) const;
|
||||
};
|
||||
|
||||
|
@@ -852,7 +852,7 @@ CascadeClassifier::CascadeClassifier()
|
||||
{
|
||||
}
|
||||
|
||||
CascadeClassifier::CascadeClassifier(const cv::String& filename)
|
||||
CascadeClassifier::CascadeClassifier(const String& filename)
|
||||
{
|
||||
load(filename);
|
||||
}
|
||||
@@ -866,7 +866,7 @@ bool CascadeClassifier::empty() const
|
||||
return oldCascade.empty() && data.stages.empty();
|
||||
}
|
||||
|
||||
bool CascadeClassifier::load(const cv::String& filename)
|
||||
bool CascadeClassifier::load(const String& filename)
|
||||
{
|
||||
oldCascade.release();
|
||||
data = Data();
|
||||
@@ -1207,13 +1207,13 @@ bool CascadeClassifier::Data::read(const FileNode &root)
|
||||
static const float THRESHOLD_EPS = 1e-5f;
|
||||
|
||||
// load stage params
|
||||
cv::String stageTypeStr = (cv::String)root[CC_STAGE_TYPE];
|
||||
String stageTypeStr = (String)root[CC_STAGE_TYPE];
|
||||
if( stageTypeStr == CC_BOOST )
|
||||
stageType = BOOST;
|
||||
else
|
||||
return false;
|
||||
|
||||
cv::String featureTypeStr = (cv::String)root[CC_FEATURE_TYPE];
|
||||
String featureTypeStr = (String)root[CC_FEATURE_TYPE];
|
||||
if( featureTypeStr == CC_HAAR )
|
||||
featureType = FeatureEvaluator::HAAR;
|
||||
else if( featureTypeStr == CC_LBP )
|
||||
|
@@ -489,7 +489,7 @@ namespace cv
|
||||
{
|
||||
|
||||
void findDataMatrix(InputArray _image,
|
||||
std::vector<cv::String>& codes,
|
||||
std::vector<String>& codes,
|
||||
OutputArray _corners,
|
||||
OutputArrayOfArrays _dmtx)
|
||||
{
|
||||
@@ -513,7 +513,7 @@ void findDataMatrix(InputArray _image,
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
CvDataMatrixCode& rc_i = rc[i];
|
||||
codes[i] = cv::String(rc_i.msg);
|
||||
codes[i] = String(rc_i.msg);
|
||||
|
||||
if( corners.data )
|
||||
{
|
||||
@@ -535,7 +535,7 @@ void findDataMatrix(InputArray _image,
|
||||
}
|
||||
|
||||
void drawDataMatrixCodes(InputOutputArray _image,
|
||||
const std::vector<cv::String>& codes,
|
||||
const std::vector<String>& codes,
|
||||
InputArray _corners)
|
||||
{
|
||||
Mat image = _image.getMat();
|
||||
|
@@ -121,7 +121,7 @@ bool HOGDescriptor::read(FileNode& obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
void HOGDescriptor::write(FileStorage& fs, const cv::String& objName) const
|
||||
void HOGDescriptor::write(FileStorage& fs, const String& objName) const
|
||||
{
|
||||
if( !objName.empty() )
|
||||
fs << objName;
|
||||
@@ -143,14 +143,14 @@ void HOGDescriptor::write(FileStorage& fs, const cv::String& objName) const
|
||||
fs << "}";
|
||||
}
|
||||
|
||||
bool HOGDescriptor::load(const cv::String& filename, const cv::String& objname)
|
||||
bool HOGDescriptor::load(const String& filename, const String& objname)
|
||||
{
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
FileNode obj = !objname.empty() ? fs[objname] : fs.getFirstTopLevelNode();
|
||||
return read(obj);
|
||||
}
|
||||
|
||||
void HOGDescriptor::save(const cv::String& filename, const cv::String& objName) const
|
||||
void HOGDescriptor::save(const String& filename, const String& objName) const
|
||||
{
|
||||
FileStorage fs(filename, FileStorage::WRITE);
|
||||
write(fs, !objName.empty() ? objName : FileStorage::getDefaultObjectName(filename));
|
||||
@@ -2788,29 +2788,29 @@ void HOGDescriptor::detectMultiScaleROI(const cv::Mat& img,
|
||||
cv::groupRectangles(foundLocations, groupThreshold, 0.2);
|
||||
}
|
||||
|
||||
void HOGDescriptor::readALTModel(cv::String modelfile)
|
||||
void HOGDescriptor::readALTModel(String modelfile)
|
||||
{
|
||||
// read model from SVMlight format..
|
||||
FILE *modelfl;
|
||||
if ((modelfl = fopen(modelfile.c_str(), "rb")) == NULL)
|
||||
{
|
||||
cv::String eerr("file not exist");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
String eerr("file not exist");
|
||||
String efile(__FILE__);
|
||||
String efunc(__FUNCTION__);
|
||||
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
|
||||
}
|
||||
char version_buffer[10];
|
||||
if (!fread (&version_buffer,sizeof(char),10,modelfl))
|
||||
{
|
||||
cv::String eerr("version?");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
String eerr("version?");
|
||||
String efile(__FILE__);
|
||||
String efunc(__FUNCTION__);
|
||||
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
|
||||
}
|
||||
if(strcmp(version_buffer,"V6.01")) {
|
||||
cv::String eerr("version doesnot match");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
String eerr("version doesnot match");
|
||||
String efile(__FILE__);
|
||||
String efunc(__FUNCTION__);
|
||||
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
|
||||
}
|
||||
/* read version number */
|
||||
@@ -2819,9 +2819,9 @@ void HOGDescriptor::readALTModel(cv::String modelfile)
|
||||
{ throw Exception(); }
|
||||
if (version < 200)
|
||||
{
|
||||
cv::String eerr("version doesnot match");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
String eerr("version doesnot match");
|
||||
String efile(__FILE__);
|
||||
String efunc(__FUNCTION__);
|
||||
throw Exception();
|
||||
}
|
||||
int kernel_type;
|
||||
|
@@ -158,7 +158,7 @@ LatentSvmDetector::ObjectDetection::ObjectDetection( const Rect& _rect, float _s
|
||||
LatentSvmDetector::LatentSvmDetector()
|
||||
{}
|
||||
|
||||
LatentSvmDetector::LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames )
|
||||
LatentSvmDetector::LatentSvmDetector( const std::vector<String>& filenames, const std::vector<String>& _classNames )
|
||||
{
|
||||
load( filenames, _classNames );
|
||||
}
|
||||
@@ -182,7 +182,7 @@ bool LatentSvmDetector::empty() const
|
||||
return detectors.empty();
|
||||
}
|
||||
|
||||
const std::vector<cv::String>& LatentSvmDetector::getClassNames() const
|
||||
const std::vector<String>& LatentSvmDetector::getClassNames() const
|
||||
{
|
||||
return classNames;
|
||||
}
|
||||
@@ -192,13 +192,13 @@ size_t LatentSvmDetector::getClassCount() const
|
||||
return classNames.size();
|
||||
}
|
||||
|
||||
static cv::String extractModelName( const cv::String& filename )
|
||||
static String extractModelName( const String& filename )
|
||||
{
|
||||
size_t startPos = filename.rfind('/');
|
||||
if( startPos == cv::String::npos )
|
||||
if( startPos == String::npos )
|
||||
startPos = filename.rfind('\\');
|
||||
|
||||
if( startPos == cv::String::npos )
|
||||
if( startPos == String::npos )
|
||||
startPos = 0;
|
||||
else
|
||||
startPos++;
|
||||
@@ -210,7 +210,7 @@ static cv::String extractModelName( const cv::String& filename )
|
||||
return filename.substr(startPos, substrLength);
|
||||
}
|
||||
|
||||
bool LatentSvmDetector::load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames )
|
||||
bool LatentSvmDetector::load( const std::vector<String>& filenames, const std::vector<String>& _classNames )
|
||||
{
|
||||
clear();
|
||||
|
||||
@@ -218,7 +218,7 @@ bool LatentSvmDetector::load( const std::vector<cv::String>& filenames, const st
|
||||
|
||||
for( size_t i = 0; i < filenames.size(); i++ )
|
||||
{
|
||||
const cv::String filename = filenames[i];
|
||||
const String filename = filenames[i];
|
||||
if( filename.length() < 5 || filename.substr(filename.length()-4, 4) != ".xml" )
|
||||
continue;
|
||||
|
||||
|
@@ -201,7 +201,7 @@ void QuantizedPyramid::selectScatteredFeatures(const std::vector<Candidate>& can
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Modality> Modality::create(const cv::String& modality_type)
|
||||
Ptr<Modality> Modality::create(const String& modality_type)
|
||||
{
|
||||
if (modality_type == "ColorGradient")
|
||||
return new ColorGradient();
|
||||
@@ -213,7 +213,7 @@ Ptr<Modality> Modality::create(const cv::String& modality_type)
|
||||
|
||||
Ptr<Modality> Modality::create(const FileNode& fn)
|
||||
{
|
||||
cv::String type = fn["type"];
|
||||
String type = fn["type"];
|
||||
Ptr<Modality> modality = create(type);
|
||||
modality->read(fn);
|
||||
return modality;
|
||||
@@ -566,7 +566,7 @@ ColorGradient::ColorGradient(float _weak_threshold, size_t _num_features, float
|
||||
|
||||
static const char CG_NAME[] = "ColorGradient";
|
||||
|
||||
cv::String ColorGradient::name() const
|
||||
String ColorGradient::name() const
|
||||
{
|
||||
return CG_NAME;
|
||||
}
|
||||
@@ -579,7 +579,7 @@ Ptr<QuantizedPyramid> ColorGradient::processImpl(const Mat& src,
|
||||
|
||||
void ColorGradient::read(const FileNode& fn)
|
||||
{
|
||||
cv::String type = fn["type"];
|
||||
String type = fn["type"];
|
||||
CV_Assert(type == CG_NAME);
|
||||
|
||||
weak_threshold = fn["weak_threshold"];
|
||||
@@ -887,7 +887,7 @@ DepthNormal::DepthNormal(int _distance_threshold, int _difference_threshold, siz
|
||||
|
||||
static const char DN_NAME[] = "DepthNormal";
|
||||
|
||||
cv::String DepthNormal::name() const
|
||||
String DepthNormal::name() const
|
||||
{
|
||||
return DN_NAME;
|
||||
}
|
||||
@@ -901,7 +901,7 @@ Ptr<QuantizedPyramid> DepthNormal::processImpl(const Mat& src,
|
||||
|
||||
void DepthNormal::read(const FileNode& fn)
|
||||
{
|
||||
cv::String type = fn["type"];
|
||||
String type = fn["type"];
|
||||
CV_Assert(type == DN_NAME);
|
||||
|
||||
distance_threshold = fn["distance_threshold"];
|
||||
@@ -1397,7 +1397,7 @@ Detector::Detector(const std::vector< Ptr<Modality> >& _modalities,
|
||||
}
|
||||
|
||||
void Detector::match(const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches,
|
||||
const std::vector<cv::String>& class_ids, OutputArrayOfArrays quantized_images,
|
||||
const std::vector<String>& class_ids, OutputArrayOfArrays quantized_images,
|
||||
const std::vector<Mat>& masks) const
|
||||
{
|
||||
matches.clear();
|
||||
@@ -1488,7 +1488,7 @@ struct MatchPredicate
|
||||
void Detector::matchClass(const LinearMemoryPyramid& lm_pyramid,
|
||||
const std::vector<Size>& sizes,
|
||||
float threshold, std::vector<Match>& matches,
|
||||
const cv::String& class_id,
|
||||
const String& class_id,
|
||||
const std::vector<TemplatePyramid>& template_pyramids) const
|
||||
{
|
||||
// For each template...
|
||||
@@ -1613,7 +1613,7 @@ void Detector::matchClass(const LinearMemoryPyramid& lm_pyramid,
|
||||
}
|
||||
}
|
||||
|
||||
int Detector::addTemplate(const std::vector<Mat>& sources, const cv::String& class_id,
|
||||
int Detector::addTemplate(const std::vector<Mat>& sources, const String& class_id,
|
||||
const Mat& object_mask, Rect* bounding_box)
|
||||
{
|
||||
int num_modalities = static_cast<int>(modalities.size());
|
||||
@@ -1649,7 +1649,7 @@ int Detector::addTemplate(const std::vector<Mat>& sources, const cv::String& cla
|
||||
return template_id;
|
||||
}
|
||||
|
||||
int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const cv::String& class_id)
|
||||
int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const String& class_id)
|
||||
{
|
||||
std::vector<TemplatePyramid>& template_pyramids = class_templates[class_id];
|
||||
int template_id = static_cast<int>(template_pyramids.size());
|
||||
@@ -1657,7 +1657,7 @@ int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const
|
||||
return template_id;
|
||||
}
|
||||
|
||||
const std::vector<Template>& Detector::getTemplates(const cv::String& class_id, int template_id) const
|
||||
const std::vector<Template>& Detector::getTemplates(const String& class_id, int template_id) const
|
||||
{
|
||||
TemplatesMap::const_iterator i = class_templates.find(class_id);
|
||||
CV_Assert(i != class_templates.end());
|
||||
@@ -1674,7 +1674,7 @@ int Detector::numTemplates() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Detector::numTemplates(const cv::String& class_id) const
|
||||
int Detector::numTemplates(const String& class_id) const
|
||||
{
|
||||
TemplatesMap::const_iterator i = class_templates.find(class_id);
|
||||
if (i == class_templates.end())
|
||||
@@ -1682,9 +1682,9 @@ int Detector::numTemplates(const cv::String& class_id) const
|
||||
return static_cast<int>(i->second.size());
|
||||
}
|
||||
|
||||
std::vector<cv::String> Detector::classIds() const
|
||||
std::vector<String> Detector::classIds() const
|
||||
{
|
||||
std::vector<cv::String> ids;
|
||||
std::vector<String> ids;
|
||||
TemplatesMap::const_iterator i = class_templates.begin(), iend = class_templates.end();
|
||||
for ( ; i != iend; ++i)
|
||||
{
|
||||
@@ -1724,7 +1724,7 @@ void Detector::write(FileStorage& fs) const
|
||||
fs << "]"; // modalities
|
||||
}
|
||||
|
||||
cv::String Detector::readClass(const FileNode& fn, const cv::String &class_id_override)
|
||||
String Detector::readClass(const FileNode& fn, const String &class_id_override)
|
||||
{
|
||||
// Verify compatible with Detector settings
|
||||
FileNode mod_fn = fn["modalities"];
|
||||
@@ -1732,14 +1732,14 @@ void Detector::write(FileStorage& fs) const
|
||||
FileNodeIterator mod_it = mod_fn.begin(), mod_it_end = mod_fn.end();
|
||||
int i = 0;
|
||||
for ( ; mod_it != mod_it_end; ++mod_it, ++i)
|
||||
CV_Assert(modalities[i]->name() == (cv::String)(*mod_it));
|
||||
CV_Assert(modalities[i]->name() == (String)(*mod_it));
|
||||
CV_Assert((int)fn["pyramid_levels"] == pyramid_levels);
|
||||
|
||||
// Detector should not already have this class
|
||||
cv::String class_id;
|
||||
String class_id;
|
||||
if (class_id_override.empty())
|
||||
{
|
||||
cv::String class_id_tmp = fn["class_id"];
|
||||
String class_id_tmp = fn["class_id"];
|
||||
CV_Assert(class_templates.find(class_id_tmp) == class_templates.end());
|
||||
class_id = class_id_tmp;
|
||||
}
|
||||
@@ -1774,7 +1774,7 @@ void Detector::write(FileStorage& fs) const
|
||||
return class_id;
|
||||
}
|
||||
|
||||
void Detector::writeClass(const cv::String& class_id, FileStorage& fs) const
|
||||
void Detector::writeClass(const String& class_id, FileStorage& fs) const
|
||||
{
|
||||
TemplatesMap::const_iterator it = class_templates.find(class_id);
|
||||
CV_Assert(it != class_templates.end());
|
||||
@@ -1805,25 +1805,25 @@ void Detector::writeClass(const cv::String& class_id, FileStorage& fs) const
|
||||
fs << "]"; // pyramids
|
||||
}
|
||||
|
||||
void Detector::readClasses(const std::vector<cv::String>& class_ids,
|
||||
const cv::String& format)
|
||||
void Detector::readClasses(const std::vector<String>& class_ids,
|
||||
const String& format)
|
||||
{
|
||||
for (size_t i = 0; i < class_ids.size(); ++i)
|
||||
{
|
||||
const cv::String& class_id = class_ids[i];
|
||||
cv::String filename = cv::format(format.c_str(), class_id.c_str());
|
||||
const String& class_id = class_ids[i];
|
||||
String filename = cv::format(format.c_str(), class_id.c_str());
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
readClass(fs.root());
|
||||
}
|
||||
}
|
||||
|
||||
void Detector::writeClasses(const cv::String& format) const
|
||||
void Detector::writeClasses(const String& format) const
|
||||
{
|
||||
TemplatesMap::const_iterator it = class_templates.begin(), it_end = class_templates.end();
|
||||
for ( ; it != it_end; ++it)
|
||||
{
|
||||
const cv::String& class_id = it->first;
|
||||
cv::String filename = cv::format(format.c_str(), class_id.c_str());
|
||||
const String& class_id = it->first;
|
||||
String filename = cv::format(format.c_str(), class_id.c_str());
|
||||
FileStorage fs(filename, FileStorage::WRITE);
|
||||
writeClass(class_id, fs);
|
||||
}
|
||||
|
Reference in New Issue
Block a user