Drop cv:: prefix from cv::String used inside the cv namespace

This commit is contained in:
Andrey Kamaev
2013-03-22 20:37:49 +04:00
parent 75513a46dc
commit be7bbe3aa9
122 changed files with 1077 additions and 1077 deletions

View File

@@ -35,7 +35,7 @@ inline void readFileNodeList(const FileNode& fn, std::vector<_Tp>& result) {
// Writes the a list of given items to a cv::FileStorage.
template<typename _Tp>
inline void writeFileNodeList(FileStorage& fs, const cv::String& name,
inline void writeFileNodeList(FileStorage& fs, const String& name,
const std::vector<_Tp>& items) {
// typedefs
typedef typename std::vector<_Tp>::const_iterator constVecIterator;
@@ -50,7 +50,7 @@ inline void writeFileNodeList(FileStorage& fs, const cv::String& name,
static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double beta=0) {
// make sure the input data is a vector of matrices or vector of vector
if(src.kind() != _InputArray::STD_VECTOR_MAT && src.kind() != _InputArray::STD_VECTOR_VECTOR) {
cv::String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message);
}
// number of samples
@@ -66,7 +66,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
for(unsigned int i = 0; i < n; i++) {
// make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total() != d) {
cv::String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message);
}
// get a hold of the current row
@@ -305,11 +305,11 @@ void FaceRecognizer::update(InputArrayOfArrays src, InputArray labels ) {
return;
}
cv::String error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
String error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
CV_Error(CV_StsNotImplemented, error_msg);
}
void FaceRecognizer::save(const cv::String& filename) const {
void FaceRecognizer::save(const String& filename) const {
FileStorage fs(filename, FileStorage::WRITE);
if (!fs.isOpened())
CV_Error(CV_StsError, "File can't be opened for writing!");
@@ -317,7 +317,7 @@ void FaceRecognizer::save(const cv::String& filename) const {
fs.release();
}
void FaceRecognizer::load(const cv::String& filename) {
void FaceRecognizer::load(const String& filename) {
FileStorage fs(filename, FileStorage::READ);
if (!fs.isOpened())
CV_Error(CV_StsError, "File can't be opened for writing!");
@@ -330,17 +330,17 @@ void FaceRecognizer::load(const cv::String& filename) {
//------------------------------------------------------------------------------
void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
if(_src.total() == 0) {
cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsBadArg, error_message);
} else if(_local_labels.getMat().type() != CV_32SC1) {
cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
CV_Error(CV_StsBadArg, error_message);
}
// make sure data has correct size
if(_src.total() > 1) {
for(int i = 1; i < static_cast<int>(_src.total()); i++) {
if(_src.getMat(i-1).total() != _src.getMat(i).total()) {
cv::String error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
String error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
CV_Error(CV_StsUnsupportedFormat, error_message);
}
}
@@ -354,7 +354,7 @@ void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
int n = data.rows;
// assert there are as much samples as labels
if(static_cast<int>(labels.total()) != n) {
cv::String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
CV_Error(CV_StsBadArg, error_message);
}
// clear existing model data
@@ -385,11 +385,11 @@ void Eigenfaces::predict(InputArray _src, int &minClass, double &minDist) const
// make sure the user is passing correct data
if(_projections.empty()) {
// throw error if no data (or simply return -1?)
cv::String error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
String error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
CV_Error(CV_StsError, error_message);
} else if(_eigenvectors.rows != static_cast<int>(src.total())) {
// check data alignment just for clearer exception messages
cv::String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
CV_Error(CV_StsBadArg, error_message);
}
// project into PCA subspace
@@ -439,17 +439,17 @@ void Eigenfaces::save(FileStorage& fs) const {
//------------------------------------------------------------------------------
void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
if(src.total() == 0) {
cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsBadArg, error_message);
} else if(_lbls.getMat().type() != CV_32SC1) {
cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
CV_Error(CV_StsBadArg, error_message);
}
// make sure data has correct size
if(src.total() > 1) {
for(int i = 1; i < static_cast<int>(src.total()); i++) {
if(src.getMat(i-1).total() != src.getMat(i).total()) {
cv::String error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
String error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
CV_Error(CV_StsUnsupportedFormat, error_message);
}
}
@@ -461,10 +461,10 @@ void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
int N = data.rows;
// make sure labels are passed in correct shape
if(labels.total() != (size_t) N) {
cv::String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
CV_Error(CV_StsBadArg, error_message);
} else if(labels.rows != 1 && labels.cols != 1) {
cv::String error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
String error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
CV_Error(CV_StsBadArg, error_message);
}
// clear existing model data
@@ -505,10 +505,10 @@ void Fisherfaces::predict(InputArray _src, int &minClass, double &minDist) const
// check data alignment just for clearer exception messages
if(_projections.empty()) {
// throw error if no data (or simply return -1?)
cv::String error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
String error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
CV_Error(CV_StsBadArg, error_message);
} else if(src.total() != (size_t) _eigenvectors.rows) {
cv::String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
CV_Error(CV_StsBadArg, error_message);
}
// project into LDA subspace
@@ -640,7 +640,7 @@ static void elbp(InputArray src, OutputArray dst, int radius, int neighbors)
case CV_32FC1: elbp_<float>(src,dst, radius, neighbors); break;
case CV_64FC1: elbp_<double>(src,dst, radius, neighbors); break;
default:
cv::String error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
String error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
CV_Error(CV_StsNotImplemented, error_msg);
break;
}
@@ -768,14 +768,14 @@ void LBPH::update(InputArrayOfArrays _in_src, InputArray _in_labels) {
void LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserveData) {
if(_in_src.kind() != _InputArray::STD_VECTOR_MAT && _in_src.kind() != _InputArray::STD_VECTOR_VECTOR) {
cv::String error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
String error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message);
}
if(_in_src.total() == 0) {
cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsUnsupportedFormat, error_message);
} else if(_in_labels.getMat().type() != CV_32SC1) {
cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
CV_Error(CV_StsUnsupportedFormat, error_message);
}
// get the vector of matrices
@@ -785,7 +785,7 @@ void LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserv
Mat labels = _in_labels.getMat();
// check if data is well- aligned
if(labels.total() != src.size()) {
cv::String error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
String error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
CV_Error(CV_StsBadArg, error_message);
}
// if this model should be trained without preserving old data, delete old model data
@@ -816,7 +816,7 @@ void LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserv
void LBPH::predict(InputArray _src, int &minClass, double &minDist) const {
if(_histograms.empty()) {
// throw error if no data (or simply return -1?)
cv::String error_message = "This LBPH model is not computed yet. Did you call the train method?";
String error_message = "This LBPH model is not computed yet. Did you call the train method?";
CV_Error(CV_StsBadArg, error_message);
}
Mat src = _src.getMat();

View File

@@ -10,11 +10,11 @@
namespace cv
{
std::vector<cv::String> Directory::GetListFiles( const cv::String& path, const cv::String & exten, bool addPath )
std::vector<String> Directory::GetListFiles( const String& path, const String & exten, bool addPath )
{
std::vector<cv::String> list;
std::vector<String> list;
list.clear();
cv::String path_f = path + "/" + exten;
String path_f = path + "/" + exten;
#ifdef WIN32
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
@@ -57,10 +57,10 @@ namespace cv
if (dirp->d_type == DT_REG)
{
if (exten.compare("*") == 0)
list.push_back(static_cast<cv::String>(dirp->d_name));
list.push_back(static_cast<String>(dirp->d_name));
else
if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
list.push_back(static_cast<cv::String>(dirp->d_name));
if (String(dirp->d_name).find(exten) != String::npos)
list.push_back(static_cast<String>(dirp->d_name));
}
}
closedir(dp);
@@ -69,10 +69,10 @@ namespace cv
return list;
}
std::vector<cv::String> Directory::GetListFolders( const cv::String& path, const cv::String & exten, bool addPath )
std::vector<String> Directory::GetListFolders( const String& path, const String & exten, bool addPath )
{
std::vector<cv::String> list;
cv::String path_f = path + "/" + exten;
std::vector<String> list;
String path_f = path + "/" + exten;
list.clear();
#ifdef WIN32
WIN32_FIND_DATA FindFileData;
@@ -117,10 +117,10 @@ namespace cv
strcmp(dirp->d_name, "..") != 0 )
{
if (exten.compare("*") == 0)
list.push_back(static_cast<cv::String>(dirp->d_name));
list.push_back(static_cast<String>(dirp->d_name));
else
if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
list.push_back(static_cast<cv::String>(dirp->d_name));
if (String(dirp->d_name).find(exten) != String::npos)
list.push_back(static_cast<String>(dirp->d_name));
}
}
closedir(dp);
@@ -129,16 +129,16 @@ namespace cv
return list;
}
std::vector<cv::String> Directory::GetListFilesR ( const cv::String& path, const cv::String & exten, bool addPath )
std::vector<String> Directory::GetListFilesR ( const String& path, const String & exten, bool addPath )
{
std::vector<cv::String> list = Directory::GetListFiles(path, exten, addPath);
std::vector<String> list = Directory::GetListFiles(path, exten, addPath);
std::vector<cv::String> dirs = Directory::GetListFolders(path, exten, addPath);
std::vector<String> dirs = Directory::GetListFolders(path, exten, addPath);
std::vector<cv::String>::const_iterator it;
std::vector<String>::const_iterator it;
for (it = dirs.begin(); it != dirs.end(); ++it)
{
std::vector<cv::String> cl = Directory::GetListFiles(*it, exten, addPath);
std::vector<String> cl = Directory::GetListFiles(*it, exten, addPath);
list.insert(list.end(), cl.begin(), cl.end());
}

View File

@@ -42,7 +42,7 @@ static Mat argsort(InputArray _src, bool ascending=true)
{
Mat src = _src.getMat();
if (src.rows != 1 && src.cols != 1) {
cv::String error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
String error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
CV_Error(CV_StsBadArg, error_message);
}
int flags = CV_SORT_EVERY_ROW+(ascending ? CV_SORT_ASCENDING : CV_SORT_DESCENDING);
@@ -54,7 +54,7 @@ static Mat argsort(InputArray _src, bool ascending=true)
static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double beta=0) {
// make sure the input data is a vector of matrices or vector of vector
if(src.kind() != _InputArray::STD_VECTOR_MAT && src.kind() != _InputArray::STD_VECTOR_VECTOR) {
cv::String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message);
}
// number of samples
@@ -70,7 +70,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
for(int i = 0; i < (int)n; i++) {
// make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total() != d) {
cv::String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message);
}
// get a hold of the current row
@@ -178,12 +178,12 @@ Mat subspaceProject(InputArray _W, InputArray _mean, InputArray _src) {
int d = src.cols;
// make sure the data has the correct shape
if(W.rows != d) {
cv::String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
CV_Error(CV_StsBadArg, error_message);
}
// make sure mean is correct if not empty
if(!mean.empty() && (mean.total() != (size_t) d)) {
cv::String error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
String error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
CV_Error(CV_StsBadArg, error_message);
}
// create temporary matrices
@@ -216,12 +216,12 @@ Mat subspaceReconstruct(InputArray _W, InputArray _mean, InputArray _src)
int d = src.cols;
// make sure the data has the correct shape
if(W.cols != d) {
cv::String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
CV_Error(CV_StsBadArg, error_message);
}
// make sure mean is correct if not empty
if(!mean.empty() && (mean.total() != (size_t) W.rows)) {
cv::String error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
String error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
CV_Error(CV_StsBadArg, error_message);
}
// initalize temporary matrices
@@ -936,7 +936,7 @@ public:
//------------------------------------------------------------------------------
// Linear Discriminant Analysis implementation
//------------------------------------------------------------------------------
void LDA::save(const cv::String& filename) const {
void LDA::save(const String& filename) const {
FileStorage fs(filename, FileStorage::WRITE);
if (!fs.isOpened()) {
CV_Error(CV_StsError, "File can't be opened for writing!");
@@ -946,7 +946,7 @@ void LDA::save(const cv::String& filename) const {
}
// Deserializes this object from a given filename.
void LDA::load(const cv::String& filename) {
void LDA::load(const String& filename) {
FileStorage fs(filename, FileStorage::READ);
if (!fs.isOpened())
CV_Error(CV_StsError, "File can't be opened for writing!");
@@ -1001,12 +1001,12 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
// we can't do a LDA on one class, what do you
// want to separate from each other then?
if(C == 1) {
cv::String error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
String error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
CV_Error(CV_StsBadArg, error_message);
}
// throw error if less labels, than samples
if (labels.size() != static_cast<size_t>(N)) {
cv::String error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
String error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
CV_Error(CV_StsBadArg, error_message);
}
// warn if within-classes scatter matrix becomes singular
@@ -1089,7 +1089,7 @@ void LDA::compute(InputArrayOfArrays _src, InputArray _lbls) {
lda(_src.getMat(), _lbls);
break;
default:
cv::String error_message= format("InputArray Datatype %d is not supported.", _src.kind());
String error_message= format("InputArray Datatype %d is not supported.", _src.kind());
CV_Error(CV_StsBadArg, error_message);
break;
}

View File

@@ -112,7 +112,7 @@ void Retina::setColorSaturation(const bool saturateColors, const float colorSatu
struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;}
void Retina::setup(cv::String retinaParameterFile, const bool applyDefaultSetupOnFailure)
void Retina::setup(String retinaParameterFile, const bool applyDefaultSetupOnFailure)
{
try
{
@@ -200,7 +200,7 @@ void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
}
const cv::String Retina::printSetup()
const String Retina::printSetup()
{
std::stringstream outmessage;
@@ -233,7 +233,7 @@ const cv::String Retina::printSetup()
return outmessage.str().c_str();
}
void Retina::write( cv::String fs ) const
void Retina::write( String fs ) const
{
FileStorage parametersSaveFile(fs, cv::FileStorage::WRITE );
write(parametersSaveFile);

View File

@@ -494,7 +494,7 @@ void cv::Mesh3D::computeNormals(const std::vector<int>& subset, float normalRadi
::computeNormals(octree, vtx, normals, mask, normalRadius, minNeighbors);
}
void cv::Mesh3D::writeAsVrml(const cv::String& file, const std::vector<Scalar>& _colors) const
void cv::Mesh3D::writeAsVrml(const String& file, const std::vector<Scalar>& _colors) const
{
std::ofstream ofs(file.c_str());