Commit 14be1519 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #1784 from mshabunin:printf

parents e6f5a478 696aa69f
......@@ -68,7 +68,7 @@ void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
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()) {
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 %zu pixels, but was %zu pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
CV_Error(Error::StsUnsupportedFormat, error_message);
}
}
......@@ -82,7 +82,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) {
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)=%zu.", n, labels.total());
CV_Error(Error::StsBadArg, error_message);
}
// clear existing model data
......@@ -117,7 +117,7 @@ void Eigenfaces::predict(InputArray _src, Ptr<PredictCollector> collector) const
CV_Error(Error::StsError, error_message);
} else if(_eigenvectors.rows != static_cast<int>(src.total())) {
// check data alignment just for clearer exception messages
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 %zu.", _eigenvectors.rows, src.total());
CV_Error(Error::StsBadArg, error_message);
}
// project into PCA subspace
......
......@@ -28,7 +28,7 @@ inline 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) {
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 #%u! Expected %zu was %zu.", i, d, src.getMat(i).total());
CV_Error(Error::StsBadArg, error_message);
}
// get a hold of the current row
......
......@@ -77,7 +77,7 @@ void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
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()) {
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 %zu pixels, but was %zu pixels.", src.getMat(i-1).total(), src.getMat(i).total());
CV_Error(Error::StsUnsupportedFormat, error_message);
}
}
......@@ -89,10 +89,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) {
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)=%zu.", N, labels.total());
CV_Error(Error::StsBadArg, error_message);
} else if(labels.rows != 1 && labels.cols != 1) {
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=%d, cols=%d.", labels.rows, labels.cols);
CV_Error(Error::StsBadArg, error_message);
}
// clear existing model data
......@@ -136,7 +136,7 @@ void Fisherfaces::predict(InputArray _src, Ptr<PredictCollector> collector) cons
String error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
CV_Error(Error::StsBadArg, error_message);
} else if(src.total() != (size_t) _eigenvectors.rows) {
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 %zu.", _eigenvectors.rows, src.total());
CV_Error(Error::StsBadArg, error_message);
}
// project into LDA subspace
......
......@@ -371,7 +371,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()) {
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)=%zu, len(labels)=%zu.", src.size(), _labels.total());
CV_Error(Error::StsBadArg, error_message);
}
// if this model should be trained without preserving old data, delete old model data
......
......@@ -257,7 +257,7 @@ inline int HDF5Impl::GetCVtype( hid_t h5Type ) const
else if ( H5Tequal( h5Type, H5T_NATIVE_INT ) )
cvType = CV_32S;
else
CV_Error_(Error::StsInternal, ("Unknown H5Type: %d.", h5Type));
CV_Error_(Error::StsInternal, ("Unknown H5Type: %lld.", (long long)h5Type));
return cvType;
}
......
......@@ -126,7 +126,7 @@ namespace cv
if ((int)(this->mInitSeedIndexes.size()) > samples.rows)
{
CV_Error_(Error::StsBadArg, ("Number of seeds %d must be less or equal to the number of samples %d.",
CV_Error_(Error::StsBadArg, ("Number of seeds %zu must be less or equal to the number of samples %d.",
mInitSeedIndexes.size(), samples.rows));
}
......
......@@ -157,7 +157,7 @@ namespace cv
if (weights.size() != mWeights.size())
{
CV_Error_(Error::StsUnmatchedSizes,
("Invalid weights dimension %d (max %d)", weights.size(), mWeights.size()));
("Invalid weights dimension %zu (max %zu)", weights.size(), mWeights.size()));
}
else
{
......@@ -178,7 +178,7 @@ namespace cv
if (translations.size() != mTranslations.size())
{
CV_Error_(Error::StsUnmatchedSizes,
("Invalid translations dimension %d (max %d)", translations.size(), mTranslations.size()));
("Invalid translations dimension %zu (max %zu)", translations.size(), mTranslations.size()));
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment