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:
Andrey Kamaev
2013-02-24 20:14:01 +04:00
parent f783f34e0b
commit 2a6fb2867e
310 changed files with 5744 additions and 5964 deletions

View File

@@ -45,8 +45,6 @@
namespace cv
{
using std::pair;
template<typename _KeyTp, typename _ValueTp> struct sorted_vector
{
sorted_vector() {}
@@ -57,7 +55,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
void add(const _KeyTp& k, const _ValueTp& val)
{
pair<_KeyTp, _ValueTp> p(k, val);
std::pair<_KeyTp, _ValueTp> p(k, val);
vec.push_back(p);
size_t i = vec.size()-1;
for( ; i > 0 && vec[i].first < vec[i-1].first; i-- )
@@ -85,7 +83,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
return false;
}
void get_keys(vector<_KeyTp>& keys) const
void get_keys(std::vector<_KeyTp>& keys) const
{
size_t i = 0, n = vec.size();
keys.resize(n);
@@ -94,11 +92,11 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
keys[i] = vec[i].first;
}
vector<pair<_KeyTp, _ValueTp> > vec;
std::vector<std::pair<_KeyTp, _ValueTp> > vec;
};
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<string, _ValueTp>& vec,
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<std::string, _ValueTp>& vec,
const char* key)
{
if( !key )
@@ -132,7 +130,7 @@ Param::Param()
Param::Param(int _type, bool _readonly, int _offset,
Algorithm::Getter _getter, Algorithm::Setter _setter,
const string& _help)
const std::string& _help)
{
type = _type;
readonly = _readonly;
@@ -144,23 +142,23 @@ Param::Param(int _type, bool _readonly, int _offset,
struct CV_EXPORTS AlgorithmInfoData
{
sorted_vector<string, Param> params;
string _name;
sorted_vector<std::string, Param> params;
std::string _name;
};
static sorted_vector<string, Algorithm::Constructor>& alglist()
static sorted_vector<std::string, Algorithm::Constructor>& alglist()
{
static sorted_vector<string, Algorithm::Constructor> alglist_var;
static sorted_vector<std::string, Algorithm::Constructor> alglist_var;
return alglist_var;
}
void Algorithm::getList(vector<string>& algorithms)
void Algorithm::getList(std::vector<std::string>& algorithms)
{
alglist().get_keys(algorithms);
}
Ptr<Algorithm> Algorithm::_create(const string& name)
Ptr<Algorithm> Algorithm::_create(const std::string& name)
{
Algorithm::Constructor c = 0;
if( !alglist().find(name, c) )
@@ -176,42 +174,42 @@ Algorithm::~Algorithm()
{
}
string Algorithm::name() const
std::string Algorithm::name() const
{
return info()->name();
}
void Algorithm::set(const string& parameter, int value)
void Algorithm::set(const std::string& parameter, int value)
{
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
}
void Algorithm::set(const string& parameter, double value)
void Algorithm::set(const std::string& parameter, double value)
{
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
}
void Algorithm::set(const string& parameter, bool value)
void Algorithm::set(const std::string& parameter, bool value)
{
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
}
void Algorithm::set(const string& parameter, const string& value)
void Algorithm::set(const std::string& parameter, const std::string& value)
{
info()->set(this, parameter.c_str(), ParamType<string>::type, &value);
info()->set(this, parameter.c_str(), ParamType<std::string>::type, &value);
}
void Algorithm::set(const string& parameter, const Mat& value)
void Algorithm::set(const std::string& parameter, const Mat& value)
{
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
}
void Algorithm::set(const string& parameter, const vector<Mat>& value)
void Algorithm::set(const std::string& parameter, const std::vector<Mat>& value)
{
info()->set(this, parameter.c_str(), ParamType<vector<Mat> >::type, &value);
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
}
void Algorithm::set(const string& parameter, const Ptr<Algorithm>& value)
void Algorithm::set(const std::string& parameter, const Ptr<Algorithm>& value)
{
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
}
@@ -231,9 +229,9 @@ void Algorithm::set(const char* parameter, bool value)
info()->set(this, parameter, ParamType<bool>::type, &value);
}
void Algorithm::set(const char* parameter, const string& value)
void Algorithm::set(const char* parameter, const std::string& value)
{
info()->set(this, parameter, ParamType<string>::type, &value);
info()->set(this, parameter, ParamType<std::string>::type, &value);
}
void Algorithm::set(const char* parameter, const Mat& value)
@@ -241,9 +239,9 @@ void Algorithm::set(const char* parameter, const Mat& value)
info()->set(this, parameter, ParamType<Mat>::type, &value);
}
void Algorithm::set(const char* parameter, const vector<Mat>& value)
void Algorithm::set(const char* parameter, const std::vector<Mat>& value)
{
info()->set(this, parameter, ParamType<vector<Mat> >::type, &value);
info()->set(this, parameter, ParamType<std::vector<Mat> >::type, &value);
}
void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
@@ -252,37 +250,37 @@ void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
}
void Algorithm::setInt(const string& parameter, int value)
void Algorithm::setInt(const std::string& parameter, int value)
{
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
}
void Algorithm::setDouble(const string& parameter, double value)
void Algorithm::setDouble(const std::string& parameter, double value)
{
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
}
void Algorithm::setBool(const string& parameter, bool value)
void Algorithm::setBool(const std::string& parameter, bool value)
{
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
}
void Algorithm::setString(const string& parameter, const string& value)
void Algorithm::setString(const std::string& parameter, const std::string& value)
{
info()->set(this, parameter.c_str(), ParamType<string>::type, &value);
info()->set(this, parameter.c_str(), ParamType<std::string>::type, &value);
}
void Algorithm::setMat(const string& parameter, const Mat& value)
void Algorithm::setMat(const std::string& parameter, const Mat& value)
{
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
}
void Algorithm::setMatVector(const string& parameter, const vector<Mat>& value)
void Algorithm::setMatVector(const std::string& parameter, const std::vector<Mat>& value)
{
info()->set(this, parameter.c_str(), ParamType<vector<Mat> >::type, &value);
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
}
void Algorithm::setAlgorithm(const string& parameter, const Ptr<Algorithm>& value)
void Algorithm::setAlgorithm(const std::string& parameter, const Ptr<Algorithm>& value)
{
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
}
@@ -302,9 +300,9 @@ void Algorithm::setBool(const char* parameter, bool value)
info()->set(this, parameter, ParamType<bool>::type, &value);
}
void Algorithm::setString(const char* parameter, const string& value)
void Algorithm::setString(const char* parameter, const std::string& value)
{
info()->set(this, parameter, ParamType<string>::type, &value);
info()->set(this, parameter, ParamType<std::string>::type, &value);
}
void Algorithm::setMat(const char* parameter, const Mat& value)
@@ -312,9 +310,9 @@ void Algorithm::setMat(const char* parameter, const Mat& value)
info()->set(this, parameter, ParamType<Mat>::type, &value);
}
void Algorithm::setMatVector(const char* parameter, const vector<Mat>& value)
void Algorithm::setMatVector(const char* parameter, const std::vector<Mat>& value)
{
info()->set(this, parameter, ParamType<vector<Mat> >::type, &value);
info()->set(this, parameter, ParamType<std::vector<Mat> >::type, &value);
}
void Algorithm::setAlgorithm(const char* parameter, const Ptr<Algorithm>& value)
@@ -324,47 +322,47 @@ void Algorithm::setAlgorithm(const char* parameter, const Ptr<Algorithm>& value)
int Algorithm::getInt(const string& parameter) const
int Algorithm::getInt(const std::string& parameter) const
{
return get<int>(parameter);
}
double Algorithm::getDouble(const string& parameter) const
double Algorithm::getDouble(const std::string& parameter) const
{
return get<double>(parameter);
}
bool Algorithm::getBool(const string& parameter) const
bool Algorithm::getBool(const std::string& parameter) const
{
return get<bool>(parameter);
}
string Algorithm::getString(const string& parameter) const
std::string Algorithm::getString(const std::string& parameter) const
{
return get<string>(parameter);
return get<std::string>(parameter);
}
Mat Algorithm::getMat(const string& parameter) const
Mat Algorithm::getMat(const std::string& parameter) const
{
return get<Mat>(parameter);
}
vector<Mat> Algorithm::getMatVector(const string& parameter) const
std::vector<Mat> Algorithm::getMatVector(const std::string& parameter) const
{
return get<vector<Mat> >(parameter);
return get<std::vector<Mat> >(parameter);
}
Ptr<Algorithm> Algorithm::getAlgorithm(const string& parameter) const
Ptr<Algorithm> Algorithm::getAlgorithm(const std::string& parameter) const
{
return get<Algorithm>(parameter);
}
string Algorithm::paramHelp(const string& parameter) const
std::string Algorithm::paramHelp(const std::string& parameter) const
{
return info()->paramHelp(parameter.c_str());
}
int Algorithm::paramType(const string& parameter) const
int Algorithm::paramType(const std::string& parameter) const
{
return info()->paramType(parameter.c_str());
}
@@ -374,7 +372,7 @@ int Algorithm::paramType(const char* parameter) const
return info()->paramType(parameter);
}
void Algorithm::getParams(vector<string>& names) const
void Algorithm::getParams(std::vector<std::string>& names) const
{
info()->getParams(names);
}
@@ -390,7 +388,7 @@ void Algorithm::read(const FileNode& fn)
}
AlgorithmInfo::AlgorithmInfo(const string& _name, Algorithm::Constructor create)
AlgorithmInfo::AlgorithmInfo(const std::string& _name, Algorithm::Constructor create)
{
data = new AlgorithmInfoData;
data->_name = _name;
@@ -410,7 +408,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
for( i = 0; i < nparams; i++ )
{
const Param& p = data->params.vec[i].second;
const string& pname = data->params.vec[i].first;
const std::string& pname = data->params.vec[i].first;
if( p.type == Param::INT )
cv::write(fs, pname, algo->get<int>(pname));
else if( p.type == Param::BOOLEAN )
@@ -418,11 +416,11 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
else if( p.type == Param::REAL )
cv::write(fs, pname, algo->get<double>(pname));
else if( p.type == Param::STRING )
cv::write(fs, pname, algo->get<string>(pname));
cv::write(fs, pname, algo->get<std::string>(pname));
else if( p.type == Param::MAT )
cv::write(fs, pname, algo->get<Mat>(pname));
else if( p.type == Param::MAT_VECTOR )
cv::write(fs, pname, algo->get<vector<Mat> >(pname));
cv::write(fs, pname, algo->get<std::vector<Mat> >(pname));
else if( p.type == Param::ALGORITHM )
{
WriteStructContext ws(fs, pname, CV_NODE_MAP);
@@ -431,7 +429,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
}
else
{
string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
std::string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
CV_Error( CV_StsUnsupportedFormat, msg.c_str());
}
}
@@ -445,7 +443,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
for( i = 0; i < nparams; i++ )
{
const Param& p = data->params.vec[i].second;
const string& pname = data->params.vec[i].first;
const std::string& pname = data->params.vec[i].first;
const FileNode n = fn[pname];
if( n.empty() )
continue;
@@ -466,7 +464,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
}
else if( p.type == Param::STRING )
{
string val = (string)n;
std::string val = (std::string)n;
info->set(algo, pname.c_str(), p.type, &val, true);
}
else if( p.type == Param::MAT )
@@ -477,26 +475,26 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
}
else if( p.type == Param::MAT_VECTOR )
{
vector<Mat> mv;
std::vector<Mat> mv;
cv::read(n, mv);
info->set(algo, pname.c_str(), p.type, &mv, true);
}
else if( p.type == Param::ALGORITHM )
{
Ptr<Algorithm> nestedAlgo = Algorithm::_create((string)n["name"]);
Ptr<Algorithm> nestedAlgo = Algorithm::_create((std::string)n["name"]);
CV_Assert( !nestedAlgo.empty() );
nestedAlgo->read(n);
info->set(algo, pname.c_str(), p.type, &nestedAlgo, true);
}
else
{
string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
std::string msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
CV_Error( CV_StsUnsupportedFormat, msg.c_str());
}
}
}
string AlgorithmInfo::name() const
std::string AlgorithmInfo::name() const
{
return data->_name;
}
@@ -506,23 +504,23 @@ union GetSetParam
int (Algorithm::*get_int)() const;
bool (Algorithm::*get_bool)() const;
double (Algorithm::*get_double)() const;
string (Algorithm::*get_string)() const;
std::string (Algorithm::*get_string)() const;
Mat (Algorithm::*get_mat)() const;
vector<Mat> (Algorithm::*get_mat_vector)() const;
std::vector<Mat> (Algorithm::*get_mat_vector)() const;
Ptr<Algorithm> (Algorithm::*get_algo)() const;
void (Algorithm::*set_int)(int);
void (Algorithm::*set_bool)(bool);
void (Algorithm::*set_double)(double);
void (Algorithm::*set_string)(const string&);
void (Algorithm::*set_string)(const std::string&);
void (Algorithm::*set_mat)(const Mat&);
void (Algorithm::*set_mat_vector)(const vector<Mat>&);
void (Algorithm::*set_mat_vector)(const std::vector<Mat>&);
void (Algorithm::*set_algo)(const Ptr<Algorithm>&);
};
static string getNameOfType(int argType);
static std::string getNameOfType(int argType);
static string getNameOfType(int argType)
static std::string getNameOfType(int argType)
{
switch(argType)
{
@@ -537,10 +535,10 @@ static string getNameOfType(int argType)
}
return "";
}
static string getErrorMessageForWrongArgumentInSetter(string algoName, string paramName, int paramType, int argType);
static string getErrorMessageForWrongArgumentInSetter(string algoName, string paramName, int paramType, int argType)
static std::string getErrorMessageForWrongArgumentInSetter(std::string algoName, std::string paramName, int paramType, int argType)
{
string message = string("Argument error: the setter")
std::string message = std::string("Argument error: the setter")
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
+"', the parameter has " + getNameOfType(paramType) + " type, ";
@@ -553,10 +551,9 @@ static string getErrorMessageForWrongArgumentInSetter(string algoName, string pa
return message;
}
static string getErrorMessageForWrongArgumentInGetter(string algoName, string paramName, int paramType, int argType);
static string getErrorMessageForWrongArgumentInGetter(string algoName, string paramName, int paramType, int argType)
static std::string getErrorMessageForWrongArgumentInGetter(std::string algoName, std::string paramName, int paramType, int argType)
{
string message = string("Argument error: the getter")
std::string message = std::string("Argument error: the getter")
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
+"', the parameter has " + getNameOfType(paramType) + " type, ";
@@ -590,7 +587,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
{
if ( !( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN) )
{
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
@@ -629,21 +626,21 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
{
if( p->type != Param::STRING )
{
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
const string& val = *(const string*)value;
const std::string& val = *(const std::string*)value;
if( p->setter )
(algo->*f.set_string)(val);
else
*(string*)((uchar*)algo + p->offset) = val;
*(std::string*)((uchar*)algo + p->offset) = val;
}
else if( argType == Param::MAT )
{
if( p->type != Param::MAT )
{
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
@@ -657,21 +654,21 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
{
if( p->type != Param::MAT_VECTOR )
{
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
const vector<Mat>& val = *(const vector<Mat>*)value;
const std::vector<Mat>& val = *(const std::vector<Mat>*)value;
if( p->setter )
(algo->*f.set_mat_vector)(val);
else
*(vector<Mat>*)((uchar*)algo + p->offset) = val;
*(std::vector<Mat>*)((uchar*)algo + p->offset) = val;
}
else if( argType == Param::ALGORITHM )
{
if( p->type != Param::ALGORITHM )
{
string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
@@ -700,7 +697,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{
if (!( argType == Param::INT || argType == Param::REAL ))
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);
@@ -714,7 +711,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{
if (!( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL ))
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);
@@ -730,7 +727,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{
if( argType != Param::REAL )
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset);
@@ -742,18 +739,18 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{
if( p->type != Param::STRING )
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
*(string*)value = p->getter ? (algo->*f.get_string)() :
*(string*)((uchar*)algo + p->offset);
*(std::string*)value = p->getter ? (algo->*f.get_string)() :
*(std::string*)((uchar*)algo + p->offset);
}
else if( argType == Param::MAT )
{
if( p->type != Param::MAT )
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
@@ -764,18 +761,18 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{
if( p->type != Param::MAT_VECTOR )
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
*(vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
*(vector<Mat>*)((uchar*)algo + p->offset);
*(std::vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
*(std::vector<Mat>*)((uchar*)algo + p->offset);
}
else if( argType == Param::ALGORITHM )
{
if( p->type != Param::ALGORITHM )
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
@@ -784,7 +781,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
}
else
{
string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
std::string message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message);
}
}
@@ -799,7 +796,7 @@ int AlgorithmInfo::paramType(const char* parameter) const
}
string AlgorithmInfo::paramHelp(const char* parameter) const
std::string AlgorithmInfo::paramHelp(const char* parameter) const
{
const Param* p = findstr(data->params, parameter);
if( !p )
@@ -808,7 +805,7 @@ string AlgorithmInfo::paramHelp(const char* parameter) const
}
void AlgorithmInfo::getParams(vector<string>& names) const
void AlgorithmInfo::getParams(std::vector<std::string>& names) const
{
data->params.get_keys(names);
}
@@ -817,13 +814,13 @@ void AlgorithmInfo::getParams(vector<string>& names) const
void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType,
void* value, bool readOnly,
Algorithm::Getter getter, Algorithm::Setter setter,
const string& help)
const std::string& help)
{
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
argType == Param::REAL || argType == Param::STRING ||
argType == Param::MAT || argType == Param::MAT_VECTOR ||
argType == Param::ALGORITHM );
data->params.add(string(parameter), Param(argType, readOnly,
data->params.add(std::string(parameter), Param(argType, readOnly,
(int)((size_t)value - (size_t)(void*)&algo),
getter, setter, help));
}
@@ -833,7 +830,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
int& value, bool readOnly,
int (Algorithm::*getter)(),
void (Algorithm::*setter)(int),
const string& help)
const std::string& help)
{
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@@ -843,7 +840,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
bool& value, bool readOnly,
int (Algorithm::*getter)(),
void (Algorithm::*setter)(int),
const string& help)
const std::string& help)
{
addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@@ -853,19 +850,19 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
double& value, bool readOnly,
double (Algorithm::*getter)(),
void (Algorithm::*setter)(double),
const string& help)
const std::string& help)
{
addParam_(algo, parameter, ParamType<double>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
string& value, bool readOnly,
string (Algorithm::*getter)(),
void (Algorithm::*setter)(const string&),
const string& help)
std::string& value, bool readOnly,
std::string (Algorithm::*getter)(),
void (Algorithm::*setter)(const std::string&),
const std::string& help)
{
addParam_(algo, parameter, ParamType<string>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<std::string>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
@@ -873,19 +870,19 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Mat& value, bool readOnly,
Mat (Algorithm::*getter)(),
void (Algorithm::*setter)(const Mat&),
const string& help)
const std::string& help)
{
addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
vector<Mat>& value, bool readOnly,
vector<Mat> (Algorithm::*getter)(),
void (Algorithm::*setter)(const vector<Mat>&),
const string& help)
std::vector<Mat>& value, bool readOnly,
std::vector<Mat> (Algorithm::*getter)(),
void (Algorithm::*setter)(const std::vector<Mat>&),
const std::string& help)
{
addParam_(algo, parameter, ParamType<vector<Mat> >::type, &value, readOnly,
addParam_(algo, parameter, ParamType<std::vector<Mat> >::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
@@ -893,7 +890,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<Algorithm>& value, bool readOnly,
Ptr<Algorithm> (Algorithm::*getter)(),
void (Algorithm::*setter)(const Ptr<Algorithm>&),
const string& help)
const std::string& help)
{
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);

View File

@@ -9,9 +9,9 @@ namespace cv
struct CommandLineParserParams
{
public:
string help_message;
string def_value;
vector<string> keys;
std::string help_message;
std::string def_value;
std::vector<std::string> keys;
int number;
};
@@ -19,27 +19,27 @@ public:
struct CommandLineParser::Impl
{
bool error;
string error_message;
string about_message;
std::string error_message;
std::string about_message;
string path_to_app;
string app_name;
std::string path_to_app;
std::string app_name;
vector<CommandLineParserParams> data;
std::vector<CommandLineParserParams> data;
vector<string> split_range_string(const string& str, char fs, char ss) const;
vector<string> split_string(const string& str, char symbol = ' ', bool create_empty_item = false) const;
string cat_string(const string& str) const;
std::vector<std::string> split_range_string(const std::string& str, char fs, char ss) const;
std::vector<std::string> split_string(const std::string& str, char symbol = ' ', bool create_empty_item = false) const;
std::string cat_string(const std::string& str) const;
void apply_params(const string& key, const string& value);
void apply_params(int i, string value);
void apply_params(const std::string& key, const std::string& value);
void apply_params(int i, std::string value);
void sort_params();
int refcount;
};
static string get_type_name(int type)
static std::string get_type_name(int type)
{
if( type == Param::INT )
return "int";
@@ -56,7 +56,7 @@ static string get_type_name(int type)
return "unknown";
}
static void from_str(const string& str, int type, void* dst)
static void from_str(const std::string& str, int type, void* dst)
{
std::stringstream ss(str);
if( type == Param::INT )
@@ -70,20 +70,20 @@ static void from_str(const string& str, int type, void* dst)
else if( type == Param::REAL )
ss >> *(double*)dst;
else if( type == Param::STRING )
*(string*)dst = str;
*(std::string*)dst = str;
else
throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", "", __FILE__, __LINE__);
if (ss.fail())
{
string err_msg = "can not convert: [" + str +
std::string err_msg = "can not convert: [" + str +
+ "] to [" + get_type_name(type) + "]";
throw cv::Exception(CV_StsBadArg, err_msg, "", __FILE__, __LINE__);
}
}
void CommandLineParser::getByName(const string& name, bool space_delete, int type, void* dst) const
void CommandLineParser::getByName(const std::string& name, bool space_delete, int type, void* dst) const
{
try
{
@@ -93,7 +93,7 @@ void CommandLineParser::getByName(const string& name, bool space_delete, int typ
{
if (name.compare(impl->data[i].keys[j]) == 0)
{
string v = impl->data[i].def_value;
std::string v = impl->data[i].def_value;
if (space_delete)
v = impl->cat_string(v);
from_str(v, type, dst);
@@ -107,7 +107,7 @@ void CommandLineParser::getByName(const string& name, bool space_delete, int typ
catch (std::exception& e)
{
impl->error = true;
impl->error_message += "Exception: " + string(e.what()) + "\n";
impl->error_message += "Exception: " + std::string(e.what()) + "\n";
}
}
@@ -120,7 +120,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
{
if (impl->data[i].number == index)
{
string v = impl->data[i].def_value;
std::string v = impl->data[i].def_value;
if (space_delete == true) v = impl->cat_string(v);
from_str(v, type, dst);
return;
@@ -132,7 +132,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
catch(std::exception & e)
{
impl->error = true;
impl->error_message += "Exception: " + string(e.what()) + "\n";
impl->error_message += "Exception: " + std::string(e.what()) + "\n";
}
}
@@ -152,34 +152,34 @@ static bool cmp_params(const CommandLineParserParams & p1, const CommandLinePars
return true;
}
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const string& keys)
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const std::string& keys)
{
impl = new Impl;
impl->refcount = 1;
// path to application
size_t pos_s = string(argv[0]).find_last_of("/\\");
if (pos_s == string::npos)
size_t pos_s = std::string(argv[0]).find_last_of("/\\");
if (pos_s == std::string::npos)
{
impl->path_to_app = "";
impl->app_name = string(argv[0]);
impl->app_name = std::string(argv[0]);
}
else
{
impl->path_to_app = string(argv[0]).substr(0, pos_s);
impl->app_name = string(argv[0]).substr(pos_s + 1, string(argv[0]).length() - pos_s);
impl->path_to_app = std::string(argv[0]).substr(0, pos_s);
impl->app_name = std::string(argv[0]).substr(pos_s + 1, std::string(argv[0]).length() - pos_s);
}
impl->error = false;
impl->error_message = "";
// parse keys
vector<string> k = impl->split_range_string(keys, '{', '}');
std::vector<std::string> k = impl->split_range_string(keys, '{', '}');
int jj = 0;
for (size_t i = 0; i < k.size(); i++)
{
vector<string> l = impl->split_string(k[i], '|', true);
std::vector<std::string> l = impl->split_string(k[i], '|', true);
CommandLineParserParams p;
p.keys = impl->split_string(l[0]);
p.def_value = l[1];
@@ -206,11 +206,11 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const s
jj = 0;
for (int i = 1; i < argc; i++)
{
string s = string(argv[i]);
std::string s = std::string(argv[i]);
if (s.find('=') != string::npos && s.find('=') < s.length())
if (s.find('=') != std::string::npos && s.find('=') < s.length())
{
vector<string> k_v = impl->split_string(s, '=', true);
std::vector<std::string> k_v = impl->split_string(s, '=', true);
for (int h = 0; h < 2; h++)
{
if (k_v[0][0] == '-')
@@ -256,12 +256,12 @@ CommandLineParser& CommandLineParser::operator = (const CommandLineParser& parse
return *this;
}
void CommandLineParser::about(const string& message)
void CommandLineParser::about(const std::string& message)
{
impl->about_message = message;
}
void CommandLineParser::Impl::apply_params(const string& key, const string& value)
void CommandLineParser::Impl::apply_params(const std::string& key, const std::string& value)
{
for (size_t i = 0; i < data.size(); i++)
{
@@ -276,7 +276,7 @@ void CommandLineParser::Impl::apply_params(const string& key, const string& valu
}
}
void CommandLineParser::Impl::apply_params(int i, string value)
void CommandLineParser::Impl::apply_params(int i, std::string value)
{
for (size_t j = 0; j < data.size(); j++)
{
@@ -298,28 +298,28 @@ void CommandLineParser::Impl::sort_params()
std::sort (data.begin(), data.end(), cmp_params);
}
string CommandLineParser::Impl::cat_string(const string& str) const
std::string CommandLineParser::Impl::cat_string(const std::string& str) const
{
int left = 0, right = (int)str.length();
while( left <= right && str[left] == ' ' )
left++;
while( right > left && str[right-1] == ' ' )
right--;
return left >= right ? string("") : str.substr(left, right-left);
return left >= right ? std::string("") : str.substr(left, right-left);
}
string CommandLineParser::getPathToApplication() const
std::string CommandLineParser::getPathToApplication() const
{
return impl->path_to_app;
}
bool CommandLineParser::has(const string& name) const
bool CommandLineParser::has(const std::string& name) const
{
for (size_t i = 0; i < impl->data.size(); i++)
{
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
{
if (name.compare(impl->data[i].keys[j]) == 0 && string("true").compare(impl->data[i].def_value) == 0)
if (name.compare(impl->data[i].keys[j]) == 0 && std::string("true").compare(impl->data[i].def_value) == 0)
{
return true;
}
@@ -352,7 +352,7 @@ void CommandLineParser::printMessage() const
{
if (impl->data[i].number > -1)
{
string name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
std::string name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
std::cout << name << " ";
}
}
@@ -366,7 +366,7 @@ void CommandLineParser::printMessage() const
std::cout << "\t";
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
{
string k = impl->data[i].keys[j];
std::string k = impl->data[i].keys[j];
if (k.length() > 1)
{
std::cout << "--";
@@ -382,7 +382,7 @@ void CommandLineParser::printMessage() const
std::cout << ", ";
}
}
string dv = impl->cat_string(impl->data[i].def_value);
std::string dv = impl->cat_string(impl->data[i].def_value);
if (dv.compare("") != 0)
{
std::cout << " (value:" << dv << ")";
@@ -397,12 +397,12 @@ void CommandLineParser::printMessage() const
if (impl->data[i].number != -1)
{
std::cout << "\t";
string k = impl->data[i].keys[0];
std::string k = impl->data[i].keys[0];
k = k.substr(1, k.length() - 1);
std::cout << k;
string dv = impl->cat_string(impl->data[i].def_value);
std::string dv = impl->cat_string(impl->data[i].def_value);
if (dv.compare("") != 0)
{
std::cout << " (value:" << dv << ")";
@@ -412,11 +412,11 @@ void CommandLineParser::printMessage() const
}
}
vector<string> CommandLineParser::Impl::split_range_string(const string& _str, char fs, char ss) const
std::vector<std::string> CommandLineParser::Impl::split_range_string(const std::string& _str, char fs, char ss) const
{
string str = _str;
vector<string> vec;
string word = "";
std::string str = _str;
std::vector<std::string> vec;
std::string word = "";
bool begin = false;
while (!str.empty())
@@ -426,13 +426,13 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
if (begin == true)
{
throw cv::Exception(CV_StsParseError,
string("error in split_range_string(")
std::string("error in split_range_string(")
+ str
+ string(", ")
+ string(1, fs)
+ string(", ")
+ string(1, ss)
+ string(")"),
+ std::string(", ")
+ std::string(1, fs)
+ std::string(", ")
+ std::string(1, ss)
+ std::string(")"),
"", __FILE__, __LINE__
);
}
@@ -446,13 +446,13 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
if (begin == false)
{
throw cv::Exception(CV_StsParseError,
string("error in split_range_string(")
std::string("error in split_range_string(")
+ str
+ string(", ")
+ string(1, fs)
+ string(", ")
+ string(1, ss)
+ string(")"),
+ std::string(", ")
+ std::string(1, fs)
+ std::string(", ")
+ std::string(1, ss)
+ std::string(")"),
"", __FILE__, __LINE__
);
}
@@ -470,13 +470,13 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
if (begin == true)
{
throw cv::Exception(CV_StsParseError,
string("error in split_range_string(")
std::string("error in split_range_string(")
+ str
+ string(", ")
+ string(1, fs)
+ string(", ")
+ string(1, ss)
+ string(")"),
+ std::string(", ")
+ std::string(1, fs)
+ std::string(", ")
+ std::string(1, ss)
+ std::string(")"),
"", __FILE__, __LINE__
);
}
@@ -484,11 +484,11 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
return vec;
}
vector<string> CommandLineParser::Impl::split_string(const string& _str, char symbol, bool create_empty_item) const
std::vector<std::string> CommandLineParser::Impl::split_string(const std::string& _str, char symbol, bool create_empty_item) const
{
string str = _str;
vector<string> vec;
string word = "";
std::string str = _str;
std::vector<std::string> vec;
std::string word = "";
while (!str.empty())
{

View File

@@ -344,7 +344,7 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
void cv::merge(InputArrayOfArrays _mv, OutputArray _dst)
{
vector<Mat> mv;
std::vector<Mat> mv;
_mv.getMatVector(mv);
merge(!mv.empty() ? &mv[0] : 0, mv.size(), _dst);
}
@@ -505,7 +505,7 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
}
void cv::mixChannels(const vector<Mat>& src, vector<Mat>& dst,
void cv::mixChannels(const std::vector<Mat>& src, std::vector<Mat>& dst,
const int* fromTo, size_t npairs)
{
mixChannels(!src.empty() ? &src[0] : 0, src.size(),
@@ -513,7 +513,7 @@ void cv::mixChannels(const vector<Mat>& src, vector<Mat>& dst,
}
void cv::mixChannels(InputArrayOfArrays src, InputArrayOfArrays dst,
const vector<int>& fromTo)
const std::vector<int>& fromTo)
{
if(fromTo.empty())
return;
@@ -1247,8 +1247,8 @@ cvSplit( const void* srcarr, void* dstarr0, void* dstarr1, void* dstarr2, void*
for( i = 0; i < 4; i++ )
nz += dptrs[i] != 0;
CV_Assert( nz > 0 );
cv::vector<cv::Mat> dvec(nz);
cv::vector<int> pairs(nz*2);
std::vector<cv::Mat> dvec(nz);
std::vector<int> pairs(nz*2);
for( i = j = 0; i < 4; i++ )
{
@@ -1283,8 +1283,8 @@ cvMerge( const void* srcarr0, const void* srcarr1, const void* srcarr2,
for( i = 0; i < 4; i++ )
nz += sptrs[i] != 0;
CV_Assert( nz > 0 );
cv::vector<cv::Mat> svec(nz);
cv::vector<int> pairs(nz*2);
std::vector<cv::Mat> svec(nz);
std::vector<int> pairs(nz*2);
for( i = j = 0; i < 4; i++ )
{

View File

@@ -3643,7 +3643,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
{
Mat _points = __points.getMat(), _labels = __labels.getMat();
CV_Assert(_points.type() == CV_32F && !_points.empty());
vector<KDTree::Node>().swap(nodes);
std::vector<KDTree::Node>().swap(nodes);
if( !_copyData )
points = _points;
@@ -3672,7 +3672,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
Mat sumstack(MAX_TREE_DEPTH*2, ptdims*2, CV_64F);
SubTree stack[MAX_TREE_DEPTH*2];
vector<size_t> _ptofs(n);
std::vector<size_t> _ptofs(n);
size_t* ptofs = &_ptofs[0];
for( i = 0; i < n; i++ )
@@ -3909,7 +3909,7 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
const float* L = lowerBound.ptr<float>();
const float* R = upperBound.ptr<float>();
vector<int> idx;
std::vector<int> idx;
AutoBuffer<int> _stack(MAX_TREE_DEPTH*2 + 1);
int* stack = _stack;
int top = 0;

View File

@@ -57,11 +57,11 @@ struct PolyEdge
static void
CollectPolyEdges( Mat& img, const Point* v, int npts,
vector<PolyEdge>& edges, const void* color, int line_type,
std::vector<PolyEdge>& edges, const void* color, int line_type,
int shift, Point offset=Point() );
static void
FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color );
FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color );
static void
PolyLine( Mat& img, const Point* v, int npts, bool closed,
@@ -835,7 +835,7 @@ sincos( int angle, float& cosval, float& sinval )
*/
void ellipse2Poly( Point center, Size axes, int angle,
int arc_start, int arc_end,
int delta, vector<Point>& pts )
int delta, std::vector<Point>& pts )
{
float alpha, beta;
double size_a = axes.width, size_b = axes.height;
@@ -904,7 +904,7 @@ EllipseEx( Mat& img, Point center, Size axes,
int delta = (std::max(axes.width,axes.height)+(XY_ONE>>1))>>XY_SHIFT;
delta = delta < 3 ? 90 : delta < 10 ? 30 : delta < 15 ? 18 : 5;
vector<Point> v;
std::vector<Point> v;
ellipse2Poly( center, axes, angle, arc_start, arc_end, delta, v );
if( thickness >= 0 )
@@ -914,7 +914,7 @@ EllipseEx( Mat& img, Point center, Size axes,
else
{
v.push_back(center);
vector<PolyEdge> edges;
std::vector<PolyEdge> edges;
CollectPolyEdges( img, &v[0], (int)v.size(), edges, color, line_type, XY_SHIFT );
FillEdgeCollection( img, edges, color );
}
@@ -1104,7 +1104,7 @@ FillConvexPoly( Mat& img, const Point* v, int npts, const void* color, int line_
/******** Arbitrary polygon **********/
static void
CollectPolyEdges( Mat& img, const Point* v, int count, vector<PolyEdge>& edges,
CollectPolyEdges( Mat& img, const Point* v, int count, std::vector<PolyEdge>& edges,
const void* color, int line_type, int shift, Point offset )
{
int i, delta = offset.y + (shift ? 1 << (shift - 1) : 0);
@@ -1170,7 +1170,7 @@ struct CmpEdges
/**************** helper macros and functions for sequence/contour processing ***********/
static void
FillEdgeCollection( Mat& img, vector<PolyEdge>& edges, const void* color )
FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
{
PolyEdge tmp;
int i, y, total = (int)edges.size();
@@ -1716,7 +1716,7 @@ void fillPoly( Mat& img, const Point** pts, const int* npts, int ncontours,
double buf[4];
scalarToRawData(color, buf, img.type(), 0);
vector<PolyEdge> edges;
std::vector<PolyEdge> edges;
int i, total = 0;
for( i = 0; i < ncontours; i++ )
@@ -1914,7 +1914,7 @@ static const int* getFontData(int fontFace)
}
void putText( Mat& img, const string& text, Point org,
void putText( Mat& img, const std::string& text, Point org,
int fontFace, double fontScale, Scalar color,
int thickness, int line_type, bool bottomLeftOrigin )
@@ -1935,7 +1935,7 @@ void putText( Mat& img, const string& text, Point org,
int view_x = org.x << XY_SHIFT;
int view_y = (org.y << XY_SHIFT) + base_line*vscale;
vector<Point> pts;
std::vector<Point> pts;
pts.reserve(1 << 10);
const char **faces = cv::g_HersheyGlyphs;
@@ -1976,7 +1976,7 @@ void putText( Mat& img, const string& text, Point org,
}
}
Size getTextSize( const string& text, int fontFace, double fontScale, int thickness, int* _base_line)
Size getTextSize( const std::string& text, int fontFace, double fontScale, int thickness, int* _base_line)
{
Size size;
double view_x = 0;
@@ -2076,8 +2076,8 @@ using namespace cv;
static void addChildContour(InputArrayOfArrays contours,
size_t ncontours,
const Vec4i* hierarchy,
int i, vector<CvSeq>& seq,
vector<CvSeqBlock>& block)
int i, std::vector<CvSeq>& seq,
std::vector<CvSeqBlock>& block)
{
for( ; i >= 0; i = hierarchy[i][0] )
{
@@ -2109,8 +2109,8 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
vector<CvSeq> seq;
vector<CvSeqBlock> block;
std::vector<CvSeq> seq;
std::vector<CvSeqBlock> block;
if( !last )
return;
@@ -2194,8 +2194,8 @@ cvDrawContours( void* _img, CvSeq* contour,
{
CvSeq *contour0 = contour, *h_next = 0;
CvTreeNodeIterator iterator;
cv::vector<cv::PolyEdge> edges;
cv::vector<cv::Point> pts;
std::vector<cv::PolyEdge> edges;
std::vector<cv::Point> pts;
cv::Scalar externalColor = _externalColor, holeColor = _holeColor;
cv::Mat img = cv::cvarrToMat(_img);
cv::Point offset = _offset;
@@ -2318,7 +2318,7 @@ CV_IMPL int
cvEllipse2Poly( CvPoint center, CvSize axes, int angle,
int arc_start, int arc_end, CvPoint* _pts, int delta )
{
cv::vector<cv::Point> pts;
std::vector<cv::Point> pts;
cv::ellipse2Poly( center, axes, angle, arc_start, arc_end, delta, pts );
memcpy( _pts, &pts[0], pts.size()*sizeof(_pts[0]) );
return (int)pts.size();

View File

@@ -60,10 +60,6 @@
#endif
#endif
using namespace std;
using namespace cv;
using namespace cv::gpu;
//////////////////////////////// Initialization & Info ////////////////////////
namespace
@@ -73,7 +69,7 @@ namespace
public:
CudaArch();
bool builtWith(FeatureSet feature_set) const;
bool builtWith(cv::gpu::FeatureSet feature_set) const;
bool hasPtx(int major, int minor) const;
bool hasBin(int major, int minor) const;
bool hasEqualOrLessPtx(int major, int minor) const;
@@ -81,11 +77,11 @@ namespace
bool hasEqualOrGreaterBin(int major, int minor) const;
private:
static void fromStr(const string& set_as_str, vector<int>& arr);
static void fromStr(const std::string& set_as_str, std::vector<int>& arr);
vector<int> bin;
vector<int> ptx;
vector<int> features;
std::vector<int> bin;
std::vector<int> ptx;
std::vector<int> features;
};
const CudaArch cudaArch;
@@ -99,19 +95,19 @@ namespace
#endif
}
bool CudaArch::builtWith(FeatureSet feature_set) const
bool CudaArch::builtWith(cv::gpu::FeatureSet feature_set) const
{
return !features.empty() && (features.back() >= feature_set);
}
bool CudaArch::hasPtx(int major, int minor) const
{
return find(ptx.begin(), ptx.end(), major * 10 + minor) != ptx.end();
return std::find(ptx.begin(), ptx.end(), major * 10 + minor) != ptx.end();
}
bool CudaArch::hasBin(int major, int minor) const
{
return find(bin.begin(), bin.end(), major * 10 + minor) != bin.end();
return std::find(bin.begin(), bin.end(), major * 10 + minor) != bin.end();
}
bool CudaArch::hasEqualOrLessPtx(int major, int minor) const
@@ -129,12 +125,12 @@ namespace
return !bin.empty() && (bin.back() >= major * 10 + minor);
}
void CudaArch::fromStr(const string& set_as_str, vector<int>& arr)
void CudaArch::fromStr(const std::string& set_as_str, std::vector<int>& arr)
{
if (set_as_str.find_first_not_of(" ") == string::npos)
if (set_as_str.find_first_not_of(" ") == std::string::npos)
return;
istringstream stream(set_as_str);
std::istringstream stream(set_as_str);
int cur_value;
while (!stream.eof())
@@ -143,7 +139,7 @@ namespace
arr.push_back(cur_value);
}
sort(arr.begin(), arr.end());
std::sort(arr.begin(), arr.end());
}
}
@@ -646,7 +642,7 @@ cv::gpu::GpuMat::GpuMat(const Mat& m) :
upload(m);
}
GpuMat& cv::gpu::GpuMat::operator = (const GpuMat& m)
cv::gpu::GpuMat& cv::gpu::GpuMat::operator = (const cv::gpu::GpuMat& m)
{
if (this != &m)
{
@@ -693,7 +689,7 @@ void cv::gpu::GpuMat::locateROI(Size& wholeSize, Point& ofs) const
wholeSize.width = std::max(static_cast<int>((delta2 - step * (wholeSize.height - 1)) / esz), ofs.x + cols);
}
GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)
cv::gpu::GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)
{
Size wholeSize;
Point ofs;
@@ -719,7 +715,7 @@ GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)
return *this;
}
GpuMat cv::gpu::GpuMat::reshape(int new_cn, int new_rows) const
cv::gpu::GpuMat cv::gpu::GpuMat::reshape(int new_cn, int new_rows) const
{
GpuMat hdr = *this;
@@ -762,7 +758,7 @@ GpuMat cv::gpu::GpuMat::reshape(int new_cn, int new_rows) const
return hdr;
}
cv::Mat::Mat(const GpuMat& m) : flags(0), dims(0), rows(0), cols(0), data(0), refcount(0), datastart(0), dataend(0), datalimit(0), allocator(0), size(&rows)
cv::Mat::Mat(const cv::gpu::GpuMat& m) : flags(0), dims(0), rows(0), cols(0), data(0), refcount(0), datastart(0), dataend(0), datalimit(0), allocator(0), size(&rows)
{
m.download(*this);
}
@@ -804,7 +800,7 @@ void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
}
}
GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
{
if (!mat.empty() && mat.type() == type && mat.rows >= rows && mat.cols >= cols)
return mat(Rect(0, 0, cols, rows));
@@ -818,16 +814,16 @@ namespace
public:
virtual ~GpuFuncTable() {}
virtual void copy(const Mat& src, GpuMat& dst) const = 0;
virtual void copy(const GpuMat& src, Mat& dst) const = 0;
virtual void copy(const GpuMat& src, GpuMat& dst) const = 0;
virtual void copy(const cv::Mat& src, cv::gpu::GpuMat& dst) const = 0;
virtual void copy(const cv::gpu::GpuMat& src, cv::Mat& dst) const = 0;
virtual void copy(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const = 0;
virtual void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const = 0;
virtual void copyWithMask(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask) const = 0;
virtual void convert(const GpuMat& src, GpuMat& dst) const = 0;
virtual void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const = 0;
virtual void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const = 0;
virtual void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, double alpha, double beta) const = 0;
virtual void setTo(GpuMat& m, Scalar s, const GpuMat& mask) const = 0;
virtual void setTo(cv::gpu::GpuMat& m, cv::Scalar s, const cv::gpu::GpuMat& mask) const = 0;
virtual void mallocPitch(void** devPtr, size_t* step, size_t width, size_t height) const = 0;
virtual void free(void* devPtr) const = 0;
@@ -841,16 +837,16 @@ namespace
class EmptyFuncTable : public GpuFuncTable
{
public:
void copy(const Mat&, GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copy(const GpuMat&, Mat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copy(const GpuMat&, GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copy(const cv::Mat&, cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copy(const cv::gpu::GpuMat&, cv::Mat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copy(const cv::gpu::GpuMat&, cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copyWithMask(const GpuMat&, GpuMat&, const GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void copyWithMask(const cv::gpu::GpuMat&, cv::gpu::GpuMat&, const cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void convert(const GpuMat&, GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void convert(const GpuMat&, GpuMat&, double, double) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void convert(const cv::gpu::GpuMat&, cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void convert(const cv::gpu::GpuMat&, cv::gpu::GpuMat&, double, double) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void setTo(GpuMat&, Scalar, const GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void setTo(cv::gpu::GpuMat&, cv::Scalar, const cv::gpu::GpuMat&) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void mallocPitch(void**, size_t*, size_t, size_t) const { CV_Error(CV_GpuNotSupported, "The library is compiled without CUDA support"); }
void free(void*) const {}
@@ -880,15 +876,15 @@ namespace cv { namespace gpu { namespace device
namespace
{
template <typename T> void kernelSetCaller(GpuMat& src, Scalar s, cudaStream_t stream)
template <typename T> void kernelSetCaller(cv::gpu::GpuMat& src, cv::Scalar s, cudaStream_t stream)
{
Scalar_<T> sf = s;
cv::Scalar_<T> sf = s;
cv::gpu::device::set_to_gpu(src, sf.val, src.channels(), stream);
}
template <typename T> void kernelSetCaller(GpuMat& src, Scalar s, const GpuMat& mask, cudaStream_t stream)
template <typename T> void kernelSetCaller(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask, cudaStream_t stream)
{
Scalar_<T> sf = s;
cv::Scalar_<T> sf = s;
cv::gpu::device::set_to_gpu(src, sf.val, mask, src.channels(), stream);
}
}
@@ -996,7 +992,7 @@ namespace
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
typedef typename NPPTypeTraits<DDEPTH>::npp_type dst_t;
static void call(const GpuMat& src, GpuMat& dst)
static void call(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst)
{
NppiSize sz;
sz.width = src.cols;
@@ -1011,7 +1007,7 @@ namespace
{
typedef typename NPPTypeTraits<DDEPTH>::npp_type dst_t;
static void call(const GpuMat& src, GpuMat& dst)
static void call(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst)
{
NppiSize sz;
sz.width = src.cols;
@@ -1051,13 +1047,13 @@ namespace
{
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
static void call(GpuMat& src, Scalar s)
static void call(cv::gpu::GpuMat& src, cv::Scalar s)
{
NppiSize sz;
sz.width = src.cols;
sz.height = src.rows;
Scalar_<src_t> nppS = s;
cv::Scalar_<src_t> nppS = s;
nppSafeCall( func(nppS.val, src.ptr<src_t>(), static_cast<int>(src.step), sz) );
@@ -1068,13 +1064,13 @@ namespace
{
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
static void call(GpuMat& src, Scalar s)
static void call(cv::gpu::GpuMat& src, cv::Scalar s)
{
NppiSize sz;
sz.width = src.cols;
sz.height = src.rows;
Scalar_<src_t> nppS = s;
cv::Scalar_<src_t> nppS = s;
nppSafeCall( func(nppS[0], src.ptr<src_t>(), static_cast<int>(src.step), sz) );
@@ -1099,13 +1095,13 @@ namespace
{
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
static void call(GpuMat& src, Scalar s, const GpuMat& mask)
static void call(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask)
{
NppiSize sz;
sz.width = src.cols;
sz.height = src.rows;
Scalar_<src_t> nppS = s;
cv::Scalar_<src_t> nppS = s;
nppSafeCall( func(nppS.val, src.ptr<src_t>(), static_cast<int>(src.step), sz, mask.ptr<Npp8u>(), static_cast<int>(mask.step)) );
@@ -1116,13 +1112,13 @@ namespace
{
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
static void call(GpuMat& src, Scalar s, const GpuMat& mask)
static void call(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask)
{
NppiSize sz;
sz.width = src.cols;
sz.height = src.rows;
Scalar_<src_t> nppS = s;
cv::Scalar_<src_t> nppS = s;
nppSafeCall( func(nppS[0], src.ptr<src_t>(), static_cast<int>(src.step), sz, mask.ptr<Npp8u>(), static_cast<int>(mask.step)) );
@@ -1144,7 +1140,7 @@ namespace
{
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;
static void call(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t /*stream*/)
static void call(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask, cudaStream_t /*stream*/)
{
NppiSize sz;
sz.width = src.cols;
@@ -1167,20 +1163,20 @@ namespace
class CudaFuncTable : public GpuFuncTable
{
public:
void copy(const Mat& src, GpuMat& dst) const
void copy(const cv::Mat& src, cv::gpu::GpuMat& dst) const
{
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyHostToDevice) );
}
void copy(const GpuMat& src, Mat& dst) const
void copy(const cv::gpu::GpuMat& src, cv::Mat& dst) const
{
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToHost) );
}
void copy(const GpuMat& src, GpuMat& dst) const
void copy(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const
{
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToDevice) );
}
void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const
void copyWithMask(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask) const
{
CV_Assert(src.depth() <= CV_64F && src.channels() <= 4);
CV_Assert(src.size() == dst.size() && src.type() == dst.type());
@@ -1188,11 +1184,11 @@ namespace
if (src.depth() == CV_64F)
{
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
}
typedef void (*func_t)(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream);
typedef void (*func_t)(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, const cv::gpu::GpuMat& mask, cudaStream_t stream);
static const func_t funcs[7][4] =
{
/* 8U */ {NppCopyMasked<CV_8U , nppiCopy_8u_C1MR >::call, cv::gpu::copyWithMask, NppCopyMasked<CV_8U , nppiCopy_8u_C3MR >::call, NppCopyMasked<CV_8U , nppiCopy_8u_C4MR >::call},
@@ -1209,9 +1205,9 @@ namespace
func(src, dst, mask, 0);
}
void convert(const GpuMat& src, GpuMat& dst) const
void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst) const
{
typedef void (*func_t)(const GpuMat& src, GpuMat& dst);
typedef void (*func_t)(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst);
static const func_t funcs[7][7][4] =
{
{
@@ -1285,7 +1281,7 @@ namespace
if (src.depth() == CV_64F || dst.depth() == CV_64F)
{
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
}
@@ -1302,21 +1298,21 @@ namespace
func(src, dst);
}
void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const
void convert(const cv::gpu::GpuMat& src, cv::gpu::GpuMat& dst, double alpha, double beta) const
{
CV_Assert(src.depth() <= CV_64F && src.channels() <= 4);
CV_Assert(dst.depth() <= CV_64F);
if (src.depth() == CV_64F || dst.depth() == CV_64F)
{
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
}
cv::gpu::convertTo(src, dst, alpha, beta);
}
void setTo(GpuMat& m, Scalar s, const GpuMat& mask) const
void setTo(cv::gpu::GpuMat& m, cv::Scalar s, const cv::gpu::GpuMat& mask) const
{
if (mask.empty())
{
@@ -1332,13 +1328,13 @@ namespace
if (cn == 1 || (cn == 2 && s[0] == s[1]) || (cn == 3 && s[0] == s[1] && s[0] == s[2]) || (cn == 4 && s[0] == s[1] && s[0] == s[2] && s[0] == s[3]))
{
int val = saturate_cast<uchar>(s[0]);
int val = cv::saturate_cast<uchar>(s[0]);
cudaSafeCall( cudaMemset2D(m.data, m.step, val, m.cols * m.elemSize(), m.rows) );
return;
}
}
typedef void (*func_t)(GpuMat& src, Scalar s);
typedef void (*func_t)(cv::gpu::GpuMat& src, cv::Scalar s);
static const func_t funcs[7][4] =
{
{NppSet<CV_8U , 1, nppiSet_8u_C1R >::call, cv::gpu::setTo , cv::gpu::setTo , NppSet<CV_8U , 4, nppiSet_8u_C4R >::call},
@@ -1354,7 +1350,7 @@ namespace
if (m.depth() == CV_64F)
{
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
}
@@ -1362,7 +1358,7 @@ namespace
}
else
{
typedef void (*func_t)(GpuMat& src, Scalar s, const GpuMat& mask);
typedef void (*func_t)(cv::gpu::GpuMat& src, cv::Scalar s, const cv::gpu::GpuMat& mask);
static const func_t funcs[7][4] =
{
{NppSetMask<CV_8U , 1, nppiSet_8u_C1MR >::call, cv::gpu::setTo, cv::gpu::setTo, NppSetMask<CV_8U , 4, nppiSet_8u_C4MR >::call},
@@ -1378,7 +1374,7 @@ namespace
if (m.depth() == CV_64F)
{
if (!TargetArchs::builtWith(NATIVE_DOUBLE) || !DeviceInfo().supports(NATIVE_DOUBLE))
if (!cv::gpu::TargetArchs::builtWith(cv::gpu::NATIVE_DOUBLE) || !cv::gpu::DeviceInfo().supports(cv::gpu::NATIVE_DOUBLE))
CV_Error(CV_StsUnsupportedFormat, "The device doesn't support double");
}
@@ -1406,7 +1402,7 @@ namespace
#endif // HAVE_CUDA
void cv::gpu::GpuMat::upload(const Mat& m)
void cv::gpu::GpuMat::upload(const cv::Mat& m)
{
CV_DbgAssert(!m.empty());
@@ -1415,7 +1411,7 @@ void cv::gpu::GpuMat::upload(const Mat& m)
gpuFuncTable()->copy(m, *this);
}
void cv::gpu::GpuMat::download(Mat& m) const
void cv::gpu::GpuMat::download(cv::Mat& m) const
{
CV_DbgAssert(!empty());
@@ -1424,7 +1420,7 @@ void cv::gpu::GpuMat::download(Mat& m) const
gpuFuncTable()->copy(*this, m);
}
void cv::gpu::GpuMat::copyTo(GpuMat& m) const
void cv::gpu::GpuMat::copyTo(cv::gpu::GpuMat& m) const
{
CV_DbgAssert(!empty());
@@ -1433,7 +1429,7 @@ void cv::gpu::GpuMat::copyTo(GpuMat& m) const
gpuFuncTable()->copy(*this, m);
}
void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const
void cv::gpu::GpuMat::copyTo(cv::gpu::GpuMat& mat, const cv::gpu::GpuMat& mask) const
{
if (mask.empty())
copyTo(mat);
@@ -1445,9 +1441,9 @@ void cv::gpu::GpuMat::copyTo(GpuMat& mat, const GpuMat& mask) const
}
}
void cv::gpu::GpuMat::convertTo(GpuMat& dst, int rtype, double alpha, double beta) const
void cv::gpu::GpuMat::convertTo(cv::gpu::GpuMat& dst, int rtype, double alpha, double beta) const
{
bool noScale = fabs(alpha - 1) < numeric_limits<double>::epsilon() && fabs(beta) < numeric_limits<double>::epsilon();
bool noScale = fabs(alpha - 1) < std::numeric_limits<double>::epsilon() && fabs(beta) < std::numeric_limits<double>::epsilon();
if (rtype < 0)
rtype = type();
@@ -1462,8 +1458,8 @@ void cv::gpu::GpuMat::convertTo(GpuMat& dst, int rtype, double alpha, double bet
return;
}
GpuMat temp;
const GpuMat* psrc = this;
cv::gpu::GpuMat temp;
const cv::gpu::GpuMat* psrc = this;
if (sdepth != ddepth && psrc == &dst)
{
temp = *this;
@@ -1478,7 +1474,7 @@ void cv::gpu::GpuMat::convertTo(GpuMat& dst, int rtype, double alpha, double bet
gpuFuncTable()->convert(*psrc, dst, alpha, beta);
}
GpuMat& cv::gpu::GpuMat::setTo(Scalar s, const GpuMat& mask)
cv::gpu::GpuMat& cv::gpu::GpuMat::setTo(cv::Scalar s, const cv::gpu::GpuMat& mask)
{
CV_Assert(mask.empty() || mask.type() == CV_8UC1);
CV_DbgAssert(!empty());
@@ -1502,7 +1498,7 @@ void cv::gpu::GpuMat::create(int _rows, int _cols, int _type)
if (_rows > 0 && _cols > 0)
{
flags = Mat::MAGIC_VAL + _type;
flags = cv::Mat::MAGIC_VAL + _type;
rows = _rows;
cols = _cols;
@@ -1516,7 +1512,7 @@ void cv::gpu::GpuMat::create(int _rows, int _cols, int _type)
step = esz * cols;
if (esz * cols == step)
flags |= Mat::CONTINUOUS_FLAG;
flags |= cv::Mat::CONTINUOUS_FLAG;
int64 _nettosize = static_cast<int64>(step) * rows;
size_t nettosize = static_cast<size_t>(_nettosize);
@@ -1550,13 +1546,13 @@ void cv::gpu::error(const char *error_string, const char *file, const int line,
{
int code = CV_GpuApiCallError;
if (uncaught_exception())
if (std::uncaught_exception())
{
const char* errorStr = cvErrorStr(code);
const char* function = func ? func : "unknown function";
cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;
cerr.flush();
std::cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;
std::cerr.flush();
}
else
cv::error( cv::Exception(code, error_string, func, file, line) );

View File

@@ -1991,7 +1991,7 @@ void pow( InputArray _src, double power, OutputArray _dst )
void sqrt(InputArray a, OutputArray b)
{
pow(a, 0.5, b);
cv::pow(a, 0.5, b);
}
/************************** CheckArray for NaN's, Inf's *********************************/
@@ -2396,7 +2396,7 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
double d = a2*a2 - 4*a1*a3;
if( d >= 0 )
{
d = sqrt(d);
d = std::sqrt(d);
double q1 = (-a2 + d) * 0.5;
double q2 = (a2 + d) * -0.5;
if( fabs(q1) > fabs(q2) )
@@ -2427,8 +2427,8 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
if( d >= 0 )
{
double theta = acos(R / sqrt(Qcubed));
double sqrtQ = sqrt(Q);
double theta = acos(R / std::sqrt(Qcubed));
double sqrtQ = std::sqrt(Q);
double t0 = -2 * sqrtQ;
double t1 = theta * (1./3);
double t2 = a1 * (1./3);
@@ -2440,8 +2440,8 @@ int cv::solveCubic( InputArray _coeffs, OutputArray _roots )
else
{
double e;
d = sqrt(-d);
e = pow(d + fabs(R), 0.333333333333);
d = std::sqrt(-d);
e = std::pow(d + fabs(R), 0.333333333333);
if( R > 0 )
e = -e;
x0 = (e + Q / e) - a1 * (1./3);
@@ -2519,7 +2519,7 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
}
num /= denom;
roots[i] = p - num;
maxDiff = max(maxDiff, abs(num));
maxDiff = std::max(maxDiff, cv::abs(num));
}
if( maxDiff <= 0 )
break;

View File

@@ -2151,7 +2151,7 @@ void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray
Mat _data(static_cast<int>(src.size()), size.area(), type);
int i = 0;
for(vector<cv::Mat>::iterator each = src.begin(); each != src.end(); each++, i++ )
for(std::vector<cv::Mat>::iterator each = src.begin(); each != src.end(); each++, i++ )
{
CV_Assert( (*each).size() == size && (*each).type() == type );
Mat dataRow(size.height, size.width, type, _data.ptr(i));

View File

@@ -931,7 +931,7 @@ void scalarToRawData(const Scalar& s, void* _buf, int type, int unroll_to)
_InputArray::_InputArray() : flags(0), obj(0) {}
_InputArray::~_InputArray() {}
_InputArray::_InputArray(const Mat& m) : flags(MAT), obj((void*)&m) {}
_InputArray::_InputArray(const vector<Mat>& vec) : flags(STD_VECTOR_MAT), obj((void*)&vec) {}
_InputArray::_InputArray(const std::vector<Mat>& vec) : flags(STD_VECTOR_MAT), obj((void*)&vec) {}
_InputArray::_InputArray(const double& val) : flags(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F), obj((void*)&val), sz(Size(1,1)) {}
_InputArray::_InputArray(const MatExpr& expr) : flags(FIXED_TYPE + FIXED_SIZE + EXPR), obj((void*)&expr) {}
_InputArray::_InputArray(const GlBuffer& buf) : flags(OPENGL_BUFFER), obj((void*)&buf) {}
@@ -966,7 +966,7 @@ Mat _InputArray::getMat(int i) const
{
CV_Assert( i < 0 );
int t = CV_MAT_TYPE(flags);
const vector<uchar>& v = *(const vector<uchar>*)obj;
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
return !v.empty() ? Mat(size(), t, (void*)&v[0]) : Mat();
}
@@ -977,9 +977,9 @@ Mat _InputArray::getMat(int i) const
if( k == STD_VECTOR_VECTOR )
{
int t = type(i);
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
CV_Assert( 0 <= i && i < (int)vv.size() );
const vector<uchar>& v = vv[i];
const std::vector<uchar>& v = vv[i];
return !v.empty() ? Mat(size(i), t, (void*)&v[0]) : Mat();
}
@@ -987,7 +987,7 @@ Mat _InputArray::getMat(int i) const
CV_Assert( k == STD_VECTOR_MAT );
//if( k == STD_VECTOR_MAT )
{
const vector<Mat>& v = *(const vector<Mat>*)obj;
const std::vector<Mat>& v = *(const std::vector<Mat>*)obj;
CV_Assert( 0 <= i && i < (int)v.size() );
return v[i];
@@ -995,7 +995,7 @@ Mat _InputArray::getMat(int i) const
}
void _InputArray::getMatVector(vector<Mat>& mv) const
void _InputArray::getMatVector(std::vector<Mat>& mv) const
{
int k = kind();
@@ -1034,7 +1034,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
if( k == STD_VECTOR )
{
const vector<uchar>& v = *(const vector<uchar>*)obj;
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
size_t i, n = v.size(), esz = CV_ELEM_SIZE(flags);
int t = CV_MAT_DEPTH(flags), cn = CV_MAT_CN(flags);
@@ -1053,14 +1053,14 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
if( k == STD_VECTOR_VECTOR )
{
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
int i, n = (int)vv.size();
int t = CV_MAT_TYPE(flags);
mv.resize(n);
for( i = 0; i < n; i++ )
{
const vector<uchar>& v = vv[i];
const std::vector<uchar>& v = vv[i];
mv[i] = Mat(size(i), t, (void*)&v[0]);
}
return;
@@ -1069,7 +1069,7 @@ void _InputArray::getMatVector(vector<Mat>& mv) const
CV_Assert( k == STD_VECTOR_MAT );
//if( k == STD_VECTOR_MAT )
{
const vector<Mat>& v = *(const vector<Mat>*)obj;
const std::vector<Mat>& v = *(const std::vector<Mat>*)obj;
mv.resize(v.size());
std::copy(v.begin(), v.end(), mv.begin());
return;
@@ -1142,8 +1142,8 @@ Size _InputArray::size(int i) const
if( k == STD_VECTOR )
{
CV_Assert( i < 0 );
const vector<uchar>& v = *(const vector<uchar>*)obj;
const vector<int>& iv = *(const vector<int>*)obj;
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
const std::vector<int>& iv = *(const std::vector<int>*)obj;
size_t szb = v.size(), szi = iv.size();
return szb == szi ? Size((int)szb, 1) : Size((int)(szb/CV_ELEM_SIZE(flags)), 1);
}
@@ -1153,11 +1153,11 @@ Size _InputArray::size(int i) const
if( k == STD_VECTOR_VECTOR )
{
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
if( i < 0 )
return vv.empty() ? Size() : Size((int)vv.size(), 1);
CV_Assert( i < (int)vv.size() );
const vector<vector<int> >& ivv = *(const vector<vector<int> >*)obj;
const std::vector<std::vector<int> >& ivv = *(const std::vector<std::vector<int> >*)obj;
size_t szb = vv[i].size(), szi = ivv[i].size();
return szb == szi ? Size((int)szb, 1) : Size((int)(szb/CV_ELEM_SIZE(flags)), 1);
@@ -1165,7 +1165,7 @@ Size _InputArray::size(int i) const
if( k == STD_VECTOR_MAT )
{
const vector<Mat>& vv = *(const vector<Mat>*)obj;
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
if( i < 0 )
return vv.empty() ? Size() : Size((int)vv.size(), 1);
CV_Assert( i < (int)vv.size() );
@@ -1208,7 +1208,7 @@ size_t _InputArray::total(int i) const
if( k == STD_VECTOR_MAT )
{
const vector<Mat>& vv = *(const vector<Mat>*)obj;
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
if( i < 0 )
return vv.size();
@@ -1237,7 +1237,7 @@ int _InputArray::type(int i) const
if( k == STD_VECTOR_MAT )
{
const vector<Mat>& vv = *(const vector<Mat>*)obj;
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
CV_Assert( i < (int)vv.size() );
return vv[i >= 0 ? i : 0].type();
@@ -1276,7 +1276,7 @@ bool _InputArray::empty() const
if( k == STD_VECTOR )
{
const vector<uchar>& v = *(const vector<uchar>*)obj;
const std::vector<uchar>& v = *(const std::vector<uchar>*)obj;
return v.empty();
}
@@ -1285,13 +1285,13 @@ bool _InputArray::empty() const
if( k == STD_VECTOR_VECTOR )
{
const vector<vector<uchar> >& vv = *(const vector<vector<uchar> >*)obj;
const std::vector<std::vector<uchar> >& vv = *(const std::vector<std::vector<uchar> >*)obj;
return vv.empty();
}
if( k == STD_VECTOR_MAT )
{
const vector<Mat>& vv = *(const vector<Mat>*)obj;
const std::vector<Mat>& vv = *(const std::vector<Mat>*)obj;
return vv.empty();
}
@@ -1310,13 +1310,13 @@ bool _InputArray::empty() const
_OutputArray::_OutputArray() {}
_OutputArray::~_OutputArray() {}
_OutputArray::_OutputArray(Mat& m) : _InputArray(m) {}
_OutputArray::_OutputArray(vector<Mat>& vec) : _InputArray(vec) {}
_OutputArray::_OutputArray(std::vector<Mat>& vec) : _InputArray(vec) {}
_OutputArray::_OutputArray(gpu::GpuMat& d_mat) : _InputArray(d_mat) {}
_OutputArray::_OutputArray(GlBuffer& buf) : _InputArray(buf) {}
_OutputArray::_OutputArray(GlTexture2D& tex) : _InputArray(tex) {}
_OutputArray::_OutputArray(const Mat& m) : _InputArray(m) {flags |= FIXED_SIZE|FIXED_TYPE;}
_OutputArray::_OutputArray(const vector<Mat>& vec) : _InputArray(vec) {flags |= FIXED_SIZE;}
_OutputArray::_OutputArray(const std::vector<Mat>& vec) : _InputArray(vec) {flags |= FIXED_SIZE;}
_OutputArray::_OutputArray(const gpu::GpuMat& d_mat) : _InputArray(d_mat) {flags |= FIXED_SIZE|FIXED_TYPE;}
_OutputArray::_OutputArray(const GlBuffer& buf) : _InputArray(buf) {flags |= FIXED_SIZE|FIXED_TYPE;}
_OutputArray::_OutputArray(const GlTexture2D& tex) : _InputArray(tex) {flags |= FIXED_SIZE|FIXED_TYPE;}
@@ -1441,11 +1441,11 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
{
CV_Assert( dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) );
size_t len = sizes[0]*sizes[1] > 0 ? sizes[0] + sizes[1] - 1 : 0;
vector<uchar>* v = (vector<uchar>*)obj;
std::vector<uchar>* v = (std::vector<uchar>*)obj;
if( k == STD_VECTOR_VECTOR )
{
vector<vector<uchar> >& vv = *(vector<vector<uchar> >*)obj;
std::vector<std::vector<uchar> >& vv = *(std::vector<std::vector<uchar> >*)obj;
if( i < 0 )
{
CV_Assert(!fixedSize() || len == vv.size());
@@ -1462,56 +1462,56 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
CV_Assert( mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) );
int esz = CV_ELEM_SIZE(type0);
CV_Assert(!fixedSize() || len == ((vector<uchar>*)v)->size() / esz);
CV_Assert(!fixedSize() || len == ((std::vector<uchar>*)v)->size() / esz);
switch( esz )
{
case 1:
((vector<uchar>*)v)->resize(len);
((std::vector<uchar>*)v)->resize(len);
break;
case 2:
((vector<Vec2b>*)v)->resize(len);
((std::vector<Vec2b>*)v)->resize(len);
break;
case 3:
((vector<Vec3b>*)v)->resize(len);
((std::vector<Vec3b>*)v)->resize(len);
break;
case 4:
((vector<int>*)v)->resize(len);
((std::vector<int>*)v)->resize(len);
break;
case 6:
((vector<Vec3s>*)v)->resize(len);
((std::vector<Vec3s>*)v)->resize(len);
break;
case 8:
((vector<Vec2i>*)v)->resize(len);
((std::vector<Vec2i>*)v)->resize(len);
break;
case 12:
((vector<Vec3i>*)v)->resize(len);
((std::vector<Vec3i>*)v)->resize(len);
break;
case 16:
((vector<Vec4i>*)v)->resize(len);
((std::vector<Vec4i>*)v)->resize(len);
break;
case 24:
((vector<Vec6i>*)v)->resize(len);
((std::vector<Vec6i>*)v)->resize(len);
break;
case 32:
((vector<Vec8i>*)v)->resize(len);
((std::vector<Vec8i>*)v)->resize(len);
break;
case 36:
((vector<Vec<int, 9> >*)v)->resize(len);
((std::vector<Vec<int, 9> >*)v)->resize(len);
break;
case 48:
((vector<Vec<int, 12> >*)v)->resize(len);
((std::vector<Vec<int, 12> >*)v)->resize(len);
break;
case 64:
((vector<Vec<int, 16> >*)v)->resize(len);
((std::vector<Vec<int, 16> >*)v)->resize(len);
break;
case 128:
((vector<Vec<int, 32> >*)v)->resize(len);
((std::vector<Vec<int, 32> >*)v)->resize(len);
break;
case 256:
((vector<Vec<int, 64> >*)v)->resize(len);
((std::vector<Vec<int, 64> >*)v)->resize(len);
break;
case 512:
((vector<Vec<int, 128> >*)v)->resize(len);
((std::vector<Vec<int, 128> >*)v)->resize(len);
break;
default:
CV_Error_(CV_StsBadArg, ("Vectors with element size %d are not supported. Please, modify OutputArray::create()\n", esz));
@@ -1528,7 +1528,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
CV_Assert( k == STD_VECTOR_MAT );
//if( k == STD_VECTOR_MAT )
{
vector<Mat>& v = *(vector<Mat>*)obj;
std::vector<Mat>& v = *(std::vector<Mat>*)obj;
if( i < 0 )
{
@@ -1626,14 +1626,14 @@ void _OutputArray::release() const
if( k == STD_VECTOR_VECTOR )
{
((vector<vector<uchar> >*)obj)->clear();
((std::vector<std::vector<uchar> >*)obj)->clear();
return;
}
CV_Assert( k == STD_VECTOR_MAT );
//if( k == STD_VECTOR_MAT )
{
((vector<Mat>*)obj)->clear();
((std::vector<Mat>*)obj)->clear();
}
}
@@ -1667,7 +1667,7 @@ Mat& _OutputArray::getMatRef(int i) const
else
{
CV_Assert( k == STD_VECTOR_MAT );
vector<Mat>& v = *(vector<Mat>*)obj;
std::vector<Mat>& v = *(std::vector<Mat>*)obj;
CV_Assert( i < (int)v.size() );
return v[i];
}
@@ -1738,7 +1738,7 @@ void cv::hconcat(InputArray src1, InputArray src2, OutputArray dst)
void cv::hconcat(InputArray _src, OutputArray dst)
{
vector<Mat> src;
std::vector<Mat> src;
_src.getMatVector(src);
hconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
}
@@ -1778,7 +1778,7 @@ void cv::vconcat(InputArray src1, InputArray src2, OutputArray dst)
void cv::vconcat(InputArray _src, OutputArray dst)
{
vector<Mat> src;
std::vector<Mat> src;
_src.getMatVector(src);
vconcat(!src.empty() ? &src[0] : 0, src.size(), dst);
}
@@ -2504,7 +2504,7 @@ void cv::sortIdx( InputArray _src, OutputArray _dst, int flags )
namespace cv
{
static void generateRandomCenter(const vector<Vec2f>& box, float* center, RNG& rng)
static void generateRandomCenter(const std::vector<Vec2f>& box, float* center, RNG& rng)
{
size_t j, dims = box.size();
float margin = 1.f/dims;
@@ -2560,9 +2560,9 @@ static void generateCentersPP(const Mat& _data, Mat& _out_centers,
int i, j, k, dims = _data.cols, N = _data.rows;
const float* data = _data.ptr<float>(0);
size_t step = _data.step/sizeof(data[0]);
vector<int> _centers(K);
std::vector<int> _centers(K);
int* centers = &_centers[0];
vector<float> _dist(N*3);
std::vector<float> _dist(N*3);
float* dist = &_dist[0], *tdist = dist + N, *tdist2 = tdist + N;
double sum0 = 0;
@@ -2710,8 +2710,8 @@ double cv::kmeans( InputArray _data, int K,
int* labels = _labels.ptr<int>();
Mat centers(K, dims, type), old_centers(K, dims, type), temp(1, dims, type);
vector<int> counters(K);
vector<Vec2f> _box(dims);
std::vector<int> counters(K);
std::vector<Vec2f> _box(dims);
Vec2f* box = &_box[0];
double best_compactness = DBL_MAX, compactness = 0;
RNG& rng = theRNG();
@@ -3973,7 +3973,7 @@ void SparseMat::resizeHashTab(size_t newsize)
newsize = (size_t)1 << cvCeil(std::log((double)newsize)/CV_LOG2);
size_t i, hsize = hdr->hashtab.size();
vector<size_t> _newh(newsize);
std::vector<size_t> _newh(newsize);
size_t* newh = &_newh[0];
for( i = 0; i < newsize; i++ )
newh[i] = 0;
@@ -4062,7 +4062,7 @@ SparseMatConstIterator::SparseMatConstIterator(const SparseMat* _m)
if(!_m || !_m->hdr)
return;
SparseMat::Hdr& hdr = *m->hdr;
const vector<size_t>& htab = hdr.hashtab;
const std::vector<size_t>& htab = hdr.hashtab;
size_t i, hsize = htab.size();
for( i = 0; i < hsize; i++ )
{
@@ -4252,10 +4252,10 @@ Rect RotatedRect::boundingRect() const
{
Point2f pt[4];
points(pt);
Rect r(cvFloor(min(min(min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
cvFloor(min(min(min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
cvCeil(max(max(max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
cvCeil(max(max(max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
Rect r(cvFloor(std::min(std::min(std::min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
cvFloor(std::min(std::min(std::min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
cvCeil(std::max(std::max(std::max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
cvCeil(std::max(std::max(std::max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
r.width -= r.x - 1;
r.height -= r.y - 1;
return r;

View File

@@ -53,10 +53,6 @@
#endif
#endif
using namespace std;
using namespace cv;
using namespace cv::gpu;
namespace
{
#ifndef HAVE_OPENGL
@@ -363,7 +359,7 @@ private:
#endif
};
const Ptr<cv::GlBuffer::Impl>& cv::GlBuffer::Impl::empty()
const cv::Ptr<cv::GlBuffer::Impl>& cv::GlBuffer::Impl::empty()
{
static Ptr<Impl> p(new Impl);
return p;
@@ -720,7 +716,7 @@ void cv::GlBuffer::copyTo(OutputArray arr, Target target, bool autoRelease) cons
#endif
}
GlBuffer cv::GlBuffer::clone(Target target, bool autoRelease) const
cv::GlBuffer cv::GlBuffer::clone(Target target, bool autoRelease) const
{
#ifndef HAVE_OPENGL
(void) target;
@@ -755,14 +751,14 @@ void cv::GlBuffer::unbind(Target target)
#endif
}
Mat cv::GlBuffer::mapHost(Access access)
cv::Mat cv::GlBuffer::mapHost(Access access)
{
#ifndef HAVE_OPENGL
(void) access;
throw_nogl();
return Mat();
return cv::Mat();
#else
return Mat(rows_, cols_, type_, impl_->mapHost(access));
return cv::Mat(rows_, cols_, type_, impl_->mapHost(access));
#endif
}
@@ -775,17 +771,17 @@ void cv::GlBuffer::unmapHost()
#endif
}
GpuMat cv::GlBuffer::mapDevice()
cv::gpu::GpuMat cv::GlBuffer::mapDevice()
{
#ifndef HAVE_OPENGL
throw_nogl();
return GpuMat();
return cv::gpu::GpuMat();
#else
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
throw_nocuda();
return GpuMat();
return cv::gpu::GpuMat();
#else
return GpuMat(rows_, cols_, type_, impl_->mapDevice());
return cv::gpu::GpuMat(rows_, cols_, type_, impl_->mapDevice());
#endif
#endif
}
@@ -854,7 +850,7 @@ private:
bool autoRelease_;
};
const Ptr<cv::GlTexture2D::Impl> cv::GlTexture2D::Impl::empty()
const cv::Ptr<cv::GlTexture2D::Impl> cv::GlTexture2D::Impl::empty()
{
static Ptr<Impl> p(new Impl);
return p;

View File

@@ -282,7 +282,7 @@ const Formatter* Formatter::setDefault(const Formatter* fmt)
}
Formatted::Formatted(const Mat& _m, const Formatter* _fmt,
const vector<int>& _params)
const std::vector<int>& _params)
{
mtx = _m;
fmt = _fmt ? _fmt : Formatter::get();

View File

@@ -116,7 +116,7 @@ static char* icv_itoa( int _val, char* buffer, int /*radix*/ )
return ptr;
}
cv::string cv::FileStorage::getDefaultObjectName(const string& _filename)
std::string cv::FileStorage::getDefaultObjectName(const std::string& _filename)
{
static const char* stubname = "unnamed";
const char* filename = _filename.c_str();
@@ -152,7 +152,7 @@ cv::string cv::FileStorage::getDefaultObjectName(const string& _filename)
name = name_buf;
if( strcmp( name, "_" ) == 0 )
strcpy( name, stubname );
return cv::string(name);
return std::string(name);
}
typedef struct CvGenericHash
@@ -5011,7 +5011,7 @@ cvSave( const char* filename, const void* struct_ptr,
if( !fs )
CV_Error( CV_StsError, "Could not open the file storage. Check the path and permissions" );
cv::string name = _name ? cv::string(_name) : cv::FileStorage::getDefaultObjectName(filename);
std::string name = _name ? std::string(_name) : cv::FileStorage::getDefaultObjectName(filename);
if( comment )
cvWriteComment( fs, comment, 0 );
@@ -5105,7 +5105,7 @@ stop_search:
namespace cv
{
static void getElemSize( const string& fmt, size_t& elemSize, size_t& cn )
static void getElemSize( const std::string& fmt, size_t& elemSize, size_t& cn )
{
const char* dt = fmt.c_str();
cn = 1;
@@ -5125,7 +5125,7 @@ FileStorage::FileStorage()
state = UNDEFINED;
}
FileStorage::FileStorage(const string& filename, int flags, const string& encoding)
FileStorage::FileStorage(const std::string& filename, int flags, const std::string& encoding)
{
state = UNDEFINED;
open( filename, flags, encoding );
@@ -5146,7 +5146,7 @@ FileStorage::~FileStorage()
}
}
bool FileStorage::open(const string& filename, int flags, const string& encoding)
bool FileStorage::open(const std::string& filename, int flags, const std::string& encoding)
{
release();
fs = Ptr<CvFileStorage>(cvOpenFileStorage( filename.c_str(), 0, flags,
@@ -5168,9 +5168,9 @@ void FileStorage::release()
state = UNDEFINED;
}
string FileStorage::releaseAndGetString()
std::string FileStorage::releaseAndGetString()
{
string buf;
std::string buf;
buf.reserve(16); // HACK: Work around for compiler bug
if( fs.obj && fs.obj->outbuf )
icvClose(fs.obj, &buf);
@@ -5184,7 +5184,7 @@ FileNode FileStorage::root(int streamidx) const
return isOpened() ? FileNode(fs, cvGetRootFileNode(fs, streamidx)) : FileNode();
}
FileStorage& operator << (FileStorage& fs, const string& str)
FileStorage& operator << (FileStorage& fs, const std::string& str)
{
enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED,
VALUE_EXPECTED = FileStorage::VALUE_EXPECTED,
@@ -5203,7 +5203,7 @@ FileStorage& operator << (FileStorage& fs, const string& str)
fs.state = fs.structs.empty() || fs.structs.back() == '{' ?
INSIDE_MAP + NAME_EXPECTED : VALUE_EXPECTED;
cvEndWriteStruct( *fs );
fs.elname = string();
fs.elname = std::string();
}
else if( fs.state == NAME_EXPECTED + INSIDE_MAP )
{
@@ -5227,12 +5227,12 @@ FileStorage& operator << (FileStorage& fs, const string& str)
}
cvStartWriteStruct( *fs, fs.elname.size() > 0 ? fs.elname.c_str() : 0,
flags, *_str ? _str : 0 );
fs.elname = string();
fs.elname = std::string();
}
else
{
write( fs, fs.elname, (_str[0] == '\\' && (_str[1] == '{' || _str[1] == '}' ||
_str[1] == '[' || _str[1] == ']')) ? string(_str+1) : str );
_str[1] == '[' || _str[1] == ']')) ? std::string(_str+1) : str );
if( fs.state == INSIDE_MAP + VALUE_EXPECTED )
fs.state = INSIDE_MAP + NAME_EXPECTED;
}
@@ -5243,7 +5243,7 @@ FileStorage& operator << (FileStorage& fs, const string& str)
}
void FileStorage::writeRaw( const string& fmt, const uchar* vec, size_t len )
void FileStorage::writeRaw( const std::string& fmt, const uchar* vec, size_t len )
{
if( !isOpened() )
return;
@@ -5254,7 +5254,7 @@ void FileStorage::writeRaw( const string& fmt, const uchar* vec, size_t len )
}
void FileStorage::writeObj( const string& name, const void* obj )
void FileStorage::writeObj( const std::string& name, const void* obj )
{
if( !isOpened() )
return;
@@ -5262,7 +5262,7 @@ void FileStorage::writeObj( const string& name, const void* obj )
}
FileNode FileStorage::operator[](const string& nodename) const
FileNode FileStorage::operator[](const std::string& nodename) const
{
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename.c_str()));
}
@@ -5272,7 +5272,7 @@ FileNode FileStorage::operator[](const char* nodename) const
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename));
}
FileNode FileNode::operator[](const string& nodename) const
FileNode FileNode::operator[](const std::string& nodename) const
{
return FileNode(fs, cvGetFileNodeByName(fs, node, nodename.c_str()));
}
@@ -5288,10 +5288,10 @@ FileNode FileNode::operator[](int i) const
i == 0 ? *this : FileNode();
}
string FileNode::name() const
std::string FileNode::name() const
{
const char* str;
return !node || (str = cvGetFileNodeName(node)) == 0 ? string() : string(str);
return !node || (str = cvGetFileNodeName(node)) == 0 ? std::string() : std::string(str);
}
void* FileNode::readObj() const
@@ -5406,7 +5406,7 @@ FileNodeIterator& FileNodeIterator::operator -= (int ofs)
}
FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size_t maxCount )
FileNodeIterator& FileNodeIterator::readRaw( const std::string& fmt, uchar* vec, size_t maxCount )
{
if( fs && container && remaining > 0 )
{
@@ -5430,16 +5430,16 @@ FileNodeIterator& FileNodeIterator::readRaw( const string& fmt, uchar* vec, size
}
void write( FileStorage& fs, const string& name, int value )
void write( FileStorage& fs, const std::string& name, int value )
{ cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); }
void write( FileStorage& fs, const string& name, float value )
void write( FileStorage& fs, const std::string& name, float value )
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
void write( FileStorage& fs, const string& name, double value )
void write( FileStorage& fs, const std::string& name, double value )
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
void write( FileStorage& fs, const string& name, const string& value )
void write( FileStorage& fs, const std::string& name, const std::string& value )
{ cvWriteString( *fs, name.size() ? name.c_str() : 0, value.c_str() ); }
void writeScalar(FileStorage& fs, int value )
@@ -5451,11 +5451,11 @@ void writeScalar(FileStorage& fs, float value )
void writeScalar(FileStorage& fs, double value )
{ cvWriteReal( *fs, 0, value ); }
void writeScalar(FileStorage& fs, const string& value )
void writeScalar(FileStorage& fs, const std::string& value )
{ cvWriteString( *fs, 0, value.c_str() ); }
void write( FileStorage& fs, const string& name, const Mat& value )
void write( FileStorage& fs, const std::string& name, const Mat& value )
{
if( value.dims <= 2 )
{
@@ -5470,15 +5470,15 @@ void write( FileStorage& fs, const string& name, const Mat& value )
}
// TODO: the 4 functions below need to be implemented more efficiently
void write( FileStorage& fs, const string& name, const SparseMat& value )
void write( FileStorage& fs, const std::string& name, const SparseMat& value )
{
Ptr<CvSparseMat> mat = (CvSparseMat*)value;
cvWrite( *fs, name.size() ? name.c_str() : 0, mat );
}
WriteStructContext::WriteStructContext(FileStorage& _fs, const string& name,
int flags, const string& typeName) : fs(&_fs)
WriteStructContext::WriteStructContext(FileStorage& _fs, const std::string& name,
int flags, const std::string& typeName) : fs(&_fs)
{
cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags,
!typeName.empty() ? typeName.c_str() : 0);

View File

@@ -537,13 +537,13 @@ void RNG::fill( InputOutputArray _mat, int disttype,
ip = (Vec2i*)(parambuf + cn*2);
for( j = 0, fast_int_mode = 1; j < cn; j++ )
{
double a = min(p1[j], p2[j]);
double b = max(p1[j], p2[j]);
double a = std::min(p1[j], p2[j]);
double b = std::max(p1[j], p2[j]);
if( saturateRange )
{
a = max(a, depth == CV_8U || depth == CV_16U ? 0. :
a = std::max(a, depth == CV_8U || depth == CV_16U ? 0. :
depth == CV_8S ? -128. : depth == CV_16S ? -32768. : (double)INT_MIN);
b = min(b, depth == CV_8U ? 256. : depth == CV_16U ? 65536. :
b = std::min(b, depth == CV_8U ? 256. : depth == CV_16U ? 65536. :
depth == CV_8S ? 128. : depth == CV_16S ? 32768. : (double)INT_MAX);
}
ip[j][1] = cvCeil(a);
@@ -573,8 +573,8 @@ void RNG::fill( InputOutputArray _mat, int disttype,
while(((uint64)1 << l) < d)
l++;
ds[j].M = (unsigned)(((uint64)1 << 32)*(((uint64)1 << l) - d)/d) + 1;
ds[j].sh1 = min(l, 1);
ds[j].sh2 = max(l - 1, 0);
ds[j].sh1 = std::min(l, 1);
ds[j].sh2 = std::max(l - 1, 0);
}
}

View File

@@ -113,7 +113,7 @@ namespace cv
Exception::Exception() { code = 0; line = 0; }
Exception::Exception(int _code, const string& _err, const string& _func, const string& _file, int _line)
Exception::Exception(int _code, const std::string& _err, const std::string& _func, const std::string& _file, int _line)
: code(_code), err(_err), func(_func), file(_file), line(_line)
{
formatMessage();
@@ -348,19 +348,19 @@ const std::string& getBuildInformation()
return build_info;
}
string format( const char* fmt, ... )
std::string format( const char* fmt, ... )
{
char buf[1 << 16];
va_list args;
va_start( args, fmt );
vsprintf( buf, fmt, args );
return string(buf);
return std::string(buf);
}
string tempfile( const char* suffix )
std::string tempfile( const char* suffix )
{
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
string fname;
std::string fname;
#if defined WIN32 || defined _WIN32
char temp_dir2[MAX_PATH + 1] = { 0 };
@@ -372,7 +372,7 @@ string tempfile( const char* suffix )
temp_dir = temp_dir2;
}
if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file))
return string();
return std::string();
DeleteFileA(temp_file);
@@ -397,7 +397,7 @@ string tempfile( const char* suffix )
}
const int fd = mkstemp((char*)fname.c_str());
if (fd == -1) return string();
if (fd == -1) return std::string();
close(fd);
remove(fname.c_str());