All modules (except ocl and gpu) compiles and pass tests
This commit is contained in:
@@ -854,7 +854,7 @@ CascadeClassifier::CascadeClassifier()
|
||||
{
|
||||
}
|
||||
|
||||
CascadeClassifier::CascadeClassifier(const std::string& filename)
|
||||
CascadeClassifier::CascadeClassifier(const cv::String& filename)
|
||||
{
|
||||
load(filename);
|
||||
}
|
||||
@@ -868,7 +868,7 @@ bool CascadeClassifier::empty() const
|
||||
return oldCascade.empty() && data.stages.empty();
|
||||
}
|
||||
|
||||
bool CascadeClassifier::load(const std::string& filename)
|
||||
bool CascadeClassifier::load(const cv::String& filename)
|
||||
{
|
||||
oldCascade.release();
|
||||
data = Data();
|
||||
@@ -1209,13 +1209,13 @@ bool CascadeClassifier::Data::read(const FileNode &root)
|
||||
static const float THRESHOLD_EPS = 1e-5f;
|
||||
|
||||
// load stage params
|
||||
std::string stageTypeStr = (std::string)root[CC_STAGE_TYPE];
|
||||
cv::String stageTypeStr = (cv::String)root[CC_STAGE_TYPE];
|
||||
if( stageTypeStr == CC_BOOST )
|
||||
stageType = BOOST;
|
||||
else
|
||||
return false;
|
||||
|
||||
std::string featureTypeStr = (std::string)root[CC_FEATURE_TYPE];
|
||||
cv::String featureTypeStr = (cv::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<std::string>& codes,
|
||||
std::vector<cv::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] = std::string(rc_i.msg);
|
||||
codes[i] = cv::String(rc_i.msg);
|
||||
|
||||
if( corners.data )
|
||||
{
|
||||
@@ -535,7 +535,7 @@ void findDataMatrix(InputArray _image,
|
||||
}
|
||||
|
||||
void drawDataMatrixCodes(InputOutputArray _image,
|
||||
const std::vector<std::string>& codes,
|
||||
const std::vector<cv::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 std::string& objName) const
|
||||
void HOGDescriptor::write(FileStorage& fs, const cv::String& objName) const
|
||||
{
|
||||
if( !objName.empty() )
|
||||
fs << objName;
|
||||
@@ -143,14 +143,14 @@ void HOGDescriptor::write(FileStorage& fs, const std::string& objName) const
|
||||
fs << "}";
|
||||
}
|
||||
|
||||
bool HOGDescriptor::load(const std::string& filename, const std::string& objname)
|
||||
bool HOGDescriptor::load(const cv::String& filename, const cv::String& objname)
|
||||
{
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
FileNode obj = !objname.empty() ? fs[objname] : fs.getFirstTopLevelNode();
|
||||
return read(obj);
|
||||
}
|
||||
|
||||
void HOGDescriptor::save(const std::string& filename, const std::string& objName) const
|
||||
void HOGDescriptor::save(const cv::String& filename, const cv::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(std::string modelfile)
|
||||
void HOGDescriptor::readALTModel(cv::String modelfile)
|
||||
{
|
||||
// read model from SVMlight format..
|
||||
FILE *modelfl;
|
||||
if ((modelfl = fopen(modelfile.c_str(), "rb")) == NULL)
|
||||
{
|
||||
std::string eerr("file not exist");
|
||||
std::string efile(__FILE__);
|
||||
std::string efunc(__FUNCTION__);
|
||||
cv::String eerr("file not exist");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
|
||||
}
|
||||
char version_buffer[10];
|
||||
if (!fread (&version_buffer,sizeof(char),10,modelfl))
|
||||
{
|
||||
std::string eerr("version?");
|
||||
std::string efile(__FILE__);
|
||||
std::string efunc(__FUNCTION__);
|
||||
cv::String eerr("version?");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
|
||||
}
|
||||
if(strcmp(version_buffer,"V6.01")) {
|
||||
std::string eerr("version doesnot match");
|
||||
std::string efile(__FILE__);
|
||||
std::string efunc(__FUNCTION__);
|
||||
cv::String eerr("version doesnot match");
|
||||
cv::String efile(__FILE__);
|
||||
cv::String efunc(__FUNCTION__);
|
||||
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
|
||||
}
|
||||
/* read version number */
|
||||
@@ -2819,9 +2819,9 @@ void HOGDescriptor::readALTModel(std::string modelfile)
|
||||
{ throw Exception(); }
|
||||
if (version < 200)
|
||||
{
|
||||
std::string eerr("version doesnot match");
|
||||
std::string efile(__FILE__);
|
||||
std::string efunc(__FUNCTION__);
|
||||
cv::String eerr("version doesnot match");
|
||||
cv::String efile(__FILE__);
|
||||
cv::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<std::string>& filenames, const std::vector<std::string>& _classNames )
|
||||
LatentSvmDetector::LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames )
|
||||
{
|
||||
load( filenames, _classNames );
|
||||
}
|
||||
@@ -182,7 +182,7 @@ bool LatentSvmDetector::empty() const
|
||||
return detectors.empty();
|
||||
}
|
||||
|
||||
const std::vector<std::string>& LatentSvmDetector::getClassNames() const
|
||||
const std::vector<cv::String>& LatentSvmDetector::getClassNames() const
|
||||
{
|
||||
return classNames;
|
||||
}
|
||||
@@ -192,13 +192,13 @@ size_t LatentSvmDetector::getClassCount() const
|
||||
return classNames.size();
|
||||
}
|
||||
|
||||
static std::string extractModelName( const std::string& filename )
|
||||
static cv::String extractModelName( const cv::String& filename )
|
||||
{
|
||||
size_t startPos = filename.rfind('/');
|
||||
if( startPos == std::string::npos )
|
||||
if( startPos == cv::String::npos )
|
||||
startPos = filename.rfind('\\');
|
||||
|
||||
if( startPos == std::string::npos )
|
||||
if( startPos == cv::String::npos )
|
||||
startPos = 0;
|
||||
else
|
||||
startPos++;
|
||||
@@ -210,7 +210,7 @@ static std::string extractModelName( const std::string& filename )
|
||||
return filename.substr(startPos, substrLength);
|
||||
}
|
||||
|
||||
bool LatentSvmDetector::load( const std::vector<std::string>& filenames, const std::vector<std::string>& _classNames )
|
||||
bool LatentSvmDetector::load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames )
|
||||
{
|
||||
clear();
|
||||
|
||||
@@ -218,7 +218,7 @@ bool LatentSvmDetector::load( const std::vector<std::string>& filenames, const s
|
||||
|
||||
for( size_t i = 0; i < filenames.size(); i++ )
|
||||
{
|
||||
const std::string filename = filenames[i];
|
||||
const cv::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 std::string& modality_type)
|
||||
Ptr<Modality> Modality::create(const cv::String& modality_type)
|
||||
{
|
||||
if (modality_type == "ColorGradient")
|
||||
return new ColorGradient();
|
||||
@@ -213,7 +213,7 @@ Ptr<Modality> Modality::create(const std::string& modality_type)
|
||||
|
||||
Ptr<Modality> Modality::create(const FileNode& fn)
|
||||
{
|
||||
std::string type = fn["type"];
|
||||
cv::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";
|
||||
|
||||
std::string ColorGradient::name() const
|
||||
cv::String ColorGradient::name() const
|
||||
{
|
||||
return CG_NAME;
|
||||
}
|
||||
@@ -579,7 +579,7 @@ Ptr<QuantizedPyramid> ColorGradient::processImpl(const Mat& src,
|
||||
|
||||
void ColorGradient::read(const FileNode& fn)
|
||||
{
|
||||
std::string type = fn["type"];
|
||||
cv::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";
|
||||
|
||||
std::string DepthNormal::name() const
|
||||
cv::String DepthNormal::name() const
|
||||
{
|
||||
return DN_NAME;
|
||||
}
|
||||
@@ -901,7 +901,7 @@ Ptr<QuantizedPyramid> DepthNormal::processImpl(const Mat& src,
|
||||
|
||||
void DepthNormal::read(const FileNode& fn)
|
||||
{
|
||||
std::string type = fn["type"];
|
||||
cv::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<std::string>& class_ids, OutputArrayOfArrays quantized_images,
|
||||
const std::vector<cv::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 std::string& class_id,
|
||||
const cv::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 std::string& class_id,
|
||||
int Detector::addTemplate(const std::vector<Mat>& sources, const cv::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 std::string& cl
|
||||
return template_id;
|
||||
}
|
||||
|
||||
int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const std::string& class_id)
|
||||
int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const cv::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 std::string& class_id, int template_id) const
|
||||
const std::vector<Template>& Detector::getTemplates(const cv::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 std::string& class_id) const
|
||||
int Detector::numTemplates(const cv::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 std::string& class_id) const
|
||||
return static_cast<int>(i->second.size());
|
||||
}
|
||||
|
||||
std::vector<std::string> Detector::classIds() const
|
||||
std::vector<cv::String> Detector::classIds() const
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
std::vector<cv::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
|
||||
}
|
||||
|
||||
std::string Detector::readClass(const FileNode& fn, const std::string &class_id_override)
|
||||
cv::String Detector::readClass(const FileNode& fn, const cv::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() == (std::string)(*mod_it));
|
||||
CV_Assert(modalities[i]->name() == (cv::String)(*mod_it));
|
||||
CV_Assert((int)fn["pyramid_levels"] == pyramid_levels);
|
||||
|
||||
// Detector should not already have this class
|
||||
std::string class_id;
|
||||
cv::String class_id;
|
||||
if (class_id_override.empty())
|
||||
{
|
||||
std::string class_id_tmp = fn["class_id"];
|
||||
cv::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 std::string& class_id, FileStorage& fs) const
|
||||
void Detector::writeClass(const cv::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 std::string& class_id, FileStorage& fs) const
|
||||
fs << "]"; // pyramids
|
||||
}
|
||||
|
||||
void Detector::readClasses(const std::vector<std::string>& class_ids,
|
||||
const std::string& format)
|
||||
void Detector::readClasses(const std::vector<cv::String>& class_ids,
|
||||
const cv::String& format)
|
||||
{
|
||||
for (size_t i = 0; i < class_ids.size(); ++i)
|
||||
{
|
||||
const std::string& class_id = class_ids[i];
|
||||
std::string filename = cv::format(format.c_str(), class_id.c_str());
|
||||
const cv::String& class_id = class_ids[i];
|
||||
cv::String filename = cv::format(format.c_str(), class_id.c_str());
|
||||
FileStorage fs(filename, FileStorage::READ);
|
||||
readClass(fs.root());
|
||||
}
|
||||
}
|
||||
|
||||
void Detector::writeClasses(const std::string& format) const
|
||||
void Detector::writeClasses(const cv::String& format) const
|
||||
{
|
||||
TemplatesMap::const_iterator it = class_templates.begin(), it_end = class_templates.end();
|
||||
for ( ; it != it_end; ++it)
|
||||
{
|
||||
const std::string& class_id = it->first;
|
||||
std::string filename = cv::format(format.c_str(), class_id.c_str());
|
||||
const cv::String& class_id = it->first;
|
||||
cv::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