All modules (except ocl and gpu) compiles and pass tests
This commit is contained in:
@@ -113,7 +113,7 @@ Since every :ocv:class:`FaceRecognizer` is a :ocv:class:`Algorithm`, you can use
|
||||
// Create a FaceRecognizer:
|
||||
Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
|
||||
// And here's how to get its name:
|
||||
std::string name = model->name();
|
||||
cv::String name = model->name();
|
||||
|
||||
|
||||
FaceRecognizer::train
|
||||
|
@@ -16,7 +16,7 @@ Class which provides the main controls to the Gipsa/Listic labs human retina mo
|
||||
|
||||
**NOTE : See the Retina tutorial in the tutorial/contrib section for complementary explanations.**
|
||||
|
||||
The retina can be settled up with various parameters, by default, the retina cancels mean luminance and enforces all details of the visual scene. In order to use your own parameters, you can use at least one time the *write(std::string fs)* method which will write a proper XML file with all default parameters. Then, tweak it on your own and reload them at any time using method *setup(std::string fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. ::
|
||||
The retina can be settled up with various parameters, by default, the retina cancels mean luminance and enforces all details of the visual scene. In order to use your own parameters, you can use at least one time the *write(cv::String fs)* method which will write a proper XML file with all default parameters. Then, tweak it on your own and reload them at any time using method *setup(cv::String fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. ::
|
||||
|
||||
class Retina
|
||||
{
|
||||
@@ -49,12 +49,12 @@ The retina can be settled up with various parameters, by default, the retina can
|
||||
Size outputSize ();
|
||||
|
||||
// setup methods with specific parameters specification of global xml config file loading/write
|
||||
void setup (std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
|
||||
void setup (cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
|
||||
void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
|
||||
void setup (RetinaParameters newParameters);
|
||||
struct Retina::RetinaParameters getParameters ();
|
||||
const std::string printSetup ();
|
||||
virtual void write (std::string fs) const;
|
||||
const cv::String printSetup ();
|
||||
virtual void write (cv::String fs) const;
|
||||
virtual void write (FileStorage &fs) const;
|
||||
void setupOPLandIPLParvoChannel (const bool colorMode=true, const bool normaliseOutput=true, const float photoreceptorsLocalAdaptationSensitivity=0.7, const float photoreceptorsTemporalConstant=0.5, const float photoreceptorsSpatialConstant=0.53, const float horizontalCellsGain=0, const float HcellsTemporalConstant=1, const float HcellsSpatialConstant=7, const float ganglionCellsSensitivity=0.7);
|
||||
void setupIPLMagnoChannel (const bool normaliseOutput=true, const float parasolCells_beta=0, const float parasolCells_tau=0, const float parasolCells_k=7, const float amacrinCellsTemporalCutFrequency=1.2, const float V0CompressionParameter=0.95, const float localAdaptintegration_tau=0, const float localAdaptintegration_k=7);
|
||||
@@ -235,7 +235,7 @@ Retina::outputSize
|
||||
Retina::printSetup
|
||||
++++++++++++++++++
|
||||
|
||||
.. ocv:function:: const std::string Retina::printSetup()
|
||||
.. ocv:function:: const cv::String Retina::printSetup()
|
||||
|
||||
Outputs a string showing the used parameters setup
|
||||
|
||||
@@ -264,7 +264,7 @@ Retina::setColorSaturation
|
||||
Retina::setup
|
||||
+++++++++++++
|
||||
|
||||
.. ocv:function:: void Retina::setup(std::string retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true )
|
||||
.. ocv:function:: void Retina::setup(cv::String retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true )
|
||||
.. ocv:function:: void Retina::setup(FileStorage & fs, const bool applyDefaultSetupOnFailure = true )
|
||||
.. ocv:function:: void Retina::setup(RetinaParameters newParameters)
|
||||
|
||||
@@ -278,7 +278,7 @@ Retina::setup
|
||||
Retina::write
|
||||
+++++++++++++
|
||||
|
||||
.. ocv:function:: void Retina::write( std::string fs ) const
|
||||
.. ocv:function:: void Retina::write( cv::String fs ) const
|
||||
.. ocv:function:: void Retina::write( FileStorage& fs ) const
|
||||
|
||||
Write xml/yml formated parameters information
|
||||
|
@@ -301,7 +301,7 @@ namespace cv
|
||||
void computeNormals(float normalRadius, int minNeighbors = 20);
|
||||
void computeNormals(const std::vector<int>& subset, float normalRadius, int minNeighbors = 20);
|
||||
|
||||
void writeAsVrml(const std::string& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const;
|
||||
void writeAsVrml(const cv::String& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const;
|
||||
|
||||
std::vector<Point3f> vtx;
|
||||
std::vector<Point3f> normals;
|
||||
@@ -610,9 +610,9 @@ namespace cv
|
||||
class CV_EXPORTS Directory
|
||||
{
|
||||
public:
|
||||
static std::vector<std::string> GetListFiles ( const std::string& path, const std::string & exten = "*", bool addPath = true );
|
||||
static std::vector<std::string> GetListFilesR ( const std::string& path, const std::string & exten = "*", bool addPath = true );
|
||||
static std::vector<std::string> GetListFolders( const std::string& path, const std::string & exten = "*", bool addPath = true );
|
||||
static std::vector<cv::String> GetListFiles ( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
|
||||
static std::vector<cv::String> GetListFilesR ( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
|
||||
static std::vector<cv::String> GetListFolders( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -869,10 +869,10 @@ namespace cv
|
||||
}
|
||||
|
||||
// Serializes this object to a given filename.
|
||||
void save(const std::string& filename) const;
|
||||
void save(const cv::String& filename) const;
|
||||
|
||||
// Deserializes this object from a given filename.
|
||||
void load(const std::string& filename);
|
||||
void load(const cv::String& filename);
|
||||
|
||||
// Serializes this object to a given cv::FileStorage.
|
||||
void save(FileStorage& fs) const;
|
||||
@@ -926,10 +926,10 @@ namespace cv
|
||||
CV_WRAP virtual void predict(InputArray src, CV_OUT int &label, CV_OUT double &confidence) const = 0;
|
||||
|
||||
// Serializes this object to a given filename.
|
||||
CV_WRAP virtual void save(const std::string& filename) const;
|
||||
CV_WRAP virtual void save(const cv::String& filename) const;
|
||||
|
||||
// Deserializes this object from a given filename.
|
||||
CV_WRAP virtual void load(const std::string& filename);
|
||||
CV_WRAP virtual void load(const cv::String& filename);
|
||||
|
||||
// Serializes this object to a given cv::FileStorage.
|
||||
virtual void save(FileStorage& fs) const = 0;
|
||||
|
@@ -182,7 +182,7 @@ public:
|
||||
* @param retinaParameterFile : the parameters filename
|
||||
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
|
||||
*/
|
||||
void setup(std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
|
||||
void setup(cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
|
||||
|
||||
|
||||
/**
|
||||
@@ -212,13 +212,13 @@ public:
|
||||
* parameters setup display method
|
||||
* @return a string which contains formatted parameters information
|
||||
*/
|
||||
const std::string printSetup();
|
||||
const cv::String printSetup();
|
||||
|
||||
/**
|
||||
* write xml/yml formated parameters information
|
||||
* @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information
|
||||
*/
|
||||
virtual void write( std::string fs ) const;
|
||||
virtual void write( cv::String fs ) const;
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -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 std::string& name,
|
||||
inline void writeFileNodeList(FileStorage& fs, const cv::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 std::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) {
|
||||
std::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::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) {
|
||||
std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
|
||||
cv::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;
|
||||
}
|
||||
|
||||
std::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::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 std::string& filename) const {
|
||||
void FaceRecognizer::save(const cv::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 std::string& filename) const {
|
||||
fs.release();
|
||||
}
|
||||
|
||||
void FaceRecognizer::load(const std::string& filename) {
|
||||
void FaceRecognizer::load(const cv::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 std::string& filename) {
|
||||
//------------------------------------------------------------------------------
|
||||
void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
|
||||
if(_src.total() == 0) {
|
||||
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
cv::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) {
|
||||
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
|
||||
cv::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()) {
|
||||
std::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::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) {
|
||||
std::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::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?)
|
||||
std::string error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
|
||||
cv::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
|
||||
std::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::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) {
|
||||
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
cv::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) {
|
||||
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
|
||||
cv::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()) {
|
||||
std::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::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) {
|
||||
std::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::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) {
|
||||
std::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::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?)
|
||||
std::string error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
|
||||
cv::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) {
|
||||
std::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::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:
|
||||
std::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::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) {
|
||||
std::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::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) {
|
||||
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
|
||||
cv::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) {
|
||||
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
|
||||
cv::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()) {
|
||||
std::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::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?)
|
||||
std::string error_message = "This LBPH model is not computed yet. Did you call the train method?";
|
||||
cv::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();
|
||||
|
@@ -10,11 +10,11 @@
|
||||
|
||||
namespace cv
|
||||
{
|
||||
std::vector<std::string> Directory::GetListFiles( const std::string& path, const std::string & exten, bool addPath )
|
||||
std::vector<cv::String> Directory::GetListFiles( const cv::String& path, const cv::String & exten, bool addPath )
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
std::vector<cv::String> list;
|
||||
list.clear();
|
||||
std::string path_f = path + "/" + exten;
|
||||
cv::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<std::string>(dirp->d_name));
|
||||
list.push_back(static_cast<cv::String>(dirp->d_name));
|
||||
else
|
||||
if (std::string(dirp->d_name).find(exten) != std::string::npos)
|
||||
list.push_back(static_cast<std::string>(dirp->d_name));
|
||||
if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
|
||||
list.push_back(static_cast<cv::String>(dirp->d_name));
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
@@ -69,10 +69,10 @@ namespace cv
|
||||
return list;
|
||||
}
|
||||
|
||||
std::vector<std::string> Directory::GetListFolders( const std::string& path, const std::string & exten, bool addPath )
|
||||
std::vector<cv::String> Directory::GetListFolders( const cv::String& path, const cv::String & exten, bool addPath )
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
std::string path_f = path + "/" + exten;
|
||||
std::vector<cv::String> list;
|
||||
cv::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<std::string>(dirp->d_name));
|
||||
list.push_back(static_cast<cv::String>(dirp->d_name));
|
||||
else
|
||||
if (std::string(dirp->d_name).find(exten) != std::string::npos)
|
||||
list.push_back(static_cast<std::string>(dirp->d_name));
|
||||
if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
|
||||
list.push_back(static_cast<cv::String>(dirp->d_name));
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
@@ -129,16 +129,16 @@ namespace cv
|
||||
return list;
|
||||
}
|
||||
|
||||
std::vector<std::string> Directory::GetListFilesR ( const std::string& path, const std::string & exten, bool addPath )
|
||||
std::vector<cv::String> Directory::GetListFilesR ( const cv::String& path, const cv::String & exten, bool addPath )
|
||||
{
|
||||
std::vector<std::string> list = Directory::GetListFiles(path, exten, addPath);
|
||||
std::vector<cv::String> list = Directory::GetListFiles(path, exten, addPath);
|
||||
|
||||
std::vector<std::string> dirs = Directory::GetListFolders(path, exten, addPath);
|
||||
std::vector<cv::String> dirs = Directory::GetListFolders(path, exten, addPath);
|
||||
|
||||
std::vector<std::string>::const_iterator it;
|
||||
std::vector<cv::String>::const_iterator it;
|
||||
for (it = dirs.begin(); it != dirs.end(); ++it)
|
||||
{
|
||||
std::vector<std::string> cl = Directory::GetListFiles(*it, exten, addPath);
|
||||
std::vector<cv::String> cl = Directory::GetListFiles(*it, exten, addPath);
|
||||
list.insert(list.end(), cl.begin(), cl.end());
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ static Mat argsort(InputArray _src, bool ascending=true)
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
if (src.rows != 1 && src.cols != 1) {
|
||||
std::string error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
|
||||
cv::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) {
|
||||
std::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::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) {
|
||||
std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
|
||||
cv::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) {
|
||||
std::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::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)) {
|
||||
std::string error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
|
||||
cv::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) {
|
||||
std::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::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)) {
|
||||
std::string error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
|
||||
cv::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 std::string& filename) const {
|
||||
void LDA::save(const cv::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 std::string& filename) const {
|
||||
}
|
||||
|
||||
// Deserializes this object from a given filename.
|
||||
void LDA::load(const std::string& filename) {
|
||||
void LDA::load(const cv::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) {
|
||||
std::string error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
|
||||
cv::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)) {
|
||||
std::string error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
|
||||
cv::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:
|
||||
std::string error_message= format("InputArray Datatype %d is not supported.", _src.kind());
|
||||
cv::String error_message= format("InputArray Datatype %d is not supported.", _src.kind());
|
||||
CV_Error(CV_StsBadArg, error_message);
|
||||
break;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@
|
||||
*/
|
||||
#include "precomp.hpp"
|
||||
#include "retinafilter.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -112,25 +112,26 @@ void Retina::setColorSaturation(const bool saturateColors, const float colorSatu
|
||||
struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;}
|
||||
|
||||
|
||||
void Retina::setup(std::string retinaParameterFile, const bool applyDefaultSetupOnFailure)
|
||||
void Retina::setup(cv::String retinaParameterFile, const bool applyDefaultSetupOnFailure)
|
||||
{
|
||||
try
|
||||
{
|
||||
// opening retinaParameterFile in read mode
|
||||
cv::FileStorage fs(retinaParameterFile, cv::FileStorage::READ);
|
||||
setup(fs, applyDefaultSetupOnFailure);
|
||||
}catch(Exception &e)
|
||||
{
|
||||
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
|
||||
if (applyDefaultSetupOnFailure)
|
||||
{
|
||||
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
|
||||
setupOPLandIPLParvoChannel();
|
||||
setupIPLMagnoChannel();
|
||||
}
|
||||
catch(Exception &e)
|
||||
{
|
||||
printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
|
||||
if (applyDefaultSetupOnFailure)
|
||||
{
|
||||
printf("Retina::setup: resetting retina with default parameters\n");
|
||||
setupOPLandIPLParvoChannel();
|
||||
setupIPLMagnoChannel();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"=> keeping current parameters"<<std::endl;
|
||||
printf("=> keeping current parameters\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,7 +143,7 @@ void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
|
||||
// read parameters file if it exists or apply default setup if asked for
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl;
|
||||
printf("Retina::setup: provided parameters file could not be open... skeeping configuration\n");
|
||||
return;
|
||||
// implicit else case : retinaParameterFile could be open (it exists at least)
|
||||
}
|
||||
@@ -174,18 +175,18 @@ void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
|
||||
|
||||
}catch(Exception &e)
|
||||
{
|
||||
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
|
||||
printf("Retina::setup: resetting retina with default parameters\n");
|
||||
if (applyDefaultSetupOnFailure)
|
||||
{
|
||||
setupOPLandIPLParvoChannel();
|
||||
setupIPLMagnoChannel();
|
||||
}
|
||||
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
|
||||
std::cout<<"=> keeping current parameters"<<std::endl;
|
||||
printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
|
||||
printf("=> keeping current parameters\n");
|
||||
}
|
||||
|
||||
// report current configuration
|
||||
std::cout<<printSetup()<<std::endl;
|
||||
printf("%s\n", printSetup().c_str());
|
||||
}
|
||||
|
||||
void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
|
||||
@@ -199,7 +200,7 @@ void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
|
||||
|
||||
}
|
||||
|
||||
const std::string Retina::printSetup()
|
||||
const cv::String Retina::printSetup()
|
||||
{
|
||||
std::stringstream outmessage;
|
||||
|
||||
@@ -229,10 +230,10 @@ const std::string Retina::printSetup()
|
||||
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
|
||||
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
|
||||
<<"}";
|
||||
return outmessage.str();
|
||||
return outmessage.str().c_str();
|
||||
}
|
||||
|
||||
void Retina::write( std::string fs ) const
|
||||
void Retina::write( cv::String fs ) const
|
||||
{
|
||||
FileStorage parametersSaveFile(fs, cv::FileStorage::WRITE );
|
||||
write(parametersSaveFile);
|
||||
@@ -364,7 +365,7 @@ void Retina::_init(const cv::Size inputSz, const bool colorMode, RETINA_COLORSAM
|
||||
_retinaFilter->clearAllBuffers();
|
||||
|
||||
// report current configuration
|
||||
std::cout<<printSetup()<<std::endl;
|
||||
printf("%s\n", printSetup().c_str());
|
||||
}
|
||||
|
||||
void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)
|
||||
|
@@ -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 std::string& file, const std::vector<Scalar>& _colors) const
|
||||
void cv::Mesh3D::writeAsVrml(const cv::String& file, const std::vector<Scalar>& _colors) const
|
||||
{
|
||||
std::ofstream ofs(file.c_str());
|
||||
|
||||
|
Reference in New Issue
Block a user