From 2ad7b97f1c4645e9be8ade2cf12f0c79011082c8 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Wed, 20 Mar 2013 20:13:46 +0400 Subject: [PATCH] All modules (except ocl and gpu) compiles and pass tests --- modules/calib3d/test/test_chesscorners.cpp | 4 +- modules/calib3d/test/test_stereomatching.cpp | 20 ++-- modules/contrib/doc/facerec/facerec_api.rst | 2 +- modules/contrib/doc/retina/index.rst | 14 +-- modules/contrib/include/opencv2/contrib.hpp | 16 ++-- .../include/opencv2/contrib/retina.hpp | 6 +- modules/contrib/src/facerec.cpp | 50 +++++----- modules/contrib/src/inputoutput.cpp | 34 +++---- modules/contrib/src/lda.cpp | 24 ++--- modules/contrib/src/retina.cpp | 41 ++++---- modules/contrib/src/spinimages.cpp | 2 +- modules/gpu/doc/video.rst | 24 ++--- modules/gpu/include/opencv2/gpu.hpp | 22 ++--- modules/gpu/src/cascadeclassifier.cpp | 28 +++--- modules/gpu/src/cu_safe_call.cpp | 8 +- modules/gpu/src/cu_safe_call.h | 2 +- modules/gpu/src/cuvid_video_source.cpp | 2 +- modules/gpu/src/cuvid_video_source.h | 2 +- modules/gpu/src/error.cpp | 14 +-- modules/gpu/src/ffmpeg_video_source.cpp | 2 +- modules/gpu/src/ffmpeg_video_source.h | 2 +- .../gpu/src/nvidia/NCVHaarObjectDetection.cu | 14 +-- .../gpu/src/nvidia/NCVHaarObjectDetection.hpp | 6 +- modules/gpu/src/nvidia/core/NCV.cu | 4 +- modules/gpu/src/nvidia/core/NCV.hpp | 4 +- modules/gpu/src/optical_flow.cpp | 2 +- modules/gpu/src/video_reader.cpp | 8 +- modules/gpu/src/video_writer.cpp | 32 +++---- modules/legacy/include/opencv2/legacy.hpp | 44 ++++----- modules/legacy/src/calonder.cpp | 10 +- modules/legacy/src/oneway.cpp | 22 ++--- modules/legacy/src/planardetect.cpp | 8 +- modules/legacy/test/test_stereomatching.cpp | 12 +-- modules/ml/doc/mldata.rst | 4 +- modules/ml/include/opencv2/ml.hpp | 8 +- modules/ml/src/data.cpp | 2 +- modules/ml/src/ertrees.cpp | 2 +- modules/ml/src/gbt.cpp | 4 +- modules/ml/src/precomp.hpp | 1 + modules/ml/src/rtrees.cpp | 4 +- modules/ml/src/svm.cpp | 4 +- modules/ml/test/test_mltests2.cpp | 16 ++-- modules/nonfree/src/surf.ocl.cpp | 14 +-- .../objdetect/include/opencv2/objdetect.hpp | 66 ++++++------- modules/objdetect/src/cascadedetect.cpp | 8 +- modules/objdetect/src/datamatrix.cpp | 6 +- modules/objdetect/src/hog.cpp | 32 +++---- modules/objdetect/src/latentsvmdetector.cpp | 14 +-- modules/objdetect/src/linemod.cpp | 52 +++++----- modules/objdetect/test/test_cascadeandhog.cpp | 8 +- .../objdetect/test/test_latentsvmdetector.cpp | 4 +- modules/ocl/include/opencv2/ocl.hpp | 6 +- .../ocl/include/opencv2/ocl/private/util.hpp | 16 ++-- modules/ocl/src/arithm.cpp | 96 +++++++++---------- modules/ocl/src/binarycaching.hpp | 6 +- modules/ocl/src/blend.cpp | 2 +- modules/ocl/src/brute_force_matcher.cpp | 18 ++-- modules/ocl/src/build_warps.cpp | 10 +- modules/ocl/src/canny.cpp | 14 +-- modules/ocl/src/columnsum.cpp | 2 +- modules/ocl/src/filtering.cpp | 18 ++-- modules/ocl/src/hog.cpp | 16 ++-- modules/ocl/src/imgproc.cpp | 40 ++++---- modules/ocl/src/initialization.cpp | 44 ++++----- modules/ocl/src/interpolate_frames.cpp | 8 +- modules/ocl/src/match_template.cpp | 12 +-- modules/ocl/src/matrix_operations.cpp | 16 ++-- modules/ocl/src/mcwutil.cpp | 8 +- modules/ocl/src/pyrdown.cpp | 2 +- modules/ocl/src/pyrlk.cpp | 18 ++-- modules/ocl/src/pyrup.cpp | 2 +- modules/ocl/src/split_merge.cpp | 8 +- modules/ocl/src/stereobm.cpp | 6 +- .../include/opencv2/softcascade.hpp | 8 +- modules/softcascade/src/detector.cpp | 10 +- modules/softcascade/src/detector_cuda.cpp | 6 +- .../src/integral_channel_builder.cpp | 4 +- modules/softcascade/src/octave.cpp | 4 +- modules/softcascade/test/test_training.cpp | 2 +- .../stitching/detail/motion_estimators.hpp | 2 +- .../include/opencv2/stitching/detail/util.hpp | 2 +- modules/stitching/src/motion_estimators.cpp | 20 ++-- modules/superres/include/opencv2/superres.hpp | 4 +- modules/superres/src/frame_source.cpp | 16 ++-- modules/video/src/bgfg_gaussmix.cpp | 4 +- modules/video/src/bgfg_gaussmix2.cpp | 4 +- modules/video/src/bgfg_gmg.cpp | 4 +- .../opencv2/videostab/frame_source.hpp | 2 +- .../opencv2/videostab/global_motion.hpp | 4 +- modules/videostab/src/frame_source.cpp | 8 +- modules/videostab/src/global_motion.cpp | 4 +- 91 files changed, 606 insertions(+), 604 deletions(-) diff --git a/modules/calib3d/test/test_chesscorners.cpp b/modules/calib3d/test/test_chesscorners.cpp index 42c25b86ad..bbc792ea5b 100644 --- a/modules/calib3d/test/test_chesscorners.cpp +++ b/modules/calib3d/test/test_chesscorners.cpp @@ -217,7 +217,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) ts->update_context( this, idx, true ); /* read the image */ - string img_file = board_list[idx * 2]; + String img_file = board_list[idx * 2]; Mat gray = imread( folder + img_file, 0); if( gray.empty() ) @@ -227,7 +227,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename ) return; } - string _filename = folder + (string)board_list[idx * 2 + 1]; + String _filename = folder + (String)board_list[idx * 2 + 1]; bool doesContatinChessboard; Mat expected; { diff --git a/modules/calib3d/test/test_stereomatching.cpp b/modules/calib3d/test/test_stereomatching.cpp index 4b35dad990..d1cdb23b7f 100644 --- a/modules/calib3d/test/test_stereomatching.cpp +++ b/modules/calib3d/test/test_stereomatching.cpp @@ -593,10 +593,10 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs ) assert(fn.isSeq()); for( int i = 0; i < (int)fn.size(); i+=3 ) { - string _name = fn[i]; + String _name = fn[i]; DatasetParams params; - string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); - string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); + String sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); + String uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); datasetsParams[_name] = params; } return cvtest::TS::OK; @@ -680,10 +680,10 @@ protected: assert(fn.isSeq()); for( int i = 0; i < (int)fn.size(); i+=4 ) { - string caseName = fn[i], datasetName = fn[i+1]; + String caseName = fn[i], datasetName = fn[i+1]; RunParams params; - string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); - string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str()); + String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); + String winSize = fn[i+3]; params.winSize = atoi(winSize.c_str()); caseNames.push_back( caseName ); caseDatasets.push_back( datasetName ); caseRunParams.push_back( params ); @@ -734,11 +734,11 @@ protected: assert(fn.isSeq()); for( int i = 0; i < (int)fn.size(); i+=5 ) { - string caseName = fn[i], datasetName = fn[i+1]; + String caseName = fn[i], datasetName = fn[i+1]; RunParams params; - string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); - string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str()); - string fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true; + String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); + String winSize = fn[i+3]; params.winSize = atoi(winSize.c_str()); + String fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true; caseNames.push_back( caseName ); caseDatasets.push_back( datasetName ); caseRunParams.push_back( params ); diff --git a/modules/contrib/doc/facerec/facerec_api.rst b/modules/contrib/doc/facerec/facerec_api.rst index 8bea7070ae..4461c9c887 100644 --- a/modules/contrib/doc/facerec/facerec_api.rst +++ b/modules/contrib/doc/facerec/facerec_api.rst @@ -113,7 +113,7 @@ Since every :ocv:class:`FaceRecognizer` is a :ocv:class:`Algorithm`, you can use // Create a FaceRecognizer: Ptr model = createEigenFaceRecognizer(); // And here's how to get its name: - std::string name = model->name(); + cv::String name = model->name(); FaceRecognizer::train diff --git a/modules/contrib/doc/retina/index.rst b/modules/contrib/doc/retina/index.rst index a3a5bc82fc..464f8c3c43 100644 --- a/modules/contrib/doc/retina/index.rst +++ b/modules/contrib/doc/retina/index.rst @@ -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 diff --git a/modules/contrib/include/opencv2/contrib.hpp b/modules/contrib/include/opencv2/contrib.hpp index 44bf3313ed..a27784ee4f 100644 --- a/modules/contrib/include/opencv2/contrib.hpp +++ b/modules/contrib/include/opencv2/contrib.hpp @@ -301,7 +301,7 @@ namespace cv void computeNormals(float normalRadius, int minNeighbors = 20); void computeNormals(const std::vector& subset, float normalRadius, int minNeighbors = 20); - void writeAsVrml(const std::string& file, const std::vector& colors = std::vector()) const; + void writeAsVrml(const cv::String& file, const std::vector& colors = std::vector()) const; std::vector vtx; std::vector normals; @@ -610,9 +610,9 @@ namespace cv class CV_EXPORTS Directory { public: - static std::vector GetListFiles ( const std::string& path, const std::string & exten = "*", bool addPath = true ); - static std::vector GetListFilesR ( const std::string& path, const std::string & exten = "*", bool addPath = true ); - static std::vector GetListFolders( const std::string& path, const std::string & exten = "*", bool addPath = true ); + static std::vector GetListFiles ( const cv::String& path, const cv::String & exten = "*", bool addPath = true ); + static std::vector GetListFilesR ( const cv::String& path, const cv::String & exten = "*", bool addPath = true ); + static std::vector 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; diff --git a/modules/contrib/include/opencv2/contrib/retina.hpp b/modules/contrib/include/opencv2/contrib/retina.hpp index 456daab443..f19b8b19d0 100644 --- a/modules/contrib/include/opencv2/contrib/retina.hpp +++ b/modules/contrib/include/opencv2/contrib/retina.hpp @@ -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; /** diff --git a/modules/contrib/src/facerec.cpp b/modules/contrib/src/facerec.cpp index fedaeab880..b987441b99 100644 --- a/modules/contrib/src/facerec.cpp +++ b/modules/contrib/src/facerec.cpp @@ -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 -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) 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) 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(_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(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(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(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_(src,dst, radius, neighbors); break; case CV_64FC1: elbp_(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) 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) 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(); diff --git a/modules/contrib/src/inputoutput.cpp b/modules/contrib/src/inputoutput.cpp index ee97e1287b..83115e7328 100644 --- a/modules/contrib/src/inputoutput.cpp +++ b/modules/contrib/src/inputoutput.cpp @@ -10,11 +10,11 @@ namespace cv { - std::vector Directory::GetListFiles( const std::string& path, const std::string & exten, bool addPath ) + std::vector Directory::GetListFiles( const cv::String& path, const cv::String & exten, bool addPath ) { - std::vector list; + std::vector 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(dirp->d_name)); + list.push_back(static_cast(dirp->d_name)); else - if (std::string(dirp->d_name).find(exten) != std::string::npos) - list.push_back(static_cast(dirp->d_name)); + if (cv::String(dirp->d_name).find(exten) != cv::String::npos) + list.push_back(static_cast(dirp->d_name)); } } closedir(dp); @@ -69,10 +69,10 @@ namespace cv return list; } - std::vector Directory::GetListFolders( const std::string& path, const std::string & exten, bool addPath ) + std::vector Directory::GetListFolders( const cv::String& path, const cv::String & exten, bool addPath ) { - std::vector list; - std::string path_f = path + "/" + exten; + std::vector 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(dirp->d_name)); + list.push_back(static_cast(dirp->d_name)); else - if (std::string(dirp->d_name).find(exten) != std::string::npos) - list.push_back(static_cast(dirp->d_name)); + if (cv::String(dirp->d_name).find(exten) != cv::String::npos) + list.push_back(static_cast(dirp->d_name)); } } closedir(dp); @@ -129,16 +129,16 @@ namespace cv return list; } - std::vector Directory::GetListFilesR ( const std::string& path, const std::string & exten, bool addPath ) + std::vector Directory::GetListFilesR ( const cv::String& path, const cv::String & exten, bool addPath ) { - std::vector list = Directory::GetListFiles(path, exten, addPath); + std::vector list = Directory::GetListFiles(path, exten, addPath); - std::vector dirs = Directory::GetListFolders(path, exten, addPath); + std::vector dirs = Directory::GetListFolders(path, exten, addPath); - std::vector::const_iterator it; + std::vector::const_iterator it; for (it = dirs.begin(); it != dirs.end(); ++it) { - std::vector cl = Directory::GetListFiles(*it, exten, addPath); + std::vector cl = Directory::GetListFiles(*it, exten, addPath); list.insert(list.end(), cl.begin(), cl.end()); } diff --git a/modules/contrib/src/lda.cpp b/modules/contrib/src/lda.cpp index 442d567508..f18dc1b0d3 100644 --- a/modules/contrib/src/lda.cpp +++ b/modules/contrib/src/lda.cpp @@ -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) 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) 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(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; } diff --git a/modules/contrib/src/retina.cpp b/modules/contrib/src/retina.cpp index 1464896871..c19f84b9cf 100644 --- a/modules/contrib/src/retina.cpp +++ b/modules/contrib/src/retina.cpp @@ -70,7 +70,7 @@ */ #include "precomp.hpp" #include "retinafilter.hpp" -#include +#include 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=>"<%s\n", e.what()); + if (applyDefaultSetupOnFailure) + { + printf("Retina::setup: resetting retina with default parameters\n"); + setupOPLandIPLParvoChannel(); + setupIPLMagnoChannel(); + } else { - std::cout<<"=> keeping current parameters"< 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"<"< keeping current parameters"<%s\n", e.what()); + printf("=> keeping current parameters\n"); } // report current configuration - std::cout< 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< &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer) diff --git a/modules/contrib/src/spinimages.cpp b/modules/contrib/src/spinimages.cpp index 7f7a8ad63f..5e01536baf 100644 --- a/modules/contrib/src/spinimages.cpp +++ b/modules/contrib/src/spinimages.cpp @@ -494,7 +494,7 @@ void cv::Mesh3D::computeNormals(const std::vector& subset, float normalRadi ::computeNormals(octree, vtx, normals, mask, normalRadius, minNeighbors); } -void cv::Mesh3D::writeAsVrml(const std::string& file, const std::vector& _colors) const +void cv::Mesh3D::writeAsVrml(const cv::String& file, const std::vector& _colors) const { std::ofstream ofs(file.c_str()); diff --git a/modules/gpu/doc/video.rst b/modules/gpu/doc/video.rst index 284bb17fa9..aca0f527c4 100644 --- a/modules/gpu/doc/video.rst +++ b/modules/gpu/doc/video.rst @@ -704,8 +704,8 @@ gpu::VideoWriter_GPU::VideoWriter_GPU Constructors. .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU() -.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) -.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) +.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) +.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) @@ -729,8 +729,8 @@ gpu::VideoWriter_GPU::open -------------------------- Initializes or reinitializes video writer. -.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) -.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) +.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) +.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) .. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) .. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) @@ -797,10 +797,10 @@ Different parameters for CUDA video encoder. :: int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS EncoderParams(); - explicit EncoderParams(const std::string& configFile); + explicit EncoderParams(const cv::String& configFile); - void load(const std::string& configFile); - void save(const std::string& configFile) const; + void load(const cv::String& configFile); + void save(const cv::String& configFile) const; }; @@ -810,7 +810,7 @@ gpu::VideoWriter_GPU::EncoderParams::EncoderParams Constructors. .. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams() -.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string& configFile) +.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile) :param configFile: Config file name. @@ -822,7 +822,7 @@ gpu::VideoWriter_GPU::EncoderParams::load ----------------------------------------- Reads parameters from config file. -.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::load(const std::string& configFile) +.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile) :param configFile: Config file name. @@ -832,7 +832,7 @@ gpu::VideoWriter_GPU::EncoderParams::save ----------------------------------------- Saves parameters to config file. -.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::save(const std::string& configFile) const +.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::save(const cv::String& configFile) const :param configFile: Config file name. @@ -982,7 +982,7 @@ gpu::VideoReader_GPU::VideoReader_GPU Constructors. .. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU() -.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const std::string& filename) +.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::String& filename) .. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr& source) :param filename: Name of the input video file. @@ -997,7 +997,7 @@ gpu::VideoReader_GPU::open -------------------------- Initializes or reinitializes video reader. -.. ocv:function:: void gpu::VideoReader_GPU::open(const std::string& filename) +.. ocv:function:: void gpu::VideoReader_GPU::open(const cv::String& filename) .. ocv:function:: void gpu::VideoReader_GPU::open(const cv::Ptr& source) The method opens video reader. Parameters are the same as in the constructor :ocv:func:`gpu::VideoReader_GPU::VideoReader_GPU` . The method throws :ocv:class:`Exception` if error occurs. diff --git a/modules/gpu/include/opencv2/gpu.hpp b/modules/gpu/include/opencv2/gpu.hpp index e0933342bd..6f06791bf0 100644 --- a/modules/gpu/include/opencv2/gpu.hpp +++ b/modules/gpu/include/opencv2/gpu.hpp @@ -1384,11 +1384,11 @@ class CV_EXPORTS CascadeClassifier_GPU { public: CascadeClassifier_GPU(); - CascadeClassifier_GPU(const std::string& filename); + CascadeClassifier_GPU(const cv::String& filename); ~CascadeClassifier_GPU(); bool empty() const; - bool load(const std::string& filename); + bool load(const cv::String& filename); void release(); /* returns number of detected objects */ @@ -2170,15 +2170,15 @@ public: }; VideoWriter_GPU(); - VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); - VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); + VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); + VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); ~VideoWriter_GPU(); // all methods throws cv::Exception if error occurs - void open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); - void open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); + void open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); + void open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); void open(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); void open(const cv::Ptr& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); @@ -2210,10 +2210,10 @@ public: int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS EncoderParams(); - explicit EncoderParams(const std::string& configFile); + explicit EncoderParams(const cv::String& configFile); - void load(const std::string& configFile); - void save(const std::string& configFile) const; + void load(const cv::String& configFile); + void save(const cv::String& configFile) const; }; EncoderParams getParams() const; @@ -2301,12 +2301,12 @@ public: class VideoSource; VideoReader_GPU(); - explicit VideoReader_GPU(const std::string& filename); + explicit VideoReader_GPU(const cv::String& filename); explicit VideoReader_GPU(const cv::Ptr& source); ~VideoReader_GPU(); - void open(const std::string& filename); + void open(const cv::String& filename); void open(const cv::Ptr& source); bool isOpened() const; diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index e82ee9d336..3ac211962e 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -50,10 +50,10 @@ using namespace cv::gpu; #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU() { throw_nogpu(); } -cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const std::string&) { throw_nogpu(); } +cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::String&) { throw_nogpu(); } cv::gpu::CascadeClassifier_GPU::~CascadeClassifier_GPU() { throw_nogpu(); } bool cv::gpu::CascadeClassifier_GPU::empty() const { throw_nogpu(); return true; } -bool cv::gpu::CascadeClassifier_GPU::load(const std::string&) { throw_nogpu(); return true; } +bool cv::gpu::CascadeClassifier_GPU::load(const cv::String&) { throw_nogpu(); return true; } Size cv::gpu::CascadeClassifier_GPU::getClassifierSize() const { throw_nogpu(); return Size();} void cv::gpu::CascadeClassifier_GPU::release() { throw_nogpu(); } int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat&, GpuMat&, double, int, Size) {throw_nogpu(); return -1;} @@ -71,7 +71,7 @@ public: bool findLargestObject, bool visualizeInPlace, cv::Size ncvMinSize, cv::Size maxObjectSize) = 0; virtual cv::Size getClassifierCvSize() const = 0; - virtual bool read(const std::string& classifierAsXml) = 0; + virtual bool read(const cv::String& classifierAsXml) = 0; }; struct cv::gpu::CascadeClassifier_GPU::HaarCascade : cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl @@ -82,7 +82,7 @@ public: ncvSetDebugOutputHandler(NCVDebugOutputHandler); } - bool read(const std::string& filename) + bool read(const cv::String& filename) { ncvSafeCall( load(filename) ); return true; @@ -169,9 +169,9 @@ public: cv::Size getClassifierCvSize() const { return cv::Size(haar.ClassifierSize.width, haar.ClassifierSize.height); } private: - static void NCVDebugOutputHandler(const std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } + static void NCVDebugOutputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } - NCVStatus load(const std::string& classifierFile) + NCVStatus load(const cv::String& classifierFile) { int devId = cv::gpu::getDevice(); ncvAssertCUDAReturn(cudaGetDeviceProperties(&devProp, devId), NCV_CUDA_ERROR); @@ -458,7 +458,7 @@ public: virtual cv::Size getClassifierCvSize() const { return NxM; } - bool read(const std::string& classifierAsXml) + bool read(const cv::String& classifierAsXml) { FileStorage fs(classifierAsXml, FileStorage::READ); return fs.isOpened() ? read(fs.getFirstTopLevelNode()) : false; @@ -512,10 +512,10 @@ private: const char *GPU_CC_FEATURES = "features"; const char *GPU_CC_RECT = "rect"; - std::string stageTypeStr = (std::string)root[GPU_CC_STAGE_TYPE]; + cv::String stageTypeStr = (cv::String)root[GPU_CC_STAGE_TYPE]; CV_Assert(stageTypeStr == GPU_CC_BOOST); - std::string featureTypeStr = (std::string)root[GPU_CC_FEATURE_TYPE]; + cv::String featureTypeStr = (cv::String)root[GPU_CC_FEATURE_TYPE]; CV_Assert(featureTypeStr == GPU_CC_LBP); NxM.width = (int)root[GPU_CC_WIDTH]; @@ -662,7 +662,7 @@ private: cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU() : findLargestObject(false), visualizeInPlace(false), impl(0) {} -cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const std::string& filename) +cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::String& filename) : findLargestObject(false), visualizeInPlace(false), impl(0) { load(filename); } cv::gpu::CascadeClassifier_GPU::~CascadeClassifier_GPU() { release(); } @@ -688,11 +688,11 @@ int cv::gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat return impl->process(image, objectsBuf, (float)scaleFactor, minNeighbors, findLargestObject, visualizeInPlace, minSize, maxObjectSize); } -bool cv::gpu::CascadeClassifier_GPU::load(const std::string& filename) +bool cv::gpu::CascadeClassifier_GPU::load(const cv::String& filename) { release(); - std::string fext = filename.substr(filename.find_last_of(".") + 1); + cv::String fext = filename.substr(filename.find_last_of(".") + 1); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); if (fext == "nvbin") @@ -710,7 +710,7 @@ bool cv::gpu::CascadeClassifier_GPU::load(const std::string& filename) } const char *GPU_CC_LBP = "LBP"; - std::string featureTypeStr = (std::string)fs.getFirstTopLevelNode()["featureType"]; + cv::String featureTypeStr = (cv::String)fs.getFirstTopLevelNode()["featureType"]; if (featureTypeStr == GPU_CC_LBP) impl = new LbpCascade(); else @@ -759,7 +759,7 @@ void groupRectangles(std::vector &hypotheses, int groupThreshold, do hypotheses.resize(rects.size()); } -NCVStatus loadFromXML(const std::string &filename, +NCVStatus loadFromXML(const cv::String &filename, HaarClassifierCascadeDescriptor &haar, std::vector &haarStages, std::vector &haarClassifierNodes, diff --git a/modules/gpu/src/cu_safe_call.cpp b/modules/gpu/src/cu_safe_call.cpp index 7218873dff..f2c684408e 100644 --- a/modules/gpu/src/cu_safe_call.cpp +++ b/modules/gpu/src/cu_safe_call.cpp @@ -51,7 +51,7 @@ namespace struct ErrorEntry { int code; - std::string str; + cv::String str; }; class ErrorEntryComparer @@ -65,11 +65,11 @@ namespace int code_; }; - std::string getErrorString(int code, const ErrorEntry* errors, size_t n) + cv::String getErrorString(int code, const ErrorEntry* errors, size_t n) { size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors; - const std::string& msg = (idx != n) ? errors[idx].str : std::string("Unknown error code"); + const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code"); std::ostringstream ostr; ostr << msg << " [Code = " << code << "]"; @@ -131,7 +131,7 @@ namespace const size_t cu_errors_num = sizeof(cu_errors) / sizeof(cu_errors[0]); } -std::string cv::gpu::detail::cuGetErrString(CUresult res) +cv::String cv::gpu::detail::cuGetErrString(CUresult res) { return getErrorString(res, cu_errors, cu_errors_num); } diff --git a/modules/gpu/src/cu_safe_call.h b/modules/gpu/src/cu_safe_call.h index 6f93adc760..12c15d4fe9 100644 --- a/modules/gpu/src/cu_safe_call.h +++ b/modules/gpu/src/cu_safe_call.h @@ -50,7 +50,7 @@ namespace cv { namespace gpu { namespace detail { - std::string cuGetErrString(CUresult res); + cv::String cuGetErrString(CUresult res); inline void cuSafeCall_impl(CUresult res, const char* file, int line) { diff --git a/modules/gpu/src/cuvid_video_source.cpp b/modules/gpu/src/cuvid_video_source.cpp index 7d45b8fee9..b637ce4af7 100644 --- a/modules/gpu/src/cuvid_video_source.cpp +++ b/modules/gpu/src/cuvid_video_source.cpp @@ -3,7 +3,7 @@ #if defined(HAVE_CUDA) && defined(HAVE_NVCUVID) -cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const std::string& fname) +cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const cv::String& fname) { CUVIDSOURCEPARAMS params; std::memset(¶ms, 0, sizeof(CUVIDSOURCEPARAMS)); diff --git a/modules/gpu/src/cuvid_video_source.h b/modules/gpu/src/cuvid_video_source.h index 1c4c0e5e00..9a246d7477 100644 --- a/modules/gpu/src/cuvid_video_source.h +++ b/modules/gpu/src/cuvid_video_source.h @@ -54,7 +54,7 @@ namespace cv { namespace gpu class CuvidVideoSource : public VideoReader_GPU::VideoSource { public: - explicit CuvidVideoSource(const std::string& fname); + explicit CuvidVideoSource(const cv::String& fname); ~CuvidVideoSource() { cuvidDestroyVideoSource(videoSource_); } VideoReader_GPU::FormatInfo format() const; diff --git a/modules/gpu/src/error.cpp b/modules/gpu/src/error.cpp index e01be8010a..11e28c7292 100644 --- a/modules/gpu/src/error.cpp +++ b/modules/gpu/src/error.cpp @@ -54,7 +54,7 @@ namespace struct ErrorEntry { int code; - std::string str; + cv::String str; }; struct ErrorEntryComparer @@ -64,11 +64,11 @@ namespace bool operator()(const ErrorEntry& e) const { return e.code == code; } }; - std::string getErrorString(int code, const ErrorEntry* errors, size_t n) + cv::String getErrorString(int code, const ErrorEntry* errors, size_t n) { size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors; - const std::string& msg = (idx != n) ? errors[idx].str : std::string("Unknown error code"); + const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code"); std::ostringstream ostr; ostr << msg << " [Code = " << code << "]"; @@ -221,25 +221,25 @@ namespace cv { void nppError(int code, const char *file, const int line, const char *func) { - std::string msg = getErrorString(code, npp_errors, npp_error_num); + cv::String msg = getErrorString(code, npp_errors, npp_error_num); cv::gpu::error(msg.c_str(), file, line, func); } void ncvError(int code, const char *file, const int line, const char *func) { - std::string msg = getErrorString(code, ncv_errors, ncv_error_num); + cv::String msg = getErrorString(code, ncv_errors, ncv_error_num); cv::gpu::error(msg.c_str(), file, line, func); } void cufftError(int code, const char *file, const int line, const char *func) { - std::string msg = getErrorString(code, cufft_errors, cufft_error_num); + cv::String msg = getErrorString(code, cufft_errors, cufft_error_num); cv::gpu::error(msg.c_str(), file, line, func); } void cublasError(int code, const char *file, const int line, const char *func) { - std::string msg = getErrorString(code, cublas_errors, cublas_error_num); + cv::String msg = getErrorString(code, cublas_errors, cublas_error_num); cv::gpu::error(msg.c_str(), file, line, func); } } diff --git a/modules/gpu/src/ffmpeg_video_source.cpp b/modules/gpu/src/ffmpeg_video_source.cpp index bd3d70058a..625d8dd79d 100644 --- a/modules/gpu/src/ffmpeg_video_source.cpp +++ b/modules/gpu/src/ffmpeg_video_source.cpp @@ -96,7 +96,7 @@ namespace } } -cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const std::string& fname) : +cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const cv::String& fname) : stream_(0) { CV_Assert( init_MediaStream_FFMPEG() ); diff --git a/modules/gpu/src/ffmpeg_video_source.h b/modules/gpu/src/ffmpeg_video_source.h index 41bf0cfd0e..b08a6b370a 100644 --- a/modules/gpu/src/ffmpeg_video_source.h +++ b/modules/gpu/src/ffmpeg_video_source.h @@ -57,7 +57,7 @@ namespace cv { namespace gpu class FFmpegVideoSource : public VideoReader_GPU::VideoSource { public: - FFmpegVideoSource(const std::string& fname); + FFmpegVideoSource(const cv::String& fname); ~FFmpegVideoSource(); VideoReader_GPU::FormatInfo format() const; diff --git a/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu b/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu index fb057ae79d..f2f318152f 100644 --- a/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu +++ b/modules/gpu/src/nvidia/NCVHaarObjectDetection.cu @@ -2099,7 +2099,7 @@ NCVStatus ncvGrowDetectionsVector_host(NCVVector &pixelMask, } -NCVStatus loadFromXML(const std::string &filename, +NCVStatus loadFromXML(const cv::String &filename, HaarClassifierCascadeDescriptor &haar, std::vector &haarStages, std::vector &haarClassifierNodes, @@ -2110,7 +2110,7 @@ NCVStatus loadFromXML(const std::string &filename, #define NVBIN_HAAR_VERSION 0x1 -static NCVStatus loadFromNVBIN(const std::string &filename, +static NCVStatus loadFromNVBIN(const cv::String &filename, HaarClassifierCascadeDescriptor &haar, std::vector &haarStages, std::vector &haarClassifierNodes, @@ -2174,13 +2174,13 @@ static NCVStatus loadFromNVBIN(const std::string &filename, } -NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStages, +NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages, Ncv32u &numNodes, Ncv32u &numFeatures) { size_t readCount; NCVStatus ncvStat; - std::string fext = filename.substr(filename.find_last_of(".") + 1); + cv::String fext = filename.substr(filename.find_last_of(".") + 1); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); if (fext == "nvbin") @@ -2226,7 +2226,7 @@ NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStage } -NCVStatus ncvHaarLoadFromFile_host(const std::string &filename, +NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename, HaarClassifierCascadeDescriptor &haar, NCVVector &h_HaarStages, NCVVector &h_HaarNodes, @@ -2238,7 +2238,7 @@ NCVStatus ncvHaarLoadFromFile_host(const std::string &filename, NCVStatus ncvStat; - std::string fext = filename.substr(filename.find_last_of(".") + 1); + cv::String fext = filename.substr(filename.find_last_of(".") + 1); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); std::vector haarStages; @@ -2272,7 +2272,7 @@ NCVStatus ncvHaarLoadFromFile_host(const std::string &filename, } -NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename, +NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename, HaarClassifierCascadeDescriptor haar, NCVVector &h_HaarStages, NCVVector &h_HaarNodes, diff --git a/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp b/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp index 9f29206f06..b112566419 100644 --- a/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp +++ b/modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp @@ -439,18 +439,18 @@ NCV_EXPORTS NCVStatus ncvGrowDetectionsVector_host(NCVVector &pixelMask, Ncv32f curScale); -NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStages, +NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages, Ncv32u &numNodes, Ncv32u &numFeatures); -NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const std::string &filename, +NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename, HaarClassifierCascadeDescriptor &haar, NCVVector &h_HaarStages, NCVVector &h_HaarNodes, NCVVector &h_HaarFeatures); -NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename, +NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename, HaarClassifierCascadeDescriptor haar, NCVVector &h_HaarStages, NCVVector &h_HaarNodes, diff --git a/modules/gpu/src/nvidia/core/NCV.cu b/modules/gpu/src/nvidia/core/NCV.cu index 77e59cc5c1..f1b2194f81 100644 --- a/modules/gpu/src/nvidia/core/NCV.cu +++ b/modules/gpu/src/nvidia/core/NCV.cu @@ -53,7 +53,7 @@ //============================================================================== -static void stdDebugOutput(const std::string &msg) +static void stdDebugOutput(const cv::String &msg) { std::cout << msg; } @@ -62,7 +62,7 @@ static void stdDebugOutput(const std::string &msg) static NCVDebugOutputHandler *debugOutputHandler = stdDebugOutput; -void ncvDebugOutput(const std::string &msg) +void ncvDebugOutput(const cv::String &msg) { debugOutputHandler(msg); } diff --git a/modules/gpu/src/nvidia/core/NCV.hpp b/modules/gpu/src/nvidia/core/NCV.hpp index 703cb827b9..12ef4e77da 100644 --- a/modules/gpu/src/nvidia/core/NCV.hpp +++ b/modules/gpu/src/nvidia/core/NCV.hpp @@ -243,10 +243,10 @@ const Ncv32u K_LOG2_WARP_SIZE = 5; //============================================================================== -NCV_EXPORTS void ncvDebugOutput(const std::string &msg); +NCV_EXPORTS void ncvDebugOutput(const cv::String &msg); -typedef void NCVDebugOutputHandler(const std::string &msg); +typedef void NCVDebugOutputHandler(const cv::String &msg); NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func); diff --git a/modules/gpu/src/optical_flow.cpp b/modules/gpu/src/optical_flow.cpp index 3d8fc05ec3..ce90ba7f39 100644 --- a/modules/gpu/src/optical_flow.cpp +++ b/modules/gpu/src/optical_flow.cpp @@ -68,7 +68,7 @@ namespace namespace { - static void outputHandler(const std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } + static void outputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } } void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& frame1, GpuMat& u, GpuMat& v, Stream& s) diff --git a/modules/gpu/src/video_reader.cpp b/modules/gpu/src/video_reader.cpp index 3224902c6d..e46fc9bc92 100644 --- a/modules/gpu/src/video_reader.cpp +++ b/modules/gpu/src/video_reader.cpp @@ -49,10 +49,10 @@ class cv::gpu::VideoReader_GPU::Impl }; cv::gpu::VideoReader_GPU::VideoReader_GPU() { throw_nogpu(); } -cv::gpu::VideoReader_GPU::VideoReader_GPU(const std::string&) { throw_nogpu(); } +cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::String&) { throw_nogpu(); } cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr&) { throw_nogpu(); } cv::gpu::VideoReader_GPU::~VideoReader_GPU() { } -void cv::gpu::VideoReader_GPU::open(const std::string&) { throw_nogpu(); } +void cv::gpu::VideoReader_GPU::open(const cv::String&) { throw_nogpu(); } void cv::gpu::VideoReader_GPU::open(const cv::Ptr&) { throw_nogpu(); } bool cv::gpu::VideoReader_GPU::isOpened() const { return false; } void cv::gpu::VideoReader_GPU::close() { } @@ -294,7 +294,7 @@ cv::gpu::VideoReader_GPU::VideoReader_GPU() { } -cv::gpu::VideoReader_GPU::VideoReader_GPU(const std::string& filename) +cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::String& filename) { open(filename); } @@ -309,7 +309,7 @@ cv::gpu::VideoReader_GPU::~VideoReader_GPU() close(); } -void cv::gpu::VideoReader_GPU::open(const std::string& filename) +void cv::gpu::VideoReader_GPU::open(const cv::String& filename) { CV_Assert( !filename.empty() ); diff --git a/modules/gpu/src/video_writer.cpp b/modules/gpu/src/video_writer.cpp index fe44a16f7c..797d4ffc99 100644 --- a/modules/gpu/src/video_writer.cpp +++ b/modules/gpu/src/video_writer.cpp @@ -49,13 +49,13 @@ class cv::gpu::VideoWriter_GPU::Impl }; cv::gpu::VideoWriter_GPU::VideoWriter_GPU() { throw_nogpu(); } -cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } -cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } +cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } +cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::~VideoWriter_GPU() {} -void cv::gpu::VideoWriter_GPU::open(const std::string&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } -void cv::gpu::VideoWriter_GPU::open(const std::string&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } +void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } +void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const cv::Ptr&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const cv::Ptr&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } bool cv::gpu::VideoWriter_GPU::isOpened() const { return false; } @@ -64,9 +64,9 @@ void cv::gpu::VideoWriter_GPU::write(const cv::gpu::GpuMat&, bool) { throw_nogpu cv::gpu::VideoWriter_GPU::EncoderParams cv::gpu::VideoWriter_GPU::getParams() const { EncoderParams params; throw_nogpu(); return params; } cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams() { throw_nogpu(); } -cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string&) { throw_nogpu(); } -void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string&) { throw_nogpu(); } -void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string&) const { throw_nogpu(); } +cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String&) { throw_nogpu(); } +void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String&) { throw_nogpu(); } +void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String&) const { throw_nogpu(); } #else // !defined HAVE_CUDA || !defined WIN32 @@ -736,7 +736,7 @@ void NVENCAPI cv::gpu::VideoWriter_GPU::Impl::HandleOnEndFrame(const NVVE_EndFra class EncoderCallBackFFMPEG : public cv::gpu::VideoWriter_GPU::EncoderCallBack { public: - EncoderCallBackFFMPEG(const std::string& fileName, cv::Size frameSize, double fps); + EncoderCallBackFFMPEG(const cv::String& fileName, cv::Size frameSize, double fps); ~EncoderCallBackFFMPEG(); unsigned char* acquireBitStream(int* bufferSize); @@ -799,7 +799,7 @@ namespace } } -EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const std::string& fileName, cv::Size frameSize, double fps) : +EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const cv::String& fileName, cv::Size frameSize, double fps) : stream_(0), isKeyFrame_(false) { int buf_size = std::max(frameSize.area() * 4, 1024 * 1024); @@ -843,12 +843,12 @@ cv::gpu::VideoWriter_GPU::VideoWriter_GPU() { } -cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format) +cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format) { open(fileName, frameSize, fps, format); } -cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) +cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) { open(fileName, frameSize, fps, params, format); } @@ -868,14 +868,14 @@ cv::gpu::VideoWriter_GPU::~VideoWriter_GPU() close(); } -void cv::gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format) +void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format) { close(); cv::Ptr encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps)); open(encoderCallback, frameSize, fps, format); } -void cv::gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) +void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) { close(); cv::Ptr encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps)); @@ -944,12 +944,12 @@ cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams() DisableSPSPPS = 0; } -cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string& configFile) +cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile) { load(configFile); } -void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string& configFile) +void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile) { cv::FileStorage fs(configFile, cv::FileStorage::READ); CV_Assert( fs.isOpened() ); @@ -975,7 +975,7 @@ void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string& configFile cv::read(fs["DisableSPSPPS" ], DisableSPSPPS, 0); } -void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string& configFile) const +void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String& configFile) const { cv::FileStorage fs(configFile, cv::FileStorage::WRITE); CV_Assert( fs.isOpened() ); diff --git a/modules/legacy/include/opencv2/legacy.hpp b/modules/legacy/include/opencv2/legacy.hpp index 7b765b0c8f..8581a8f54c 100644 --- a/modules/legacy/include/opencv2/legacy.hpp +++ b/modules/legacy/include/opencv2/legacy.hpp @@ -1887,7 +1887,7 @@ public: void setVerbose(bool verbose); void read(const FileNode& node); - void write(FileStorage& fs, const std::string& name=std::string()) const; + void write(FileStorage& fs, const cv::String& name=cv::String()) const; int radius; int threshold; @@ -1918,7 +1918,7 @@ public: const PatchGenerator& patchGenerator=PatchGenerator()); virtual ~FernClassifier(); virtual void read(const FileNode& n); - virtual void write(FileStorage& fs, const std::string& name=std::string()) const; + virtual void write(FileStorage& fs, const cv::String& name=cv::String()) const; virtual void trainFromSingleView(const Mat& image, const std::vector& keypoints, int _patchSize=PATCH_SIZE, @@ -2062,8 +2062,8 @@ public: inline void applyQuantization(int num_quant_bits) { makePosteriors2(num_quant_bits); } // debug - void savePosteriors(std::string url, bool append=false); - void savePosteriors2(std::string url, bool append=false); + void savePosteriors(cv::String url, bool append=false); + void savePosteriors2(cv::String url, bool append=false); private: int classes_; @@ -2181,9 +2181,9 @@ public: void write(std::ostream &os) const; // experimental and debug - void saveAllFloatPosteriors(std::string file_url); - void saveAllBytePosteriors(std::string file_url); - void setFloatPosteriorsFromTextfile_176(std::string url); + void saveAllFloatPosteriors(cv::String file_url); + void saveAllBytePosteriors(cv::String file_url); + void setFloatPosteriorsFromTextfile_176(cv::String url); float countZeroElements(); std::vector trees_; @@ -2356,7 +2356,7 @@ protected: CvAffinePose* m_affine_poses; // an array of poses CvMat** m_transforms; // an array of affine transforms corresponding to poses - std::string m_feature_name; // the name of the feature associated with the descriptor + cv::String m_feature_name; // the name of the feature associated with the descriptor CvPoint m_center; // the coordinates of the feature (the center of the input image ROI) int m_pca_dim_high; // the number of descriptor pca components to use for generating affine poses @@ -2382,7 +2382,7 @@ public: const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1, int pca_dim_high = 100, int pca_dim_low = 100); - OneWayDescriptorBase(CvSize patch_size, int pose_count, const std::string &pca_filename, const std::string &train_path = std::string(), const std::string &images_list = std::string(), + OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename, const cv::String &train_path = cv::String(), const cv::String &images_list = cv::String(), float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1, int pca_dim_high = 100, int pca_dim_low = 100); @@ -2516,7 +2516,7 @@ public: void ConvertDescriptorsArrayToTree(); // Converting pca_descriptors array to KD tree // GetPCAFilename: get default PCA filename - static std::string GetPCAFilename () { return "pca.yml"; } + static cv::String GetPCAFilename () { return "pca.yml"; } virtual bool empty() const { return m_train_feature_count <= 0 ? true : false; } @@ -2568,8 +2568,8 @@ public: OneWayDescriptorObject(CvSize patch_size, int pose_count, const char* train_path, const char* pca_config, const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1); - OneWayDescriptorObject(CvSize patch_size, int pose_count, const std::string &pca_filename, - const std::string &train_path = std::string (), const std::string &images_list = std::string (), + OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename, + const cv::String &train_path = cv::String (), const cv::String &images_list = cv::String (), float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1); @@ -2633,16 +2633,16 @@ public: Params( int poseCount = POSE_COUNT, Size patchSize = Size(PATCH_WIDTH, PATCH_HEIGHT), - std::string pcaFilename = std::string(), - std::string trainPath = std::string(), std::string trainImagesList = std::string(), + cv::String pcaFilename = cv::String(), + cv::String trainPath = cv::String(), cv::String trainImagesList = cv::String(), float minScale = GET_MIN_SCALE(), float maxScale = GET_MAX_SCALE(), float stepScale = GET_STEP_SCALE() ); int poseCount; Size patchSize; - std::string pcaFilename; - std::string trainPath; - std::string trainImagesList; + cv::String pcaFilename; + cv::String trainPath; + cv::String trainImagesList; float minScale, maxScale, stepScale; }; @@ -2706,7 +2706,7 @@ public: int compressionMethod=FernClassifier::COMPRESSION_NONE, const PatchGenerator& patchGenerator=PatchGenerator() ); - Params( const std::string& filename ); + Params( const cv::String& filename ); int nclasses; int patchSize; @@ -2717,7 +2717,7 @@ public: int compressionMethod; PatchGenerator patchGenerator; - std::string filename; + cv::String filename; }; FernDescriptorMatcher( const Params& params=Params() ); @@ -2759,7 +2759,7 @@ template class CV_EXPORTS CalonderDescriptorExtractor : public DescriptorExtractor { public: - CalonderDescriptorExtractor( const std::string& classifierFile ); + CalonderDescriptorExtractor( const cv::String& classifierFile ); virtual void read( const FileNode &fn ); virtual void write( FileStorage &fs ) const; @@ -2777,7 +2777,7 @@ protected: }; template -CalonderDescriptorExtractor::CalonderDescriptorExtractor(const std::string& classifier_file) +CalonderDescriptorExtractor::CalonderDescriptorExtractor(const cv::String& classifier_file) { classifier_.read( classifier_file.c_str() ); } @@ -2867,7 +2867,7 @@ public: void setVerbose(bool verbose); void read(const FileNode& node); - void write(FileStorage& fs, const std::string& name=std::string()) const; + void write(FileStorage& fs, const cv::String& name=cv::String()) const; bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT std::vector& corners) const; bool operator()(const std::vector& pyr, const std::vector& keypoints, CV_OUT Mat& H, CV_OUT std::vector& corners, diff --git a/modules/legacy/src/calonder.cpp b/modules/legacy/src/calonder.cpp index 73f274862d..51cb13047f 100644 --- a/modules/legacy/src/calonder.cpp +++ b/modules/legacy/src/calonder.cpp @@ -626,7 +626,7 @@ void RandomizedTree::write(std::ostream &os) const } -void RandomizedTree::savePosteriors(std::string url, bool append) +void RandomizedTree::savePosteriors(cv::String url, bool append) { std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out)); for (int i=0; iwrite(os); } -void RTreeClassifier::saveAllFloatPosteriors(std::string url) +void RTreeClassifier::saveAllFloatPosteriors(cv::String url) { printf("[DEBUG] writing all float posteriors to %s...\n", url.c_str()); for (int i=0; i<(int)trees_.size(); ++i) @@ -923,7 +923,7 @@ void RTreeClassifier::saveAllFloatPosteriors(std::string url) printf("[DEBUG] done\n"); } -void RTreeClassifier::saveAllBytePosteriors(std::string url) +void RTreeClassifier::saveAllBytePosteriors(cv::String url) { printf("[DEBUG] writing all byte posteriors to %s...\n", url.c_str()); for (int i=0; i<(int)trees_.size(); ++i) @@ -932,7 +932,7 @@ void RTreeClassifier::saveAllBytePosteriors(std::string url) } -void RTreeClassifier::setFloatPosteriorsFromTextfile_176(std::string url) +void RTreeClassifier::setFloatPosteriorsFromTextfile_176(cv::String url) { std::ifstream ifs(url.c_str()); diff --git a/modules/legacy/src/oneway.cpp b/modules/legacy/src/oneway.cpp index eae17a5d47..e885dfef2e 100644 --- a/modules/legacy/src/oneway.cpp +++ b/modules/legacy/src/oneway.cpp @@ -465,7 +465,7 @@ namespace cv{ void OneWayDescriptor::Initialize(int pose_count, IplImage* frontal, const char* feature_name, int norm) { - m_feature_name = std::string(feature_name); + m_feature_name = cv::String(feature_name); CvRect roi = cvGetImageROI(frontal); m_center = rect_center(roi); @@ -482,7 +482,7 @@ namespace cv{ Initialize(pose_count, frontal, feature_name, 1); return; } - m_feature_name = std::string(feature_name); + m_feature_name = cv::String(feature_name); CvRect roi = cvGetImageROI(frontal); m_center = rect_center(roi); @@ -1287,8 +1287,8 @@ namespace cv{ } - OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const std::string &pca_filename, - const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max, + OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename, + const cv::String &train_path, const cv::String &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels, int pca_dim_high, int pca_dim_low) : m_pca_dim_high(pca_dim_high), m_pca_dim_low(pca_dim_low), scale_min(_scale_min), scale_max(_scale_max), scale_step(_scale_step) @@ -2080,8 +2080,8 @@ namespace cv{ m_part_id = 0; } - OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const std::string &pca_filename, - const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) : + OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename, + const cv::String &train_path, const cv::String &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) : OneWayDescriptorBase(patch_size, pose_count, pca_filename, train_path, images_list, _scale_min, _scale_max, _scale_step, pyr_levels) { m_part_id = 0; @@ -2145,7 +2145,7 @@ namespace cv{ void readPCAFeatures(const FileNode &fn, CvMat** avg, CvMat** eigenvectors, const char* postfix) { - std::string str = std::string ("avg") + postfix; + cv::String str = cv::String ("avg") + postfix; CvMat* _avg = reinterpret_cast (fn[str].readObj()); if (_avg != 0) { @@ -2153,7 +2153,7 @@ namespace cv{ cvReleaseMat(&_avg); } - str = std::string ("eigenvectors") + postfix; + str = cv::String ("eigenvectors") + postfix; CvMat* _eigenvectors = reinterpret_cast (fn[str].readObj()); if (_eigenvectors != 0) { @@ -2166,8 +2166,8 @@ namespace cv{ * OneWayDescriptorMatcher * \****************************************************************************************/ - OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, std::string _pcaFilename, - std::string _trainPath, std::string _trainImagesList, + OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, cv::String _pcaFilename, + cv::String _trainPath, cv::String _trainImagesList, float _minScale, float _maxScale, float _stepScale ) : poseCount(_poseCount), patchSize(_patchSize), pcaFilename(_pcaFilename), trainPath(_trainPath), trainImagesList(_trainImagesList), @@ -2271,7 +2271,7 @@ namespace cv{ void OneWayDescriptorMatcher::read( const FileNode &fn ) { - base = new OneWayDescriptorObject( params.patchSize, params.poseCount, std::string (), std::string (), std::string (), + base = new OneWayDescriptorObject( params.patchSize, params.poseCount, cv::String (), cv::String (), cv::String (), params.minScale, params.maxScale, params.stepScale ); base->Read (fn); } diff --git a/modules/legacy/src/planardetect.cpp b/modules/legacy/src/planardetect.cpp index 6c5e96ff8c..31aca76706 100644 --- a/modules/legacy/src/planardetect.cpp +++ b/modules/legacy/src/planardetect.cpp @@ -617,7 +617,7 @@ void LDetector::read(const FileNode& objnode) clusteringDistance = (int)objnode["clustering-distance"]; } -void LDetector::write(FileStorage& fs, const std::string& name) const +void LDetector::write(FileStorage& fs, const cv::String& name) const { WriteStructContext ws(fs, name, CV_NODE_MAP); @@ -707,7 +707,7 @@ FernClassifier::FernClassifier(const std::vector >& points, } -void FernClassifier::write(FileStorage& fs, const std::string& objname) const +void FernClassifier::write(FileStorage& fs, const cv::String& objname) const { WriteStructContext ws(fs, objname, CV_NODE_MAP); @@ -1228,7 +1228,7 @@ nstructs(_nstructs), structSize(_structSize), nviews(_nviews), compressionMethod(_compressionMethod), patchGenerator(_patchGenerator) {} -FernDescriptorMatcher::Params::Params( const std::string& _filename ) +FernDescriptorMatcher::Params::Params( const cv::String& _filename ) { filename = _filename; } @@ -1476,7 +1476,7 @@ void PlanarObjectDetector::read(const FileNode& node) } -void PlanarObjectDetector::write(FileStorage& fs, const std::string& objname) const +void PlanarObjectDetector::write(FileStorage& fs, const cv::String& objname) const { WriteStructContext ws(fs, objname, CV_NODE_MAP); diff --git a/modules/legacy/test/test_stereomatching.cpp b/modules/legacy/test/test_stereomatching.cpp index a6524bb712..7262249844 100644 --- a/modules/legacy/test/test_stereomatching.cpp +++ b/modules/legacy/test/test_stereomatching.cpp @@ -593,10 +593,10 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs ) assert(fn.isSeq()); for( int i = 0; i < (int)fn.size(); i+=3 ) { - string nm = fn[i]; + String nm = fn[i]; DatasetParams params; - string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); - string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); + String sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); + String uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); datasetsParams[nm] = params; } return cvtest::TS::OK; @@ -684,10 +684,10 @@ protected: assert(fn.isSeq()); for( int i = 0; i < (int)fn.size(); i+=4 ) { - string caseName = fn[i], datasetName = fn[i+1]; + String caseName = fn[i], datasetName = fn[i+1]; RunParams params; - string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); - string iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str()); + String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); + String iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str()); caseNames.push_back( caseName ); caseDatasets.push_back( datasetName ); caseRunParams.push_back( params ); diff --git a/modules/ml/doc/mldata.rst b/modules/ml/doc/mldata.rst index bae342e498..9973325175 100644 --- a/modules/ml/doc/mldata.rst +++ b/modules/ml/doc/mldata.rst @@ -48,7 +48,7 @@ Class for loading the data from a ``.csv`` file. void set_miss_ch( char ch ); char get_miss_ch() const; - const std::map& get_class_labels_map() const; + const std::map& get_class_labels_map() const; protected: ... @@ -245,7 +245,7 @@ CvMLData::get_class_labels_map ------------------------------- Returns a map that converts strings to labels. -.. ocv:function:: const std::map& CvMLData::get_class_labels_map() const +.. ocv:function:: const std::map& CvMLData::get_class_labels_map() const The method returns a map that converts string class labels to the numerical class labels. It can be used to get an original class label as in a file. diff --git a/modules/ml/include/opencv2/ml.hpp b/modules/ml/include/opencv2/ml.hpp index d1812c2a01..d3a690c967 100644 --- a/modules/ml/include/opencv2/ml.hpp +++ b/modules/ml/include/opencv2/ml.hpp @@ -1043,7 +1043,7 @@ public: CvForestTree* get_tree(int i) const; protected: - virtual std::string getName() const; + virtual cv::String getName() const; virtual bool grow_forest( const CvTermCriteria term_crit ); @@ -1115,7 +1115,7 @@ public: CvRTParams params=CvRTParams()); virtual bool train( CvMLData* data, CvRTParams params=CvRTParams() ); protected: - virtual std::string getName() const; + virtual cv::String getName() const; virtual bool grow_forest( const CvTermCriteria term_crit ); }; @@ -2072,7 +2072,7 @@ public: void set_miss_ch( char ch ); char get_miss_ch() const; - const std::map& get_class_labels_map() const; + const std::map& get_class_labels_map() const; protected: virtual void clear(); @@ -2101,7 +2101,7 @@ protected: bool mix; int total_class_count; - std::map class_map; + std::map class_map; CvMat* train_sample_idx; CvMat* test_sample_idx; diff --git a/modules/ml/src/data.cpp b/modules/ml/src/data.cpp index 7d9cceac4e..f4e401cb8d 100644 --- a/modules/ml/src/data.cpp +++ b/modules/ml/src/data.cpp @@ -285,7 +285,7 @@ const CvMat* CvMLData::get_missing() const return missing; } -const std::map& CvMLData::get_class_labels_map() const +const std::map& CvMLData::get_class_labels_map() const { return class_map; } diff --git a/modules/ml/src/ertrees.cpp b/modules/ml/src/ertrees.cpp index 31d20398a9..8b7091c333 100644 --- a/modules/ml/src/ertrees.cpp +++ b/modules/ml/src/ertrees.cpp @@ -1537,7 +1537,7 @@ CvERTrees::~CvERTrees() { } -std::string CvERTrees::getName() const +cv::String CvERTrees::getName() const { return CV_TYPE_NAME_ML_ERTREES; } diff --git a/modules/ml/src/gbt.cpp b/modules/ml/src/gbt.cpp index a409b7ab32..04e7a0fe31 100644 --- a/modules/ml/src/gbt.cpp +++ b/modules/ml/src/gbt.cpp @@ -1117,7 +1117,7 @@ void CvGBTrees::write( CvFileStorage* fs, const char* name ) const CvSeqReader reader; int i; - std::string s; + cv::String s; cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT ); @@ -1167,7 +1167,7 @@ void CvGBTrees::read( CvFileStorage* fs, CvFileNode* node ) CvFileNode* trees_fnode; CvMemStorage* storage; int i, ntrees; - std::string s; + cv::String s; clear(); read_params( fs, node ); diff --git a/modules/ml/src/precomp.hpp b/modules/ml/src/precomp.hpp index c180244657..281ff11af5 100644 --- a/modules/ml/src/precomp.hpp +++ b/modules/ml/src/precomp.hpp @@ -45,6 +45,7 @@ #include "cvconfig.h" #endif +#include "opencv2/core.hpp" #include "opencv2/ml.hpp" #include "opencv2/core/core_c.h" #include "opencv2/core/utility.hpp" diff --git a/modules/ml/src/rtrees.cpp b/modules/ml/src/rtrees.cpp index d88611bef5..8e287864a1 100644 --- a/modules/ml/src/rtrees.cpp +++ b/modules/ml/src/rtrees.cpp @@ -246,7 +246,7 @@ CvRTrees::~CvRTrees() clear(); } -std::string CvRTrees::getName() const +cv::String CvRTrees::getName() const { return CV_TYPE_NAME_ML_RTREES; } @@ -730,7 +730,7 @@ void CvRTrees::write( CvFileStorage* fs, const char* name ) const if( ntrees < 1 || !trees || nsamples < 1 ) CV_Error( CV_StsBadArg, "Invalid CvRTrees object" ); - std::string modelNodeName = this->getName(); + cv::String modelNodeName = this->getName(); cvStartWriteStruct( fs, name, CV_NODE_MAP, modelNodeName.c_str() ); cvWriteInt( fs, "nclasses", nclasses ); diff --git a/modules/ml/src/svm.cpp b/modules/ml/src/svm.cpp index 76e0c41bc7..47fc6c3547 100644 --- a/modules/ml/src/svm.cpp +++ b/modules/ml/src/svm.cpp @@ -1924,7 +1924,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses, qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio); double old_dist = 0.0; for (int k=0; k 0.0) @@ -1941,7 +1941,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses, qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio); new_dist = 0.0; for (int k=0; k *resp // 4. em // 5. ann -int str_to_ann_train_method( string& str ) +int str_to_ann_train_method( String& str ) { if( !str.compare("BACKPROP") ) return CvANN_MLP_TrainParams::BACKPROP; @@ -412,7 +412,7 @@ float ann_calc_error( CvANN_MLP* ann, CvMLData* _data, map& cls_map, i // 6. dtree // 7. boost -int str_to_boost_type( string& str ) +int str_to_boost_type( String& str ) { if ( !str.compare("DISCRETE") ) return CvBoost::DISCRETE; @@ -546,7 +546,7 @@ void CV_MLBaseTest::run( int ) int CV_MLBaseTest::prepare_test_case( int test_case_idx ) { int trainSampleCount, respIdx; - string varTypes; + String varTypes; clear(); string dataPath = ts->get_data_path(); @@ -605,7 +605,7 @@ int CV_MLBaseTest::train( int testCaseIdx ) } else if( !modelName.compare(CV_SVM) ) { - string svm_type_str, kernel_type_str; + String svm_type_str, kernel_type_str; modelParamsNode["svm_type"] >> svm_type_str; modelParamsNode["kernel_type"] >> kernel_type_str; CvSVMParams params; @@ -625,7 +625,7 @@ int CV_MLBaseTest::train( int testCaseIdx ) } else if( !modelName.compare(CV_ANN) ) { - string train_method_str; + String train_method_str; double param1, param2; modelParamsNode["train_method"] >> train_method_str; modelParamsNode["param1"] >> param1; @@ -659,7 +659,7 @@ int CV_MLBaseTest::train( int testCaseIdx ) int BOOST_TYPE, WEAK_COUNT, MAX_DEPTH; float WEIGHT_TRIM_RATE; bool USE_SURROGATE; - string typeStr; + String typeStr; modelParamsNode["type"] >> typeStr; BOOST_TYPE = str_to_boost_type( typeStr ); modelParamsNode["weak_count"] >> WEAK_COUNT; diff --git a/modules/nonfree/src/surf.ocl.cpp b/modules/nonfree/src/surf.ocl.cpp index 420a5f6aeb..d705f17f85 100644 --- a/modules/nonfree/src/surf.ocl.cpp +++ b/modules/nonfree/src/surf.ocl.cpp @@ -58,7 +58,7 @@ namespace cv const char* noImage2dOption = "-D DISABLE_IMAGE2D"; - static void openCLExecuteKernelSURF(Context *clCxt , const char **source, std::string kernelName, size_t globalThreads[3], + static void openCLExecuteKernelSURF(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], size_t localThreads[3], std::vector< std::pair > &args, int channels, int depth) { if(support_image2d()) @@ -480,7 +480,7 @@ void SURF_OCL_Invoker::icvCalcLayerDetAndTrace_gpu(oclMat &det, oclMat &trace, i const int max_samples_j = 1 + ((img_cols - min_size) >> octave); Context *clCxt = det.clCxt; - std::string kernelName = "icvCalcLayerDetAndTrace"; + cv::String kernelName = "icvCalcLayerDetAndTrace"; std::vector< std::pair > args; if(sumTex) @@ -518,7 +518,7 @@ void SURF_OCL_Invoker::icvFindMaximaInLayer_gpu(const oclMat &det, const oclMat const int min_margin = ((calcSize(octave, 2) >> 1) >> octave) + 1; Context *clCxt = det.clCxt; - std::string kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer"; + cv::String kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer"; std::vector< std::pair > args; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data)); @@ -562,7 +562,7 @@ void SURF_OCL_Invoker::icvInterpolateKeypoint_gpu(const oclMat &det, const oclMa oclMat &keypoints, oclMat &counters_, int octave, int layer_rows, int max_features) { Context *clCxt = det.clCxt; - std::string kernelName = "icvInterpolateKeypoint"; + cv::String kernelName = "icvInterpolateKeypoint"; std::vector< std::pair > args; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data)); @@ -586,7 +586,7 @@ void SURF_OCL_Invoker::icvInterpolateKeypoint_gpu(const oclMat &det, const oclMa void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeatures) { Context *clCxt = counters.clCxt; - std::string kernelName = "icvCalcOrientation"; + cv::String kernelName = "icvCalcOrientation"; std::vector< std::pair > args; @@ -613,7 +613,7 @@ void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeat void SURF_OCL_Invoker::icvSetUpright_gpu(const oclMat &keypoints, int nFeatures) { Context *clCxt = counters.clCxt; - std::string kernelName = "icvSetUpright"; + cv::String kernelName = "icvSetUpright"; std::vector< std::pair > args; @@ -632,7 +632,7 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const { // compute unnormalized descriptors, then normalize them - odd indexing since grid must be 2D Context *clCxt = descriptors.clCxt; - std::string kernelName; + cv::String kernelName; std::vector< std::pair > args; size_t localThreads[3] = {1, 1, 1}; size_t globalThreads[3] = {1, 1, 1}; diff --git a/modules/objdetect/include/opencv2/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect.hpp index a8c2955e15..701e744e24 100644 --- a/modules/objdetect/include/opencv2/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect.hpp @@ -307,24 +307,24 @@ public: }; LatentSvmDetector(); - LatentSvmDetector( const std::vector& filenames, const std::vector& classNames=std::vector() ); + LatentSvmDetector( const std::vector& filenames, const std::vector& classNames=std::vector() ); virtual ~LatentSvmDetector(); virtual void clear(); virtual bool empty() const; - bool load( const std::vector& filenames, const std::vector& classNames=std::vector() ); + bool load( const std::vector& filenames, const std::vector& classNames=std::vector() ); virtual void detect( const Mat& image, std::vector& objectDetections, float overlapThreshold=0.5f, int numThreads=-1 ); - const std::vector& getClassNames() const; + const std::vector& getClassNames() const; size_t getClassCount() const; private: std::vector detectors; - std::vector classNames; + std::vector classNames; }; CV_EXPORTS void groupRectangles(CV_OUT CV_IN_OUT std::vector& rectList, int groupThreshold, double eps=0.2); @@ -369,11 +369,11 @@ class CV_EXPORTS_W CascadeClassifier { public: CV_WRAP CascadeClassifier(); - CV_WRAP CascadeClassifier( const std::string& filename ); + CV_WRAP CascadeClassifier( const cv::String& filename ); virtual ~CascadeClassifier(); CV_WRAP virtual bool empty() const; - CV_WRAP bool load( const std::string& filename ); + CV_WRAP bool load( const cv::String& filename ); virtual bool read( const FileNode& node ); CV_WRAP virtual void detectMultiScale( const Mat& image, CV_OUT std::vector& objects, @@ -524,7 +524,7 @@ public: gammaCorrection(_gammaCorrection), nlevels(_nlevels) {} - CV_WRAP HOGDescriptor(const std::string& filename) + CV_WRAP HOGDescriptor(const cv::String& filename) { load(filename); } @@ -543,10 +543,10 @@ public: CV_WRAP virtual void setSVMDetector(InputArray _svmdetector); virtual bool read(FileNode& fn); - virtual void write(FileStorage& fs, const std::string& objname) const; + virtual void write(FileStorage& fs, const cv::String& objname) const; - CV_WRAP virtual bool load(const std::string& filename, const std::string& objname=std::string()); - CV_WRAP virtual void save(const std::string& filename, const std::string& objname=std::string()) const; + CV_WRAP virtual bool load(const cv::String& filename, const cv::String& objname=cv::String()); + CV_WRAP virtual void save(const cv::String& filename, const cv::String& objname=cv::String()) const; virtual void copyTo(HOGDescriptor& c) const; CV_WRAP virtual void compute(const Mat& img, @@ -609,16 +609,16 @@ public: int groupThreshold = 0) const; // read/parse Dalal's alt model file - void readALTModel(std::string modelfile); + void readALTModel(cv::String modelfile); }; CV_EXPORTS_W void findDataMatrix(InputArray image, - CV_OUT std::vector& codes, + CV_OUT std::vector& codes, OutputArray corners=noArray(), OutputArrayOfArrays dmtx=noArray()); CV_EXPORTS_W void drawDataMatrixCodes(InputOutputArray image, - const std::vector& codes, + const std::vector& codes, InputArray corners); } @@ -758,7 +758,7 @@ public: return processImpl(src, mask); } - virtual std::string name() const =0; + virtual cv::String name() const =0; virtual void read(const FileNode& fn) =0; virtual void write(FileStorage& fs) const =0; @@ -770,7 +770,7 @@ public: * - "ColorGradient" * - "DepthNormal" */ - static Ptr create(const std::string& modality_type); + static Ptr create(const cv::String& modality_type); /** * \brief Load a modality from file. @@ -804,7 +804,7 @@ public: */ ColorGradient(float weak_threshold, size_t num_features, float strong_threshold); - virtual std::string name() const; + virtual cv::String name() const; virtual void read(const FileNode& fn); virtual void write(FileStorage& fs) const; @@ -842,7 +842,7 @@ public: DepthNormal(int distance_threshold, int difference_threshold, size_t num_features, int extract_threshold); - virtual std::string name() const; + virtual cv::String name() const; virtual void read(const FileNode& fn); virtual void write(FileStorage& fs) const; @@ -871,7 +871,7 @@ struct CV_EXPORTS Match { } - Match(int x, int y, float similarity, const std::string& class_id, int template_id); + Match(int x, int y, float similarity, const cv::String& class_id, int template_id); /// Sort matches with high similarity to the front bool operator<(const Match& rhs) const @@ -891,11 +891,11 @@ struct CV_EXPORTS Match int x; int y; float similarity; - std::string class_id; + cv::String class_id; int template_id; }; -inline Match::Match(int _x, int _y, float _similarity, const std::string& _class_id, int _template_id) +inline Match::Match(int _x, int _y, float _similarity, const cv::String& _class_id, int _template_id) : x(_x), y(_y), similarity(_similarity), class_id(_class_id), template_id(_template_id) { } @@ -937,7 +937,7 @@ public: * empty or the same size as its corresponding source. */ void match(const std::vector& sources, float threshold, std::vector& matches, - const std::vector& class_ids = std::vector(), + const std::vector& class_ids = std::vector(), OutputArrayOfArrays quantized_images = noArray(), const std::vector& masks = std::vector()) const; @@ -951,13 +951,13 @@ public: * * \return Template ID, or -1 if failed to extract a valid template. */ - int addTemplate(const std::vector& sources, const std::string& class_id, + int addTemplate(const std::vector& sources, const cv::String& class_id, const Mat& object_mask, Rect* bounding_box = NULL); /** * \brief Add a new object template computed by external means. */ - int addSyntheticTemplate(const std::vector