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

pull/695/head
Andrey Kamaev 12 years ago
parent 75513a46dc
commit be7bbe3aa9
  1. 2
      modules/contrib/doc/facerec/facerec_api.rst
  2. 14
      modules/contrib/doc/retina/index.rst
  3. 16
      modules/contrib/include/opencv2/contrib.hpp
  4. 6
      modules/contrib/include/opencv2/contrib/retina.hpp
  5. 50
      modules/contrib/src/facerec.cpp
  6. 34
      modules/contrib/src/inputoutput.cpp
  7. 24
      modules/contrib/src/lda.cpp
  8. 6
      modules/contrib/src/retina.cpp
  9. 2
      modules/contrib/src/spinimages.cpp
  10. 14
      modules/core/doc/command_line_parser.rst
  11. 2
      modules/core/doc/utility_and_system_functions_and_macros.rst
  12. 6
      modules/core/doc/xml_yaml_persistence.rst
  13. 164
      modules/core/include/opencv2/core.hpp
  14. 4
      modules/core/include/opencv2/core/cvstd.inl.hpp
  15. 4
      modules/core/include/opencv2/core/gpumat.hpp
  16. 72
      modules/core/include/opencv2/core/operations.hpp
  17. 22
      modules/core/include/opencv2/core/utility.hpp
  18. 194
      modules/core/src/algorithm.cpp
  19. 142
      modules/core/src/command_line_parser.cpp
  20. 4
      modules/core/src/drawing.cpp
  21. 4
      modules/core/src/gl_core_3_1.cpp
  22. 6
      modules/core/src/glob.cpp
  23. 6
      modules/core/src/gpumat.cpp
  24. 52
      modules/core/src/persistence.cpp
  25. 18
      modules/core/src/system.cpp
  26. 2
      modules/core/test/test_io.cpp
  27. 16
      modules/features2d/include/opencv2/features2d.hpp
  28. 6
      modules/features2d/src/descriptors.cpp
  29. 2
      modules/features2d/src/detectors.cpp
  30. 2
      modules/features2d/src/dynamic.cpp
  31. 2
      modules/features2d/src/features2d_init.cpp
  32. 2
      modules/features2d/src/keypoint.cpp
  33. 22
      modules/features2d/src/matchers.cpp
  34. 4
      modules/flann/doc/flann_fast_approximate_nearest_neighbor_search.rst
  35. 4
      modules/flann/include/opencv2/flann.hpp
  36. 6
      modules/flann/include/opencv2/flann/hdf5.h
  37. 28
      modules/flann/include/opencv2/flann/miniflann.hpp
  38. 36
      modules/flann/src/miniflann.cpp
  39. 24
      modules/gpu/doc/video.rst
  40. 22
      modules/gpu/include/opencv2/gpu.hpp
  41. 28
      modules/gpu/src/cascadeclassifier.cpp
  42. 8
      modules/gpu/src/cu_safe_call.cpp
  43. 2
      modules/gpu/src/cu_safe_call.h
  44. 2
      modules/gpu/src/cuvid_video_source.cpp
  45. 2
      modules/gpu/src/cuvid_video_source.h
  46. 14
      modules/gpu/src/error.cpp
  47. 2
      modules/gpu/src/ffmpeg_video_source.cpp
  48. 2
      modules/gpu/src/ffmpeg_video_source.h
  49. 14
      modules/gpu/src/nvidia/NCVHaarObjectDetection.cu
  50. 6
      modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp
  51. 4
      modules/gpu/src/nvidia/core/NCV.cu
  52. 4
      modules/gpu/src/nvidia/core/NCV.hpp
  53. 2
      modules/gpu/src/optical_flow.cpp
  54. 8
      modules/gpu/src/video_reader.cpp
  55. 32
      modules/gpu/src/video_writer.cpp
  56. 56
      modules/highgui/include/opencv2/highgui.hpp
  57. 4
      modules/highgui/src/bitstrm.cpp
  58. 4
      modules/highgui/src/bitstrm.hpp
  59. 8
      modules/highgui/src/cap.cpp
  60. 14
      modules/highgui/src/grfmt_base.cpp
  61. 18
      modules/highgui/src/grfmt_base.hpp
  62. 2
      modules/highgui/src/grfmt_jpeg2000.cpp
  63. 2
      modules/highgui/src/grfmt_pxm.cpp
  64. 2
      modules/highgui/src/grfmt_pxm.hpp
  65. 2
      modules/highgui/src/grfmt_tiff.cpp
  66. 2
      modules/highgui/src/grfmt_tiff.hpp
  67. 2
      modules/highgui/src/grfmt_webp.cpp
  68. 2
      modules/highgui/src/grfmt_webp.hpp
  69. 24
      modules/highgui/src/loadsave.cpp
  70. 56
      modules/highgui/src/window.cpp
  71. 10
      modules/java/generator/gen_java.py
  72. 24
      modules/java/generator/src/cpp/features2d_manual.hpp
  73. 44
      modules/legacy/include/opencv2/legacy.hpp
  74. 10
      modules/legacy/src/calonder.cpp
  75. 22
      modules/legacy/src/oneway.cpp
  76. 8
      modules/legacy/src/planardetect.cpp
  77. 4
      modules/ml/doc/mldata.rst
  78. 14
      modules/nonfree/src/surf.ocl.cpp
  79. 66
      modules/objdetect/include/opencv2/objdetect.hpp
  80. 8
      modules/objdetect/src/cascadedetect.cpp
  81. 6
      modules/objdetect/src/datamatrix.cpp
  82. 32
      modules/objdetect/src/hog.cpp
  83. 14
      modules/objdetect/src/latentsvmdetector.cpp
  84. 52
      modules/objdetect/src/linemod.cpp
  85. 6
      modules/ocl/include/opencv2/ocl.hpp
  86. 16
      modules/ocl/include/opencv2/ocl/private/util.hpp
  87. 96
      modules/ocl/src/arithm.cpp
  88. 6
      modules/ocl/src/binarycaching.hpp
  89. 2
      modules/ocl/src/blend.cpp
  90. 18
      modules/ocl/src/brute_force_matcher.cpp
  91. 10
      modules/ocl/src/build_warps.cpp
  92. 14
      modules/ocl/src/canny.cpp
  93. 2
      modules/ocl/src/columnsum.cpp
  94. 18
      modules/ocl/src/filtering.cpp
  95. 16
      modules/ocl/src/hog.cpp
  96. 40
      modules/ocl/src/imgproc.cpp
  97. 44
      modules/ocl/src/initialization.cpp
  98. 8
      modules/ocl/src/interpolate_frames.cpp
  99. 12
      modules/ocl/src/match_template.cpp
  100. 16
      modules/ocl/src/matrix_operations.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

@ -113,7 +113,7 @@ Since every :ocv:class:`FaceRecognizer` is a :ocv:class:`Algorithm`, you can use
// Create a FaceRecognizer: // Create a FaceRecognizer:
Ptr<FaceRecognizer> model = createEigenFaceRecognizer(); Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
// And here's how to get its name: // And here's how to get its name:
cv::String name = model->name(); String name = model->name();
FaceRecognizer::train FaceRecognizer::train

@ -16,7 +16,7 @@ Class which provides the main controls to the Gipsa/Listic labs human retina mo
**NOTE : See the Retina tutorial in the tutorial/contrib section for complementary explanations.** **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(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. :: 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(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(String fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. ::
class Retina class Retina
{ {
@ -49,12 +49,12 @@ The retina can be settled up with various parameters, by default, the retina can
Size outputSize (); Size outputSize ();
// setup methods with specific parameters specification of global xml config file loading/write // setup methods with specific parameters specification of global xml config file loading/write
void setup (cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); void setup (String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true); void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
void setup (RetinaParameters newParameters); void setup (RetinaParameters newParameters);
struct Retina::RetinaParameters getParameters (); struct Retina::RetinaParameters getParameters ();
const cv::String printSetup (); const String printSetup ();
virtual void write (cv::String fs) const; virtual void write (String fs) const;
virtual void write (FileStorage &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 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); 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 Retina::printSetup
++++++++++++++++++ ++++++++++++++++++
.. ocv:function:: const cv::String Retina::printSetup() .. ocv:function:: const String Retina::printSetup()
Outputs a string showing the used parameters setup Outputs a string showing the used parameters setup
@ -264,7 +264,7 @@ Retina::setColorSaturation
Retina::setup Retina::setup
+++++++++++++ +++++++++++++
.. ocv:function:: void Retina::setup(cv::String retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true ) .. ocv:function:: void Retina::setup(String retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true )
.. ocv:function:: void Retina::setup(FileStorage & fs, const bool applyDefaultSetupOnFailure = true ) .. ocv:function:: void Retina::setup(FileStorage & fs, const bool applyDefaultSetupOnFailure = true )
.. ocv:function:: void Retina::setup(RetinaParameters newParameters) .. ocv:function:: void Retina::setup(RetinaParameters newParameters)
@ -278,7 +278,7 @@ Retina::setup
Retina::write Retina::write
+++++++++++++ +++++++++++++
.. ocv:function:: void Retina::write( cv::String fs ) const .. ocv:function:: void Retina::write( String fs ) const
.. ocv:function:: void Retina::write( FileStorage& fs ) const .. ocv:function:: void Retina::write( FileStorage& fs ) const
Write xml/yml formated parameters information Write xml/yml formated parameters information

@ -301,7 +301,7 @@ namespace cv
void computeNormals(float normalRadius, int minNeighbors = 20); void computeNormals(float normalRadius, int minNeighbors = 20);
void computeNormals(const std::vector<int>& subset, float normalRadius, int minNeighbors = 20); void computeNormals(const std::vector<int>& subset, float normalRadius, int minNeighbors = 20);
void writeAsVrml(const cv::String& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const; void writeAsVrml(const String& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const;
std::vector<Point3f> vtx; std::vector<Point3f> vtx;
std::vector<Point3f> normals; std::vector<Point3f> normals;
@ -610,9 +610,9 @@ namespace cv
class CV_EXPORTS Directory class CV_EXPORTS Directory
{ {
public: public:
static std::vector<cv::String> GetListFiles ( const cv::String& path, const cv::String & exten = "*", bool addPath = true ); static std::vector<String> GetListFiles ( const String& path, const String & exten = "*", bool addPath = true );
static std::vector<cv::String> GetListFilesR ( const cv::String& path, const cv::String & exten = "*", bool addPath = true ); static std::vector<String> GetListFilesR ( const String& path, const String & exten = "*", bool addPath = true );
static std::vector<cv::String> GetListFolders( const cv::String& path, const cv::String & exten = "*", bool addPath = true ); static std::vector<String> GetListFolders( const String& path, const String & exten = "*", bool addPath = true );
}; };
/* /*
@ -869,10 +869,10 @@ namespace cv
} }
// Serializes this object to a given filename. // Serializes this object to a given filename.
void save(const cv::String& filename) const; void save(const String& filename) const;
// Deserializes this object from a given filename. // Deserializes this object from a given filename.
void load(const cv::String& filename); void load(const String& filename);
// Serializes this object to a given cv::FileStorage. // Serializes this object to a given cv::FileStorage.
void save(FileStorage& fs) const; 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; CV_WRAP virtual void predict(InputArray src, CV_OUT int &label, CV_OUT double &confidence) const = 0;
// Serializes this object to a given filename. // Serializes this object to a given filename.
CV_WRAP virtual void save(const cv::String& filename) const; CV_WRAP virtual void save(const String& filename) const;
// Deserializes this object from a given filename. // Deserializes this object from a given filename.
CV_WRAP virtual void load(const cv::String& filename); CV_WRAP virtual void load(const String& filename);
// Serializes this object to a given cv::FileStorage. // Serializes this object to a given cv::FileStorage.
virtual void save(FileStorage& fs) const = 0; virtual void save(FileStorage& fs) const = 0;

@ -182,7 +182,7 @@ public:
* @param retinaParameterFile : the parameters filename * @param retinaParameterFile : the parameters filename
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/ */
void setup(cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); void setup(String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
/** /**
@ -212,13 +212,13 @@ public:
* parameters setup display method * parameters setup display method
* @return a string which contains formatted parameters information * @return a string which contains formatted parameters information
*/ */
const cv::String printSetup(); const String printSetup();
/** /**
* write xml/yml formated parameters information * write xml/yml formated parameters information
* @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information * @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information
*/ */
virtual void write( cv::String fs ) const; virtual void write( String fs ) const;
/** /**

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

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

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

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

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

@ -16,7 +16,7 @@ The CommandLineParser class is designed for command line arguments parsing
:param argv: :param argv:
:param keys: :param keys:
.. ocv:function:: template<typename T> T CommandLineParser::get<T>(const cv::String& name, bool space_delete = true) .. ocv:function:: template<typename T> T CommandLineParser::get<T>(const String& name, bool space_delete = true)
:param name: :param name:
:param space_delete: :param space_delete:
@ -26,7 +26,7 @@ The CommandLineParser class is designed for command line arguments parsing
:param index: :param index:
:param space_delete: :param space_delete:
.. ocv:function:: bool CommandLineParser::has(const cv::String& name) .. ocv:function:: bool CommandLineParser::has(const String& name)
:param name: :param name:
@ -41,7 +41,7 @@ The CommandLineParser class is designed for command line arguments parsing
.. ocv:function:: void CommandLineParser::printErrors() .. ocv:function:: void CommandLineParser::printErrors()
.. ocv:function:: cv::String CommandLineParser::getPathToApplication() .. ocv:function:: String CommandLineParser::getPathToApplication()
The sample below demonstrates how to use CommandLineParser: The sample below demonstrates how to use CommandLineParser:
@ -59,12 +59,12 @@ The sample below demonstrates how to use CommandLineParser:
int N = parser.get<int>("N"); int N = parser.get<int>("N");
double fps = parser.get<double>("fps"); double fps = parser.get<double>("fps");
cv::String path = parser.get<cv::String>("path"); String path = parser.get<String>("path");
use_time_stamp = parser.has("timestamp"); use_time_stamp = parser.has("timestamp");
cv::String img1 = parser.get<cv::String>(0); String img1 = parser.get<String>(0);
cv::String img2 = parser.get<cv::String>(1); String img2 = parser.get<String>(1);
int repeat = parser.get<int>(2); int repeat = parser.get<int>(2);
@ -78,7 +78,7 @@ Syntax:
:: ::
const cv::String keys = const String keys =
"{help h usage ? | | print this message }" "{help h usage ? | | print this message }"
"{@image1 | | image1 for compare }" "{@image1 | | image1 for compare }"
"{@image2 | | image2 for compare }" "{@image2 | | image2 for compare }"

@ -284,7 +284,7 @@ getBuildInformation
------------------- -------------------
Returns full configuration time cmake output. Returns full configuration time cmake output.
.. ocv:function:: const cv::String& getBuildInformation() .. ocv:function:: const String& getBuildInformation()
Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture. Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture.

@ -113,7 +113,7 @@ Here is how to read the file created by the code sample above: ::
// first method: use (type) operator on FileNode. // first method: use (type) operator on FileNode.
int frameCount = (int)fs2["frameCount"]; int frameCount = (int)fs2["frameCount"];
cv::String date; String date;
// second method: use FileNode::operator >> // second method: use FileNode::operator >>
fs2["calibrationDate"] >> date; fs2["calibrationDate"] >> date;
@ -548,11 +548,11 @@ Returns the node content as double.
:returns: The node content as double. :returns: The node content as double.
FileNode::operator cv::String FileNode::operator String
------------------------------ ------------------------------
Returns the node content as text string. Returns the node content as text string.
.. ocv:function:: FileNode::operator cv::String() const .. ocv:function:: FileNode::operator String() const
:returns: The node content as a text string. :returns: The node content as a text string.

@ -125,7 +125,7 @@ public:
Full constructor. Normally the constuctor is not called explicitly. Full constructor. Normally the constuctor is not called explicitly.
Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used. Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.
*/ */
Exception(int _code, const cv::String& _err, const cv::String& _func, const cv::String& _file, int _line); Exception(int _code, const String& _err, const String& _func, const String& _file, int _line);
virtual ~Exception() throw(); virtual ~Exception() throw();
/*! /*!
@ -134,12 +134,12 @@ public:
virtual const char *what() const throw(); virtual const char *what() const throw();
void formatMessage(); void formatMessage();
cv::String msg; ///< the formatted error message String msg; ///< the formatted error message
int code; ///< error code @see CVStatus int code; ///< error code @see CVStatus
cv::String err; ///< error description String err; ///< error description
cv::String func; ///< function name. Available only when the compiler supports __func__ macro String func; ///< function name. Available only when the compiler supports __func__ macro
cv::String file; ///< source file name where the error has occured String file; ///< source file name where the error has occured
int line; ///< line number in the source file where the error has occured int line; ///< line number in the source file where the error has occured
}; };
@ -2514,13 +2514,13 @@ enum
}; };
//! renders text string in the image //! renders text string in the image
CV_EXPORTS_W void putText( Mat& img, const cv::String& text, Point org, CV_EXPORTS_W void putText( Mat& img, const String& text, Point org,
int fontFace, double fontScale, Scalar color, int fontFace, double fontScale, Scalar color,
int thickness=1, int lineType=8, int thickness=1, int lineType=8,
bool bottomLeftOrigin=false ); bool bottomLeftOrigin=false );
//! returns bounding box of the text string //! returns bounding box of the text string
CV_EXPORTS_W Size getTextSize(const cv::String& text, int fontFace, CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
double fontScale, int thickness, double fontScale, int thickness,
CV_OUT int* baseLine); CV_OUT int* baseLine);
@ -3765,7 +3765,7 @@ class CV_EXPORTS FileNode;
FileStorage fs("test.yml", FileStorage::READ); FileStorage fs("test.yml", FileStorage::READ);
int test_int = (int)fs["test_int"]; int test_int = (int)fs["test_int"];
double test_real = (double)fs["test_real"]; double test_real = (double)fs["test_real"];
cv::String test_string = (cv::String)fs["test_string"]; String test_string = (String)fs["test_string"];
Mat M; Mat M;
fs["test_mat"] >> M; fs["test_mat"] >> M;
@ -3776,7 +3776,7 @@ class CV_EXPORTS FileNode;
int tl1 = (int)tl[1]; int tl1 = (int)tl[1];
double tl2 = (double)tl[2]; double tl2 = (double)tl[2];
int tl3 = (int)tl[3]; int tl3 = (int)tl[3];
cv::String tl4 = (cv::String)tl[4]; String tl4 = (String)tl[4];
CV_Assert(tl[5].type() == FileNode::MAP && tl[5].size() == 3); CV_Assert(tl[5].type() == FileNode::MAP && tl[5].size() == 3);
int month = (int)tl[5]["month"]; int month = (int)tl[5]["month"];
@ -3822,27 +3822,27 @@ public:
//! the default constructor //! the default constructor
CV_WRAP FileStorage(); CV_WRAP FileStorage();
//! the full constructor that opens file storage for reading or writing //! the full constructor that opens file storage for reading or writing
CV_WRAP FileStorage(const cv::String& source, int flags, const cv::String& encoding=cv::String()); CV_WRAP FileStorage(const String& source, int flags, const String& encoding=String());
//! the constructor that takes pointer to the C FileStorage structure //! the constructor that takes pointer to the C FileStorage structure
FileStorage(CvFileStorage* fs); FileStorage(CvFileStorage* fs);
//! the destructor. calls release() //! the destructor. calls release()
virtual ~FileStorage(); virtual ~FileStorage();
//! opens file storage for reading or writing. The previous storage is closed with release() //! opens file storage for reading or writing. The previous storage is closed with release()
CV_WRAP virtual bool open(const cv::String& filename, int flags, const cv::String& encoding=cv::String()); CV_WRAP virtual bool open(const String& filename, int flags, const String& encoding=String());
//! returns true if the object is associated with currently opened file. //! returns true if the object is associated with currently opened file.
CV_WRAP virtual bool isOpened() const; CV_WRAP virtual bool isOpened() const;
//! closes the file and releases all the memory buffers //! closes the file and releases all the memory buffers
CV_WRAP virtual void release(); CV_WRAP virtual void release();
//! closes the file, releases all the memory buffers and returns the text string //! closes the file, releases all the memory buffers and returns the text string
CV_WRAP virtual cv::String releaseAndGetString(); CV_WRAP virtual String releaseAndGetString();
//! returns the first element of the top-level mapping //! returns the first element of the top-level mapping
CV_WRAP FileNode getFirstTopLevelNode() const; CV_WRAP FileNode getFirstTopLevelNode() const;
//! returns the top-level mapping. YAML supports multiple streams //! returns the top-level mapping. YAML supports multiple streams
CV_WRAP FileNode root(int streamidx=0) const; CV_WRAP FileNode root(int streamidx=0) const;
//! returns the specified element of the top-level mapping //! returns the specified element of the top-level mapping
FileNode operator[](const cv::String& nodename) const; FileNode operator[](const String& nodename) const;
//! returns the specified element of the top-level mapping //! returns the specified element of the top-level mapping
CV_WRAP FileNode operator[](const char* nodename) const; CV_WRAP FileNode operator[](const char* nodename) const;
@ -3851,15 +3851,15 @@ public:
//! returns pointer to the underlying C FileStorage structure //! returns pointer to the underlying C FileStorage structure
const CvFileStorage* operator *() const { return fs; } const CvFileStorage* operator *() const { return fs; }
//! writes one or more numbers of the specified format to the currently written structure //! writes one or more numbers of the specified format to the currently written structure
void writeRaw( const cv::String& fmt, const uchar* vec, size_t len ); void writeRaw( const String& fmt, const uchar* vec, size_t len );
//! writes the registered C structure (CvMat, CvMatND, CvSeq). See cvWrite() //! writes the registered C structure (CvMat, CvMatND, CvSeq). See cvWrite()
void writeObj( const cv::String& name, const void* obj ); void writeObj( const String& name, const void* obj );
//! returns the normalized object name for the specified file name //! returns the normalized object name for the specified file name
static cv::String getDefaultObjectName(const cv::String& filename); static String getDefaultObjectName(const String& filename);
Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure
cv::String elname; //!< the currently written element String elname; //!< the currently written element
std::vector<char> structs; //!< the stack of written structures std::vector<char> structs; //!< the stack of written structures
int state; //!< the writer state int state; //!< the writer state
}; };
@ -3904,7 +3904,7 @@ public:
//! the copy constructor //! the copy constructor
FileNode(const FileNode& node); FileNode(const FileNode& node);
//! returns element of a mapping node //! returns element of a mapping node
FileNode operator[](const cv::String& nodename) const; FileNode operator[](const String& nodename) const;
//! returns element of a mapping node //! returns element of a mapping node
CV_WRAP FileNode operator[](const char* nodename) const; CV_WRAP FileNode operator[](const char* nodename) const;
//! returns element of a sequence node //! returns element of a sequence node
@ -3929,7 +3929,7 @@ public:
//! returns true if the node has a name //! returns true if the node has a name
CV_WRAP bool isNamed() const; CV_WRAP bool isNamed() const;
//! returns the node name or an empty string if the node is nameless //! returns the node name or an empty string if the node is nameless
CV_WRAP cv::String name() const; CV_WRAP String name() const;
//! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise. //! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
CV_WRAP size_t size() const; CV_WRAP size_t size() const;
//! returns the node content as an integer. If the node stores floating-point number, it is rounded. //! returns the node content as an integer. If the node stores floating-point number, it is rounded.
@ -3955,7 +3955,7 @@ public:
FileNodeIterator end() const; FileNodeIterator end() const;
//! reads node elements to the buffer with the specified format //! reads node elements to the buffer with the specified format
void readRaw( const cv::String& fmt, uchar* vec, size_t len ) const; void readRaw( const String& fmt, uchar* vec, size_t len ) const;
//! reads the registered object and returns pointer to it //! reads the registered object and returns pointer to it
void* readObj() const; void* readObj() const;
@ -3998,7 +3998,7 @@ public:
FileNodeIterator& operator -= (int ofs); FileNodeIterator& operator -= (int ofs);
//! reads the next maxCount elements (or less, if the sequence/mapping last element occurs earlier) to the buffer with the specified format //! reads the next maxCount elements (or less, if the sequence/mapping last element occurs earlier) to the buffer with the specified format
FileNodeIterator& readRaw( const cv::String& fmt, uchar* vec, FileNodeIterator& readRaw( const String& fmt, uchar* vec,
size_t maxCount=(size_t)INT_MAX ); size_t maxCount=(size_t)INT_MAX );
const CvFileStorage* fs; const CvFileStorage* fs;
@ -4154,41 +4154,41 @@ class CV_EXPORTS_W Algorithm
public: public:
Algorithm(); Algorithm();
virtual ~Algorithm(); virtual ~Algorithm();
cv::String name() const; String name() const;
template<typename _Tp> typename ParamType<_Tp>::member_type get(const cv::String& name) const; template<typename _Tp> typename ParamType<_Tp>::member_type get(const String& name) const;
template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* name) const; template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* name) const;
CV_WRAP int getInt(const cv::String& name) const; CV_WRAP int getInt(const String& name) const;
CV_WRAP double getDouble(const cv::String& name) const; CV_WRAP double getDouble(const String& name) const;
CV_WRAP bool getBool(const cv::String& name) const; CV_WRAP bool getBool(const String& name) const;
CV_WRAP cv::String getString(const cv::String& name) const; CV_WRAP String getString(const String& name) const;
CV_WRAP Mat getMat(const cv::String& name) const; CV_WRAP Mat getMat(const String& name) const;
CV_WRAP std::vector<Mat> getMatVector(const cv::String& name) const; CV_WRAP std::vector<Mat> getMatVector(const String& name) const;
CV_WRAP Ptr<Algorithm> getAlgorithm(const cv::String& name) const; CV_WRAP Ptr<Algorithm> getAlgorithm(const String& name) const;
void set(const cv::String& name, int value); void set(const String& name, int value);
void set(const cv::String& name, double value); void set(const String& name, double value);
void set(const cv::String& name, bool value); void set(const String& name, bool value);
void set(const cv::String& name, const cv::String& value); void set(const String& name, const String& value);
void set(const cv::String& name, const Mat& value); void set(const String& name, const Mat& value);
void set(const cv::String& name, const std::vector<Mat>& value); void set(const String& name, const std::vector<Mat>& value);
void set(const cv::String& name, const Ptr<Algorithm>& value); void set(const String& name, const Ptr<Algorithm>& value);
template<typename _Tp> void set(const cv::String& name, const Ptr<_Tp>& value); template<typename _Tp> void set(const String& name, const Ptr<_Tp>& value);
CV_WRAP void setInt(const cv::String& name, int value); CV_WRAP void setInt(const String& name, int value);
CV_WRAP void setDouble(const cv::String& name, double value); CV_WRAP void setDouble(const String& name, double value);
CV_WRAP void setBool(const cv::String& name, bool value); CV_WRAP void setBool(const String& name, bool value);
CV_WRAP void setString(const cv::String& name, const cv::String& value); CV_WRAP void setString(const String& name, const String& value);
CV_WRAP void setMat(const cv::String& name, const Mat& value); CV_WRAP void setMat(const String& name, const Mat& value);
CV_WRAP void setMatVector(const cv::String& name, const std::vector<Mat>& value); CV_WRAP void setMatVector(const String& name, const std::vector<Mat>& value);
CV_WRAP void setAlgorithm(const cv::String& name, const Ptr<Algorithm>& value); CV_WRAP void setAlgorithm(const String& name, const Ptr<Algorithm>& value);
template<typename _Tp> void setAlgorithm(const cv::String& name, const Ptr<_Tp>& value); template<typename _Tp> void setAlgorithm(const String& name, const Ptr<_Tp>& value);
void set(const char* name, int value); void set(const char* name, int value);
void set(const char* name, double value); void set(const char* name, double value);
void set(const char* name, bool value); void set(const char* name, bool value);
void set(const char* name, const cv::String& value); void set(const char* name, const String& value);
void set(const char* name, const Mat& value); void set(const char* name, const Mat& value);
void set(const char* name, const std::vector<Mat>& value); void set(const char* name, const std::vector<Mat>& value);
void set(const char* name, const Ptr<Algorithm>& value); void set(const char* name, const Ptr<Algorithm>& value);
@ -4197,16 +4197,16 @@ public:
void setInt(const char* name, int value); void setInt(const char* name, int value);
void setDouble(const char* name, double value); void setDouble(const char* name, double value);
void setBool(const char* name, bool value); void setBool(const char* name, bool value);
void setString(const char* name, const cv::String& value); void setString(const char* name, const String& value);
void setMat(const char* name, const Mat& value); void setMat(const char* name, const Mat& value);
void setMatVector(const char* name, const std::vector<Mat>& value); void setMatVector(const char* name, const std::vector<Mat>& value);
void setAlgorithm(const char* name, const Ptr<Algorithm>& value); void setAlgorithm(const char* name, const Ptr<Algorithm>& value);
template<typename _Tp> void setAlgorithm(const char* name, const Ptr<_Tp>& value); template<typename _Tp> void setAlgorithm(const char* name, const Ptr<_Tp>& value);
CV_WRAP cv::String paramHelp(const cv::String& name) const; CV_WRAP String paramHelp(const String& name) const;
int paramType(const char* name) const; int paramType(const char* name) const;
CV_WRAP int paramType(const cv::String& name) const; CV_WRAP int paramType(const String& name) const;
CV_WRAP void getParams(CV_OUT std::vector<cv::String>& names) const; CV_WRAP void getParams(CV_OUT std::vector<String>& names) const;
virtual void write(FileStorage& fs) const; virtual void write(FileStorage& fs) const;
@ -4216,9 +4216,9 @@ public:
typedef int (Algorithm::*Getter)() const; typedef int (Algorithm::*Getter)() const;
typedef void (Algorithm::*Setter)(int); typedef void (Algorithm::*Setter)(int);
CV_WRAP static void getList(CV_OUT std::vector<cv::String>& algorithms); CV_WRAP static void getList(CV_OUT std::vector<String>& algorithms);
CV_WRAP static Ptr<Algorithm> _create(const cv::String& name); CV_WRAP static Ptr<Algorithm> _create(const String& name);
template<typename _Tp> static Ptr<_Tp> create(const cv::String& name); template<typename _Tp> static Ptr<_Tp> create(const String& name);
virtual AlgorithmInfo* info() const /* TODO: make it = 0;*/ { return 0; } virtual AlgorithmInfo* info() const /* TODO: make it = 0;*/ { return 0; }
}; };
@ -4228,86 +4228,86 @@ class CV_EXPORTS AlgorithmInfo
{ {
public: public:
friend class Algorithm; friend class Algorithm;
AlgorithmInfo(const cv::String& name, Algorithm::Constructor create); AlgorithmInfo(const String& name, Algorithm::Constructor create);
~AlgorithmInfo(); ~AlgorithmInfo();
void get(const Algorithm* algo, const char* name, int argType, void* value) const; void get(const Algorithm* algo, const char* name, int argType, void* value) const;
void addParam_(Algorithm& algo, const char* name, int argType, void addParam_(Algorithm& algo, const char* name, int argType,
void* value, bool readOnly, void* value, bool readOnly,
Algorithm::Getter getter, Algorithm::Setter setter, Algorithm::Getter getter, Algorithm::Setter setter,
const cv::String& help=cv::String()); const String& help=String());
cv::String paramHelp(const char* name) const; String paramHelp(const char* name) const;
int paramType(const char* name) const; int paramType(const char* name) const;
void getParams(std::vector<cv::String>& names) const; void getParams(std::vector<String>& names) const;
void write(const Algorithm* algo, FileStorage& fs) const; void write(const Algorithm* algo, FileStorage& fs) const;
void read(Algorithm* algo, const FileNode& fn) const; void read(Algorithm* algo, const FileNode& fn) const;
cv::String name() const; String name() const;
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
int& value, bool readOnly=false, int& value, bool readOnly=false,
int (Algorithm::*getter)()=0, int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(int)=0, void (Algorithm::*setter)(int)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
bool& value, bool readOnly=false, bool& value, bool readOnly=false,
int (Algorithm::*getter)()=0, int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(int)=0, void (Algorithm::*setter)(int)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
double& value, bool readOnly=false, double& value, bool readOnly=false,
double (Algorithm::*getter)()=0, double (Algorithm::*getter)()=0,
void (Algorithm::*setter)(double)=0, void (Algorithm::*setter)(double)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
cv::String& value, bool readOnly=false, String& value, bool readOnly=false,
cv::String (Algorithm::*getter)()=0, String (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const cv::String&)=0, void (Algorithm::*setter)(const String&)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
Mat& value, bool readOnly=false, Mat& value, bool readOnly=false,
Mat (Algorithm::*getter)()=0, Mat (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Mat&)=0, void (Algorithm::*setter)(const Mat&)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
std::vector<Mat>& value, bool readOnly=false, std::vector<Mat>& value, bool readOnly=false,
std::vector<Mat> (Algorithm::*getter)()=0, std::vector<Mat> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const std::vector<Mat>&)=0, void (Algorithm::*setter)(const std::vector<Mat>&)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
Ptr<Algorithm>& value, bool readOnly=false, Ptr<Algorithm>& value, bool readOnly=false,
Ptr<Algorithm> (Algorithm::*getter)()=0, Ptr<Algorithm> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<Algorithm>&)=0, void (Algorithm::*setter)(const Ptr<Algorithm>&)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
float& value, bool readOnly=false, float& value, bool readOnly=false,
float (Algorithm::*getter)()=0, float (Algorithm::*getter)()=0,
void (Algorithm::*setter)(float)=0, void (Algorithm::*setter)(float)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
unsigned int& value, bool readOnly=false, unsigned int& value, bool readOnly=false,
unsigned int (Algorithm::*getter)()=0, unsigned int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(unsigned int)=0, void (Algorithm::*setter)(unsigned int)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
uint64& value, bool readOnly=false, uint64& value, bool readOnly=false,
uint64 (Algorithm::*getter)()=0, uint64 (Algorithm::*getter)()=0,
void (Algorithm::*setter)(uint64)=0, void (Algorithm::*setter)(uint64)=0,
const cv::String& help=cv::String()); const String& help=String());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
uchar& value, bool readOnly=false, uchar& value, bool readOnly=false,
uchar (Algorithm::*getter)()=0, uchar (Algorithm::*getter)()=0,
void (Algorithm::*setter)(uchar)=0, void (Algorithm::*setter)(uchar)=0,
const cv::String& help=cv::String()); const String& help=String());
template<typename _Tp, typename _Base> void addParam(Algorithm& algo, const char* name, template<typename _Tp, typename _Base> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false, Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0, Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0, void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const cv::String& help=cv::String()); const String& help=String());
template<typename _Tp> void addParam(Algorithm& algo, const char* name, template<typename _Tp> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false, Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0, Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0, void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const cv::String& help=cv::String()); const String& help=String());
protected: protected:
AlgorithmInfoData* data; AlgorithmInfoData* data;
void set(Algorithm* algo, const char* name, int argType, void set(Algorithm* algo, const char* name, int argType,
@ -4323,13 +4323,13 @@ struct CV_EXPORTS Param
Param(int _type, bool _readonly, int _offset, Param(int _type, bool _readonly, int _offset,
Algorithm::Getter _getter=0, Algorithm::Getter _getter=0,
Algorithm::Setter _setter=0, Algorithm::Setter _setter=0,
const cv::String& _help=cv::String()); const String& _help=String());
int type; int type;
int offset; int offset;
bool readonly; bool readonly;
Algorithm::Getter getter; Algorithm::Getter getter;
Algorithm::Setter setter; Algorithm::Setter setter;
cv::String help; String help;
}; };
template<> struct ParamType<bool> template<> struct ParamType<bool>
@ -4356,10 +4356,10 @@ template<> struct ParamType<double>
enum { type = Param::REAL }; enum { type = Param::REAL };
}; };
template<> struct ParamType<cv::String> template<> struct ParamType<String>
{ {
typedef const cv::String& const_param_type; typedef const String& const_param_type;
typedef cv::String member_type; typedef String member_type;
enum { type = Param::STRING }; enum { type = Param::STRING };
}; };

@ -113,14 +113,14 @@ inline std::ostream& operator << (std::ostream& os, const String& str)
inline FileNode::operator std::string() const inline FileNode::operator std::string() const
{ {
cv::String value; String value;
read(*this, value, value); read(*this, value, value);
return value; return value;
} }
template<> inline void operator >> (const FileNode& n, std::string& value) template<> inline void operator >> (const FileNode& n, std::string& value)
{ {
cv::String val; String val;
read(n, val, val); read(n, val, val);
value = val; value = val;
} }

@ -247,7 +247,7 @@ namespace cv { namespace gpu
// Creates DeviceInfo object for the given GPU // Creates DeviceInfo object for the given GPU
DeviceInfo(int device_id) : device_id_(device_id) { query(); } DeviceInfo(int device_id) : device_id_(device_id) { query(); }
cv::String name() const { return name_; } String name() const { return name_; }
// Return compute capability versions // Return compute capability versions
int majorVersion() const { return majorVersion_; } int majorVersion() const { return majorVersion_; }
@ -274,7 +274,7 @@ namespace cv { namespace gpu
int device_id_; int device_id_;
cv::String name_; String name_;
int multi_processor_count_; int multi_processor_count_;
int majorVersion_; int majorVersion_;
int minorVersion_; int minorVersion_;

@ -2611,18 +2611,18 @@ template<> CV_EXPORTS void Ptr<CvFileStorage>::delete_obj();
//////////////////////////////////////// XML & YAML I/O //////////////////////////////////// //////////////////////////////////////// XML & YAML I/O ////////////////////////////////////
CV_EXPORTS_W void write( FileStorage& fs, const cv::String& name, int value ); CV_EXPORTS_W void write( FileStorage& fs, const String& name, int value );
CV_EXPORTS_W void write( FileStorage& fs, const cv::String& name, float value ); CV_EXPORTS_W void write( FileStorage& fs, const String& name, float value );
CV_EXPORTS_W void write( FileStorage& fs, const cv::String& name, double value ); CV_EXPORTS_W void write( FileStorage& fs, const String& name, double value );
CV_EXPORTS_W void write( FileStorage& fs, const cv::String& name, const cv::String& value ); CV_EXPORTS_W void write( FileStorage& fs, const String& name, const String& value );
template<typename _Tp> inline void write(FileStorage& fs, const _Tp& value) template<typename _Tp> inline void write(FileStorage& fs, const _Tp& value)
{ write(fs, cv::String(), value); } { write(fs, String(), value); }
CV_EXPORTS void writeScalar( FileStorage& fs, int value ); CV_EXPORTS void writeScalar( FileStorage& fs, int value );
CV_EXPORTS void writeScalar( FileStorage& fs, float value ); CV_EXPORTS void writeScalar( FileStorage& fs, float value );
CV_EXPORTS void writeScalar( FileStorage& fs, double value ); CV_EXPORTS void writeScalar( FileStorage& fs, double value );
CV_EXPORTS void writeScalar( FileStorage& fs, const cv::String& value ); CV_EXPORTS void writeScalar( FileStorage& fs, const String& value );
template<> inline void write( FileStorage& fs, const int& value ) template<> inline void write( FileStorage& fs, const int& value )
{ {
@ -2639,7 +2639,7 @@ template<> inline void write( FileStorage& fs, const double& value )
writeScalar(fs, value); writeScalar(fs, value);
} }
template<> inline void write( FileStorage& fs, const cv::String& value ) template<> inline void write( FileStorage& fs, const String& value )
{ {
writeScalar(fs, value); writeScalar(fs, value);
} }
@ -2700,20 +2700,20 @@ inline void write(FileStorage& fs, const Range& r )
class CV_EXPORTS WriteStructContext class CV_EXPORTS WriteStructContext
{ {
public: public:
WriteStructContext(FileStorage& _fs, const cv::String& name, WriteStructContext(FileStorage& _fs, const String& name,
int flags, const cv::String& typeName=cv::String()); int flags, const String& typeName=String());
~WriteStructContext(); ~WriteStructContext();
FileStorage* fs; FileStorage* fs;
}; };
template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name, const Point_<_Tp>& pt ) template<typename _Tp> inline void write(FileStorage& fs, const String& name, const Point_<_Tp>& pt )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, pt.x); write(fs, pt.x);
write(fs, pt.y); write(fs, pt.y);
} }
template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name, const Point3_<_Tp>& pt ) template<typename _Tp> inline void write(FileStorage& fs, const String& name, const Point3_<_Tp>& pt )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, pt.x); write(fs, pt.x);
@ -2721,21 +2721,21 @@ template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name
write(fs, pt.z); write(fs, pt.z);
} }
template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name, const Size_<_Tp>& sz ) template<typename _Tp> inline void write(FileStorage& fs, const String& name, const Size_<_Tp>& sz )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, sz.width); write(fs, sz.width);
write(fs, sz.height); write(fs, sz.height);
} }
template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name, const Complex<_Tp>& c ) template<typename _Tp> inline void write(FileStorage& fs, const String& name, const Complex<_Tp>& c )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, c.re); write(fs, c.re);
write(fs, c.im); write(fs, c.im);
} }
template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name, const Rect_<_Tp>& r ) template<typename _Tp> inline void write(FileStorage& fs, const String& name, const Rect_<_Tp>& r )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, r.x); write(fs, r.x);
@ -2744,14 +2744,14 @@ template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name
write(fs, r.height); write(fs, r.height);
} }
template<typename _Tp, int cn> inline void write(FileStorage& fs, const cv::String& name, const Vec<_Tp, cn>& v ) template<typename _Tp, int cn> inline void write(FileStorage& fs, const String& name, const Vec<_Tp, cn>& v )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
for(int i = 0; i < cn; i++) for(int i = 0; i < cn; i++)
write(fs, v.val[i]); write(fs, v.val[i]);
} }
template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name, const Scalar_<_Tp>& s ) template<typename _Tp> inline void write(FileStorage& fs, const String& name, const Scalar_<_Tp>& s )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, s.val[0]); write(fs, s.val[0]);
@ -2760,7 +2760,7 @@ template<typename _Tp> inline void write(FileStorage& fs, const cv::String& name
write(fs, s.val[3]); write(fs, s.val[3]);
} }
inline void write(FileStorage& fs, const cv::String& name, const Range& r ) inline void write(FileStorage& fs, const String& name, const Range& r )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW); WriteStructContext ws(fs, name, CV_NODE_SEQ+CV_NODE_FLOW);
write(fs, r.start); write(fs, r.start);
@ -2788,7 +2788,7 @@ public:
{ {
int _fmt = DataType<_Tp>::fmt; int _fmt = DataType<_Tp>::fmt;
char fmt[] = { (char)((_fmt>>8)+'1'), (char)_fmt, '\0' }; char fmt[] = { (char)((_fmt>>8)+'1'), (char)_fmt, '\0' };
fs->writeRaw( cv::String(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, vec.size()*sizeof(_Tp) ); fs->writeRaw( String(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, vec.size()*sizeof(_Tp) );
} }
FileStorage* fs; FileStorage* fs;
}; };
@ -2799,15 +2799,15 @@ template<typename _Tp> static inline void write( FileStorage& fs, const std::vec
w(vec); w(vec);
} }
template<typename _Tp> static inline void write( FileStorage& fs, const cv::String& name, template<typename _Tp> static inline void write( FileStorage& fs, const String& name,
const std::vector<_Tp>& vec ) const std::vector<_Tp>& vec )
{ {
WriteStructContext ws(fs, name, CV_NODE_SEQ+(DataType<_Tp>::fmt != 0 ? CV_NODE_FLOW : 0)); WriteStructContext ws(fs, name, CV_NODE_SEQ+(DataType<_Tp>::fmt != 0 ? CV_NODE_FLOW : 0));
write(fs, vec); write(fs, vec);
} }
CV_EXPORTS_W void write( FileStorage& fs, const cv::String& name, const Mat& value ); CV_EXPORTS_W void write( FileStorage& fs, const String& name, const Mat& value );
CV_EXPORTS void write( FileStorage& fs, const cv::String& name, const SparseMat& value ); CV_EXPORTS void write( FileStorage& fs, const String& name, const SparseMat& value );
template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs, const _Tp& value) template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs, const _Tp& value)
{ {
@ -2821,10 +2821,10 @@ template<typename _Tp> static inline FileStorage& operator << (FileStorage& fs,
return fs; return fs;
} }
CV_EXPORTS FileStorage& operator << (FileStorage& fs, const cv::String& str); CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str);
static inline FileStorage& operator << (FileStorage& fs, const char* str) static inline FileStorage& operator << (FileStorage& fs, const char* str)
{ return (fs << cv::String(str)); } { return (fs << String(str)); }
inline FileNode::FileNode() : fs(0), node(0) {} inline FileNode::FileNode() : fs(0), node(0) {}
inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node)
@ -2902,9 +2902,9 @@ static inline void read(const FileNode& node, double& value, double default_valu
CV_NODE_IS_REAL(node.node->tag) ? node.node->data.f : 1e300; CV_NODE_IS_REAL(node.node->tag) ? node.node->data.f : 1e300;
} }
static inline void read(const FileNode& node, cv::String& value, const cv::String& default_value) static inline void read(const FileNode& node, String& value, const String& default_value)
{ {
value = !node.node ? default_value : CV_NODE_IS_STRING(node.node->tag) ? cv::String(node.node->data.str.ptr) : cv::String(); value = !node.node ? default_value : CV_NODE_IS_STRING(node.node->tag) ? String(node.node->data.str.ptr) : String();
} }
CV_EXPORTS_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() ); CV_EXPORTS_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
@ -2928,9 +2928,9 @@ inline FileNode::operator double() const
read(*this, value, 0.); read(*this, value, 0.);
return value; return value;
} }
inline FileNode::operator cv::String() const inline FileNode::operator String() const
{ {
cv::String value; String value;
read(*this, value, value); read(*this, value, value);
return value; return value;
} }
@ -2940,7 +2940,7 @@ inline String::String(const FileNode& fn): cstr_(0), len_(0)
read(fn, *this, *this); read(fn, *this, *this);
} }
inline void FileNode::readRaw( const cv::String& fmt, uchar* vec, size_t len ) const inline void FileNode::readRaw( const String& fmt, uchar* vec, size_t len ) const
{ {
begin().readRaw( fmt, vec, len ); begin().readRaw( fmt, vec, len );
} }
@ -2971,7 +2971,7 @@ public:
size_t remaining1 = remaining/cn; size_t remaining1 = remaining/cn;
count = count < remaining1 ? count : remaining1; count = count < remaining1 ? count : remaining1;
vec.resize(count); vec.resize(count);
it->readRaw( cv::String(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp) ); it->readRaw( String(fmt), !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp) );
} }
FileNodeIterator* it; FileNodeIterator* it;
}; };
@ -3662,7 +3662,7 @@ public:
{ {
FileStorage fs(_fs); FileStorage fs(_fs);
fs.fs.addref(); fs.fs.addref();
((const _ClsName*)ptr)->write(fs, cv::String(name)); ((const _ClsName*)ptr)->write(fs, String(name));
} }
} }
@ -3824,7 +3824,7 @@ template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const
} }
template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const cv::String& name) template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const String& name)
{ {
return _create(name).ptr<_Tp>(); return _create(name).ptr<_Tp>();
} }
@ -3840,7 +3840,7 @@ inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
} }
template<typename _Tp> template<typename _Tp>
inline void Algorithm::set(const cv::String& _name, const Ptr<_Tp>& value) inline void Algorithm::set(const String& _name, const Ptr<_Tp>& value)
{ {
this->set<_Tp>(_name.c_str(), value); this->set<_Tp>(_name.c_str(), value);
} }
@ -3856,12 +3856,12 @@ inline void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
} }
template<typename _Tp> template<typename _Tp>
inline void Algorithm::setAlgorithm(const cv::String& _name, const Ptr<_Tp>& value) inline void Algorithm::setAlgorithm(const String& _name, const Ptr<_Tp>& value)
{ {
this->set<_Tp>(_name.c_str(), value); this->set<_Tp>(_name.c_str(), value);
} }
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const cv::String& _name) const template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const String& _name) const
{ {
typename ParamType<_Tp>::member_type value; typename ParamType<_Tp>::member_type value;
info()->get(this, _name.c_str(), ParamType<_Tp>::type, &value); info()->get(this, _name.c_str(), ParamType<_Tp>::type, &value);
@ -3877,7 +3877,7 @@ template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::ge
template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&), Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const cv::String& help) const String& help)
{ {
//TODO: static assert: _Tp inherits from _Base //TODO: static assert: _Tp inherits from _Base
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly, addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
@ -3886,7 +3886,7 @@ template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algor
template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&), Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const cv::String& help) const String& help)
{ {
//TODO: static assert: _Tp inherits from Algorithm //TODO: static assert: _Tp inherits from Algorithm
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly, addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,

@ -143,14 +143,14 @@ typedef int (CV_CDECL *ErrorCallback)( int status, const char* func_name,
*/ */
CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0); CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0);
CV_EXPORTS cv::String format( const char* fmt, ... ); CV_EXPORTS String format( const char* fmt, ... );
CV_EXPORTS cv::String tempfile( const char* suffix CV_DEFAULT(0)); CV_EXPORTS String tempfile( const char* suffix CV_DEFAULT(0));
CV_EXPORTS void glob(cv::String pattern, std::vector<cv::String>& result, bool recursive = false); CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
CV_EXPORTS void setNumThreads(int nthreads); CV_EXPORTS void setNumThreads(int nthreads);
CV_EXPORTS int getNumThreads(); CV_EXPORTS int getNumThreads();
CV_EXPORTS int getThreadNum(); CV_EXPORTS int getThreadNum();
CV_EXPORTS_W const cv::String& getBuildInformation(); CV_EXPORTS_W const String& getBuildInformation();
//! Returns the number of ticks. //! Returns the number of ticks.
@ -297,14 +297,14 @@ protected:
class CV_EXPORTS CommandLineParser class CV_EXPORTS CommandLineParser
{ {
public: public:
CommandLineParser(int argc, const char* const argv[], const cv::String& keys); CommandLineParser(int argc, const char* const argv[], const String& keys);
CommandLineParser(const CommandLineParser& parser); CommandLineParser(const CommandLineParser& parser);
CommandLineParser& operator = (const CommandLineParser& parser); CommandLineParser& operator = (const CommandLineParser& parser);
cv::String getPathToApplication() const; String getPathToApplication() const;
template <typename T> template <typename T>
T get(const cv::String& name, bool space_delete = true) const T get(const String& name, bool space_delete = true) const
{ {
T val = T(); T val = T();
getByName(name, space_delete, ParamType<T>::type, (void*)&val); getByName(name, space_delete, ParamType<T>::type, (void*)&val);
@ -319,17 +319,17 @@ class CV_EXPORTS CommandLineParser
return val; return val;
} }
bool has(const cv::String& name) const; bool has(const String& name) const;
bool check() const; bool check() const;
void about(const cv::String& message); void about(const String& message);
void printMessage() const; void printMessage() const;
void printErrors() const; void printErrors() const;
protected: protected:
void getByName(const cv::String& name, bool space_delete, int type, void* dst) const; void getByName(const String& name, bool space_delete, int type, void* dst) const;
void getByIndex(int index, bool space_delete, int type, void* dst) const; void getByIndex(int index, bool space_delete, int type, void* dst) const;
struct Impl; struct Impl;
@ -459,7 +459,7 @@ template<> inline std::string CommandLineParser::get<std::string>(int index, boo
{ {
return get<String>(index, space_delete); return get<String>(index, space_delete);
} }
template<> inline std::string CommandLineParser::get<std::string>(const cv::String& name, bool space_delete) const template<> inline std::string CommandLineParser::get<std::string>(const String& name, bool space_delete) const
{ {
return get<String>(name, space_delete); return get<String>(name, space_delete);
} }

@ -96,7 +96,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
}; };
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<cv::String, _ValueTp>& vec, template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<String, _ValueTp>& vec,
const char* key) const char* key)
{ {
if( !key ) if( !key )
@ -130,7 +130,7 @@ Param::Param()
Param::Param(int _type, bool _readonly, int _offset, Param::Param(int _type, bool _readonly, int _offset,
Algorithm::Getter _getter, Algorithm::Setter _setter, Algorithm::Getter _getter, Algorithm::Setter _setter,
const cv::String& _help) const String& _help)
{ {
type = _type; type = _type;
readonly = _readonly; readonly = _readonly;
@ -142,23 +142,23 @@ Param::Param(int _type, bool _readonly, int _offset,
struct CV_EXPORTS AlgorithmInfoData struct CV_EXPORTS AlgorithmInfoData
{ {
sorted_vector<cv::String, Param> params; sorted_vector<String, Param> params;
cv::String _name; String _name;
}; };
static sorted_vector<cv::String, Algorithm::Constructor>& alglist() static sorted_vector<String, Algorithm::Constructor>& alglist()
{ {
static sorted_vector<cv::String, Algorithm::Constructor> alglist_var; static sorted_vector<String, Algorithm::Constructor> alglist_var;
return alglist_var; return alglist_var;
} }
void Algorithm::getList(std::vector<cv::String>& algorithms) void Algorithm::getList(std::vector<String>& algorithms)
{ {
alglist().get_keys(algorithms); alglist().get_keys(algorithms);
} }
Ptr<Algorithm> Algorithm::_create(const cv::String& name) Ptr<Algorithm> Algorithm::_create(const String& name)
{ {
Algorithm::Constructor c = 0; Algorithm::Constructor c = 0;
if( !alglist().find(name, c) ) if( !alglist().find(name, c) )
@ -174,42 +174,42 @@ Algorithm::~Algorithm()
{ {
} }
cv::String Algorithm::name() const String Algorithm::name() const
{ {
return info()->name(); return info()->name();
} }
void Algorithm::set(const cv::String& parameter, int value) void Algorithm::set(const String& parameter, int value)
{ {
info()->set(this, parameter.c_str(), ParamType<int>::type, &value); info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
} }
void Algorithm::set(const cv::String& parameter, double value) void Algorithm::set(const String& parameter, double value)
{ {
info()->set(this, parameter.c_str(), ParamType<double>::type, &value); info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
} }
void Algorithm::set(const cv::String& parameter, bool value) void Algorithm::set(const String& parameter, bool value)
{ {
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value); info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
} }
void Algorithm::set(const cv::String& parameter, const cv::String& value) void Algorithm::set(const String& parameter, const String& value)
{ {
info()->set(this, parameter.c_str(), ParamType<cv::String>::type, &value); info()->set(this, parameter.c_str(), ParamType<String>::type, &value);
} }
void Algorithm::set(const cv::String& parameter, const Mat& value) void Algorithm::set(const String& parameter, const Mat& value)
{ {
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value); info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
} }
void Algorithm::set(const cv::String& parameter, const std::vector<Mat>& value) void Algorithm::set(const String& parameter, const std::vector<Mat>& value)
{ {
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value); info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
} }
void Algorithm::set(const cv::String& parameter, const Ptr<Algorithm>& value) void Algorithm::set(const String& parameter, const Ptr<Algorithm>& value)
{ {
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value); info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
} }
@ -229,9 +229,9 @@ void Algorithm::set(const char* parameter, bool value)
info()->set(this, parameter, ParamType<bool>::type, &value); info()->set(this, parameter, ParamType<bool>::type, &value);
} }
void Algorithm::set(const char* parameter, const cv::String& value) void Algorithm::set(const char* parameter, const String& value)
{ {
info()->set(this, parameter, ParamType<cv::String>::type, &value); info()->set(this, parameter, ParamType<String>::type, &value);
} }
void Algorithm::set(const char* parameter, const Mat& value) void Algorithm::set(const char* parameter, const Mat& value)
@ -250,37 +250,37 @@ void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
} }
void Algorithm::setInt(const cv::String& parameter, int value) void Algorithm::setInt(const String& parameter, int value)
{ {
info()->set(this, parameter.c_str(), ParamType<int>::type, &value); info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
} }
void Algorithm::setDouble(const cv::String& parameter, double value) void Algorithm::setDouble(const String& parameter, double value)
{ {
info()->set(this, parameter.c_str(), ParamType<double>::type, &value); info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
} }
void Algorithm::setBool(const cv::String& parameter, bool value) void Algorithm::setBool(const String& parameter, bool value)
{ {
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value); info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
} }
void Algorithm::setString(const cv::String& parameter, const cv::String& value) void Algorithm::setString(const String& parameter, const String& value)
{ {
info()->set(this, parameter.c_str(), ParamType<cv::String>::type, &value); info()->set(this, parameter.c_str(), ParamType<String>::type, &value);
} }
void Algorithm::setMat(const cv::String& parameter, const Mat& value) void Algorithm::setMat(const String& parameter, const Mat& value)
{ {
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value); info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
} }
void Algorithm::setMatVector(const cv::String& parameter, const std::vector<Mat>& value) void Algorithm::setMatVector(const String& parameter, const std::vector<Mat>& value)
{ {
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value); info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
} }
void Algorithm::setAlgorithm(const cv::String& parameter, const Ptr<Algorithm>& value) void Algorithm::setAlgorithm(const String& parameter, const Ptr<Algorithm>& value)
{ {
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value); info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
} }
@ -300,9 +300,9 @@ void Algorithm::setBool(const char* parameter, bool value)
info()->set(this, parameter, ParamType<bool>::type, &value); info()->set(this, parameter, ParamType<bool>::type, &value);
} }
void Algorithm::setString(const char* parameter, const cv::String& value) void Algorithm::setString(const char* parameter, const String& value)
{ {
info()->set(this, parameter, ParamType<cv::String>::type, &value); info()->set(this, parameter, ParamType<String>::type, &value);
} }
void Algorithm::setMat(const char* parameter, const Mat& value) void Algorithm::setMat(const char* parameter, const Mat& value)
@ -322,47 +322,47 @@ void Algorithm::setAlgorithm(const char* parameter, const Ptr<Algorithm>& value)
int Algorithm::getInt(const cv::String& parameter) const int Algorithm::getInt(const String& parameter) const
{ {
return get<int>(parameter); return get<int>(parameter);
} }
double Algorithm::getDouble(const cv::String& parameter) const double Algorithm::getDouble(const String& parameter) const
{ {
return get<double>(parameter); return get<double>(parameter);
} }
bool Algorithm::getBool(const cv::String& parameter) const bool Algorithm::getBool(const String& parameter) const
{ {
return get<bool>(parameter); return get<bool>(parameter);
} }
cv::String Algorithm::getString(const cv::String& parameter) const String Algorithm::getString(const String& parameter) const
{ {
return get<cv::String>(parameter); return get<String>(parameter);
} }
Mat Algorithm::getMat(const cv::String& parameter) const Mat Algorithm::getMat(const String& parameter) const
{ {
return get<Mat>(parameter); return get<Mat>(parameter);
} }
std::vector<Mat> Algorithm::getMatVector(const cv::String& parameter) const std::vector<Mat> Algorithm::getMatVector(const String& parameter) const
{ {
return get<std::vector<Mat> >(parameter); return get<std::vector<Mat> >(parameter);
} }
Ptr<Algorithm> Algorithm::getAlgorithm(const cv::String& parameter) const Ptr<Algorithm> Algorithm::getAlgorithm(const String& parameter) const
{ {
return get<Algorithm>(parameter); return get<Algorithm>(parameter);
} }
cv::String Algorithm::paramHelp(const cv::String& parameter) const String Algorithm::paramHelp(const String& parameter) const
{ {
return info()->paramHelp(parameter.c_str()); return info()->paramHelp(parameter.c_str());
} }
int Algorithm::paramType(const cv::String& parameter) const int Algorithm::paramType(const String& parameter) const
{ {
return info()->paramType(parameter.c_str()); return info()->paramType(parameter.c_str());
} }
@ -372,7 +372,7 @@ int Algorithm::paramType(const char* parameter) const
return info()->paramType(parameter); return info()->paramType(parameter);
} }
void Algorithm::getParams(std::vector<cv::String>& names) const void Algorithm::getParams(std::vector<String>& names) const
{ {
info()->getParams(names); info()->getParams(names);
} }
@ -388,7 +388,7 @@ void Algorithm::read(const FileNode& fn)
} }
AlgorithmInfo::AlgorithmInfo(const cv::String& _name, Algorithm::Constructor create) AlgorithmInfo::AlgorithmInfo(const String& _name, Algorithm::Constructor create)
{ {
data = new AlgorithmInfoData; data = new AlgorithmInfoData;
data->_name = _name; data->_name = _name;
@ -408,7 +408,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
for( i = 0; i < nparams; i++ ) for( i = 0; i < nparams; i++ )
{ {
const Param& p = data->params.vec[i].second; const Param& p = data->params.vec[i].second;
const cv::String& pname = data->params.vec[i].first; const String& pname = data->params.vec[i].first;
if( p.type == Param::INT ) if( p.type == Param::INT )
cv::write(fs, pname, algo->get<int>(pname)); cv::write(fs, pname, algo->get<int>(pname));
else if( p.type == Param::BOOLEAN ) else if( p.type == Param::BOOLEAN )
@ -416,7 +416,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
else if( p.type == Param::REAL ) else if( p.type == Param::REAL )
cv::write(fs, pname, algo->get<double>(pname)); cv::write(fs, pname, algo->get<double>(pname));
else if( p.type == Param::STRING ) else if( p.type == Param::STRING )
cv::write(fs, pname, algo->get<cv::String>(pname)); cv::write(fs, pname, algo->get<String>(pname));
else if( p.type == Param::MAT ) else if( p.type == Param::MAT )
cv::write(fs, pname, algo->get<Mat>(pname)); cv::write(fs, pname, algo->get<Mat>(pname));
else if( p.type == Param::MAT_VECTOR ) else if( p.type == Param::MAT_VECTOR )
@ -437,7 +437,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
cv::write(fs, pname, algo->getInt(pname)); cv::write(fs, pname, algo->getInt(pname));
else else
{ {
cv::String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type); String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
CV_Error( CV_StsUnsupportedFormat, msg.c_str()); CV_Error( CV_StsUnsupportedFormat, msg.c_str());
} }
} }
@ -451,7 +451,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
for( i = 0; i < nparams; i++ ) for( i = 0; i < nparams; i++ )
{ {
const Param& p = data->params.vec[i].second; const Param& p = data->params.vec[i].second;
const cv::String& pname = data->params.vec[i].first; const String& pname = data->params.vec[i].first;
const FileNode n = fn[pname]; const FileNode n = fn[pname];
if( n.empty() ) if( n.empty() )
continue; continue;
@ -472,7 +472,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
} }
else if( p.type == Param::STRING ) else if( p.type == Param::STRING )
{ {
cv::String val = (cv::String)n; String val = (String)n;
info->set(algo, pname.c_str(), p.type, &val, true); info->set(algo, pname.c_str(), p.type, &val, true);
} }
else if( p.type == Param::MAT ) else if( p.type == Param::MAT )
@ -489,7 +489,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
} }
else if( p.type == Param::ALGORITHM ) else if( p.type == Param::ALGORITHM )
{ {
Ptr<Algorithm> nestedAlgo = Algorithm::_create((cv::String)n["name"]); Ptr<Algorithm> nestedAlgo = Algorithm::_create((String)n["name"]);
CV_Assert( !nestedAlgo.empty() ); CV_Assert( !nestedAlgo.empty() );
nestedAlgo->read(n); nestedAlgo->read(n);
info->set(algo, pname.c_str(), p.type, &nestedAlgo, true); info->set(algo, pname.c_str(), p.type, &nestedAlgo, true);
@ -516,13 +516,13 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
} }
else else
{ {
cv::String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type); String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
CV_Error( CV_StsUnsupportedFormat, msg.c_str()); CV_Error( CV_StsUnsupportedFormat, msg.c_str());
} }
} }
} }
cv::String AlgorithmInfo::name() const String AlgorithmInfo::name() const
{ {
return data->_name; return data->_name;
} }
@ -532,7 +532,7 @@ union GetSetParam
int (Algorithm::*get_int)() const; int (Algorithm::*get_int)() const;
bool (Algorithm::*get_bool)() const; bool (Algorithm::*get_bool)() const;
double (Algorithm::*get_double)() const; double (Algorithm::*get_double)() const;
cv::String (Algorithm::*get_string)() const; String (Algorithm::*get_string)() const;
Mat (Algorithm::*get_mat)() const; Mat (Algorithm::*get_mat)() const;
std::vector<Mat> (Algorithm::*get_mat_vector)() const; std::vector<Mat> (Algorithm::*get_mat_vector)() const;
Ptr<Algorithm> (Algorithm::*get_algo)() const; Ptr<Algorithm> (Algorithm::*get_algo)() const;
@ -544,7 +544,7 @@ union GetSetParam
void (Algorithm::*set_int)(int); void (Algorithm::*set_int)(int);
void (Algorithm::*set_bool)(bool); void (Algorithm::*set_bool)(bool);
void (Algorithm::*set_double)(double); void (Algorithm::*set_double)(double);
void (Algorithm::*set_string)(const cv::String&); void (Algorithm::*set_string)(const String&);
void (Algorithm::*set_mat)(const Mat&); void (Algorithm::*set_mat)(const Mat&);
void (Algorithm::*set_mat_vector)(const std::vector<Mat>&); void (Algorithm::*set_mat_vector)(const std::vector<Mat>&);
void (Algorithm::*set_algo)(const Ptr<Algorithm>&); void (Algorithm::*set_algo)(const Ptr<Algorithm>&);
@ -554,9 +554,9 @@ union GetSetParam
void (Algorithm::*set_uchar)(uchar); void (Algorithm::*set_uchar)(uchar);
}; };
static cv::String getNameOfType(int argType); static String getNameOfType(int argType);
static cv::String getNameOfType(int argType) static String getNameOfType(int argType)
{ {
switch(argType) switch(argType)
{ {
@ -576,9 +576,9 @@ static cv::String getNameOfType(int argType)
return ""; return "";
} }
static cv::String getErrorMessageForWrongArgumentInSetter(cv::String algoName, cv::String paramName, int paramType, int argType) static String getErrorMessageForWrongArgumentInSetter(String algoName, String paramName, int paramType, int argType)
{ {
cv::String message = cv::String("Argument error: the setter") String message = String("Argument error: the setter")
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName + " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
+"', the parameter has " + getNameOfType(paramType) + " type, "; +"', the parameter has " + getNameOfType(paramType) + " type, ";
@ -592,9 +592,9 @@ static cv::String getErrorMessageForWrongArgumentInSetter(cv::String algoName, c
return message; return message;
} }
static cv::String getErrorMessageForWrongArgumentInGetter(cv::String algoName, cv::String paramName, int paramType, int argType) static String getErrorMessageForWrongArgumentInGetter(String algoName, String paramName, int paramType, int argType)
{ {
cv::String message = cv::String("Argument error: the getter") String message = String("Argument error: the getter")
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName + " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
+"', the parameter has " + getNameOfType(paramType) + " type, "; +"', the parameter has " + getNameOfType(paramType) + " type, ";
@ -630,7 +630,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
if ( !( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN if ( !( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN
|| p->type == Param::UNSIGNED_INT || p->type == Param::UINT64 || p->type == Param::FLOAT || argType == Param::UCHAR) ) || p->type == Param::UNSIGNED_INT || p->type == Param::UINT64 || p->type == Param::FLOAT || argType == Param::UCHAR) )
{ {
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -790,21 +790,21 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
{ {
if( p->type != Param::STRING ) if( p->type != Param::STRING )
{ {
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
const cv::String& val = *(const cv::String*)value; const String& val = *(const String*)value;
if( p->setter ) if( p->setter )
(algo->*f.set_string)(val); (algo->*f.set_string)(val);
else else
*(cv::String*)((uchar*)algo + p->offset) = val; *(String*)((uchar*)algo + p->offset) = val;
} }
else if( argType == Param::MAT ) else if( argType == Param::MAT )
{ {
if( p->type != Param::MAT ) if( p->type != Param::MAT )
{ {
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -818,7 +818,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
{ {
if( p->type != Param::MAT_VECTOR ) if( p->type != Param::MAT_VECTOR )
{ {
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -832,7 +832,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
{ {
if( p->type != Param::ALGORITHM ) if( p->type != Param::ALGORITHM )
{ {
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -862,7 +862,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR)) if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset); int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);
@ -887,7 +887,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if (!( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR)) if (!( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset); bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);
@ -913,7 +913,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if(!( argType == Param::REAL || argType == Param::FLOAT)) if(!( argType == Param::REAL || argType == Param::FLOAT))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset); double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset);
@ -929,7 +929,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if(!( argType == Param::REAL || argType == Param::FLOAT)) if(!( argType == Param::REAL || argType == Param::FLOAT))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
float val = p->getter ? (algo->*f.get_float)() : *(float*)((uchar*)algo + p->offset); float val = p->getter ? (algo->*f.get_float)() : *(float*)((uchar*)algo + p->offset);
@ -945,7 +945,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR)) if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
unsigned int val = p->getter ? (algo->*f.get_uint)() : *(unsigned int*)((uchar*)algo + p->offset); unsigned int val = p->getter ? (algo->*f.get_uint)() : *(unsigned int*)((uchar*)algo + p->offset);
@ -969,7 +969,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR)) if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
uint64 val = p->getter ? (algo->*f.get_uint64)() : *(uint64*)((uchar*)algo + p->offset); uint64 val = p->getter ? (algo->*f.get_uint64)() : *(uint64*)((uchar*)algo + p->offset);
@ -993,7 +993,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR)) if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
uchar val = p->getter ? (algo->*f.get_uchar)() : *(uchar*)((uchar*)algo + p->offset); uchar val = p->getter ? (algo->*f.get_uchar)() : *(uchar*)((uchar*)algo + p->offset);
@ -1021,18 +1021,18 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if( p->type != Param::STRING ) if( p->type != Param::STRING )
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
*(cv::String*)value = p->getter ? (algo->*f.get_string)() : *(String*)value = p->getter ? (algo->*f.get_string)() :
*(cv::String*)((uchar*)algo + p->offset); *(String*)((uchar*)algo + p->offset);
} }
else if( argType == Param::MAT ) else if( argType == Param::MAT )
{ {
if( p->type != Param::MAT ) if( p->type != Param::MAT )
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -1043,7 +1043,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if( p->type != Param::MAT_VECTOR ) if( p->type != Param::MAT_VECTOR )
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -1054,7 +1054,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
{ {
if( p->type != Param::ALGORITHM ) if( p->type != Param::ALGORITHM )
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
@ -1063,7 +1063,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
} }
else else
{ {
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType); String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
CV_Error(CV_StsBadArg, message); CV_Error(CV_StsBadArg, message);
} }
} }
@ -1078,7 +1078,7 @@ int AlgorithmInfo::paramType(const char* parameter) const
} }
cv::String AlgorithmInfo::paramHelp(const char* parameter) const String AlgorithmInfo::paramHelp(const char* parameter) const
{ {
const Param* p = findstr(data->params, parameter); const Param* p = findstr(data->params, parameter);
if( !p ) if( !p )
@ -1087,7 +1087,7 @@ cv::String AlgorithmInfo::paramHelp(const char* parameter) const
} }
void AlgorithmInfo::getParams(std::vector<cv::String>& names) const void AlgorithmInfo::getParams(std::vector<String>& names) const
{ {
data->params.get_keys(names); data->params.get_keys(names);
} }
@ -1096,7 +1096,7 @@ void AlgorithmInfo::getParams(std::vector<cv::String>& names) const
void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType, void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType,
void* value, bool readOnly, void* value, bool readOnly,
Algorithm::Getter getter, Algorithm::Setter setter, Algorithm::Getter getter, Algorithm::Setter setter,
const cv::String& help) const String& help)
{ {
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
argType == Param::REAL || argType == Param::STRING || argType == Param::REAL || argType == Param::STRING ||
@ -1104,7 +1104,7 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argTyp
argType == Param::ALGORITHM argType == Param::ALGORITHM
|| argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64
|| argType == Param::UCHAR); || argType == Param::UCHAR);
data->params.add(cv::String(parameter), Param(argType, readOnly, data->params.add(String(parameter), Param(argType, readOnly,
(int)((size_t)value - (size_t)(void*)&algo), (int)((size_t)value - (size_t)(void*)&algo),
getter, setter, help)); getter, setter, help));
} }
@ -1114,7 +1114,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
int& value, bool readOnly, int& value, bool readOnly,
int (Algorithm::*getter)(), int (Algorithm::*getter)(),
void (Algorithm::*setter)(int), void (Algorithm::*setter)(int),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly, addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1124,7 +1124,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
bool& value, bool readOnly, bool& value, bool readOnly,
int (Algorithm::*getter)(), int (Algorithm::*getter)(),
void (Algorithm::*setter)(int), void (Algorithm::*setter)(int),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly, addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1134,19 +1134,19 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
double& value, bool readOnly, double& value, bool readOnly,
double (Algorithm::*getter)(), double (Algorithm::*getter)(),
void (Algorithm::*setter)(double), void (Algorithm::*setter)(double),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<double>::type, &value, readOnly, addParam_(algo, parameter, ParamType<double>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
} }
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
cv::String& value, bool readOnly, String& value, bool readOnly,
cv::String (Algorithm::*getter)(), String (Algorithm::*getter)(),
void (Algorithm::*setter)(const cv::String&), void (Algorithm::*setter)(const String&),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<cv::String>::type, &value, readOnly, addParam_(algo, parameter, ParamType<String>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
} }
@ -1154,7 +1154,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Mat& value, bool readOnly, Mat& value, bool readOnly,
Mat (Algorithm::*getter)(), Mat (Algorithm::*getter)(),
void (Algorithm::*setter)(const Mat&), void (Algorithm::*setter)(const Mat&),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly, addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1164,7 +1164,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
std::vector<Mat>& value, bool readOnly, std::vector<Mat>& value, bool readOnly,
std::vector<Mat> (Algorithm::*getter)(), std::vector<Mat> (Algorithm::*getter)(),
void (Algorithm::*setter)(const std::vector<Mat>&), void (Algorithm::*setter)(const std::vector<Mat>&),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<std::vector<Mat> >::type, &value, readOnly, addParam_(algo, parameter, ParamType<std::vector<Mat> >::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1174,7 +1174,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<Algorithm>& value, bool readOnly, Ptr<Algorithm>& value, bool readOnly,
Ptr<Algorithm> (Algorithm::*getter)(), Ptr<Algorithm> (Algorithm::*getter)(),
void (Algorithm::*setter)(const Ptr<Algorithm>&), void (Algorithm::*setter)(const Ptr<Algorithm>&),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly, addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1184,7 +1184,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
float& value, bool readOnly, float& value, bool readOnly,
float (Algorithm::*getter)(), float (Algorithm::*getter)(),
void (Algorithm::*setter)(float), void (Algorithm::*setter)(float),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<float>::type, &value, readOnly, addParam_(algo, parameter, ParamType<float>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1194,7 +1194,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
unsigned int& value, bool readOnly, unsigned int& value, bool readOnly,
unsigned int (Algorithm::*getter)(), unsigned int (Algorithm::*getter)(),
void (Algorithm::*setter)(unsigned int), void (Algorithm::*setter)(unsigned int),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<unsigned int>::type, &value, readOnly, addParam_(algo, parameter, ParamType<unsigned int>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1204,7 +1204,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
uint64& value, bool readOnly, uint64& value, bool readOnly,
uint64 (Algorithm::*getter)(), uint64 (Algorithm::*getter)(),
void (Algorithm::*setter)(uint64), void (Algorithm::*setter)(uint64),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<uint64>::type, &value, readOnly, addParam_(algo, parameter, ParamType<uint64>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
@ -1214,7 +1214,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
uchar& value, bool readOnly, uchar& value, bool readOnly,
uchar (Algorithm::*getter)(), uchar (Algorithm::*getter)(),
void (Algorithm::*setter)(uchar), void (Algorithm::*setter)(uchar),
const cv::String& help) const String& help)
{ {
addParam_(algo, parameter, ParamType<uchar>::type, &value, readOnly, addParam_(algo, parameter, ParamType<uchar>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);

@ -6,9 +6,9 @@ namespace cv
struct CommandLineParserParams struct CommandLineParserParams
{ {
public: public:
cv::String help_message; String help_message;
cv::String def_value; String def_value;
std::vector<cv::String> keys; std::vector<String> keys;
int number; int number;
}; };
@ -16,27 +16,27 @@ public:
struct CommandLineParser::Impl struct CommandLineParser::Impl
{ {
bool error; bool error;
cv::String error_message; String error_message;
cv::String about_message; String about_message;
cv::String path_to_app; String path_to_app;
cv::String app_name; String app_name;
std::vector<CommandLineParserParams> data; std::vector<CommandLineParserParams> data;
std::vector<cv::String> split_range_string(const cv::String& str, char fs, char ss) const; std::vector<String> split_range_string(const String& str, char fs, char ss) const;
std::vector<cv::String> split_string(const cv::String& str, char symbol = ' ', bool create_empty_item = false) const; std::vector<String> split_string(const String& str, char symbol = ' ', bool create_empty_item = false) const;
cv::String cat_string(const cv::String& str) const; String cat_string(const String& str) const;
void apply_params(const cv::String& key, const cv::String& value); void apply_params(const String& key, const String& value);
void apply_params(int i, cv::String value); void apply_params(int i, String value);
void sort_params(); void sort_params();
int refcount; int refcount;
}; };
static cv::String get_type_name(int type) static String get_type_name(int type)
{ {
if( type == Param::INT ) if( type == Param::INT )
return "int"; return "int";
@ -53,7 +53,7 @@ static cv::String get_type_name(int type)
return "unknown"; return "unknown";
} }
static void from_str(const cv::String& str, int type, void* dst) static void from_str(const String& str, int type, void* dst)
{ {
std::stringstream ss(str.c_str()); std::stringstream ss(str.c_str());
if( type == Param::INT ) if( type == Param::INT )
@ -67,20 +67,20 @@ static void from_str(const cv::String& str, int type, void* dst)
else if( type == Param::REAL ) else if( type == Param::REAL )
ss >> *(double*)dst; ss >> *(double*)dst;
else if( type == Param::STRING ) else if( type == Param::STRING )
*(cv::String*)dst = str; *(String*)dst = str;
else else
throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", "", __FILE__, __LINE__); throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", "", __FILE__, __LINE__);
if (ss.fail()) if (ss.fail())
{ {
cv::String err_msg = "can not convert: [" + str + String err_msg = "can not convert: [" + str +
+ "] to [" + get_type_name(type) + "]"; + "] to [" + get_type_name(type) + "]";
throw cv::Exception(CV_StsBadArg, err_msg, "", __FILE__, __LINE__); throw cv::Exception(CV_StsBadArg, err_msg, "", __FILE__, __LINE__);
} }
} }
void CommandLineParser::getByName(const cv::String& name, bool space_delete, int type, void* dst) const void CommandLineParser::getByName(const String& name, bool space_delete, int type, void* dst) const
{ {
try try
{ {
@ -90,7 +90,7 @@ void CommandLineParser::getByName(const cv::String& name, bool space_delete, int
{ {
if (name.compare(impl->data[i].keys[j]) == 0) if (name.compare(impl->data[i].keys[j]) == 0)
{ {
cv::String v = impl->data[i].def_value; String v = impl->data[i].def_value;
if (space_delete) if (space_delete)
v = impl->cat_string(v); v = impl->cat_string(v);
from_str(v, type, dst); from_str(v, type, dst);
@ -104,7 +104,7 @@ void CommandLineParser::getByName(const cv::String& name, bool space_delete, int
catch (std::exception& e) catch (std::exception& e)
{ {
impl->error = true; impl->error = true;
impl->error_message = impl->error_message + "Exception: " + cv::String(e.what()) + "\n"; impl->error_message = impl->error_message + "Exception: " + String(e.what()) + "\n";
} }
} }
@ -117,7 +117,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
{ {
if (impl->data[i].number == index) if (impl->data[i].number == index)
{ {
cv::String v = impl->data[i].def_value; String v = impl->data[i].def_value;
if (space_delete == true) v = impl->cat_string(v); if (space_delete == true) v = impl->cat_string(v);
from_str(v, type, dst); from_str(v, type, dst);
return; return;
@ -129,7 +129,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
catch(std::exception & e) catch(std::exception & e)
{ {
impl->error = true; impl->error = true;
impl->error_message = impl->error_message + "Exception: " + cv::String(e.what()) + "\n"; impl->error_message = impl->error_message + "Exception: " + String(e.what()) + "\n";
} }
} }
@ -149,34 +149,34 @@ static bool cmp_params(const CommandLineParserParams & p1, const CommandLinePars
return true; return true;
} }
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const cv::String& keys) CommandLineParser::CommandLineParser(int argc, const char* const argv[], const String& keys)
{ {
impl = new Impl; impl = new Impl;
impl->refcount = 1; impl->refcount = 1;
// path to application // path to application
size_t pos_s = cv::String(argv[0]).find_last_of("/\\"); size_t pos_s = String(argv[0]).find_last_of("/\\");
if (pos_s == cv::String::npos) if (pos_s == String::npos)
{ {
impl->path_to_app = ""; impl->path_to_app = "";
impl->app_name = cv::String(argv[0]); impl->app_name = String(argv[0]);
} }
else else
{ {
impl->path_to_app = cv::String(argv[0]).substr(0, pos_s); impl->path_to_app = String(argv[0]).substr(0, pos_s);
impl->app_name = cv::String(argv[0]).substr(pos_s + 1, cv::String(argv[0]).length() - pos_s); impl->app_name = String(argv[0]).substr(pos_s + 1, String(argv[0]).length() - pos_s);
} }
impl->error = false; impl->error = false;
impl->error_message = ""; impl->error_message = "";
// parse keys // parse keys
std::vector<cv::String> k = impl->split_range_string(keys, '{', '}'); std::vector<String> k = impl->split_range_string(keys, '{', '}');
int jj = 0; int jj = 0;
for (size_t i = 0; i < k.size(); i++) for (size_t i = 0; i < k.size(); i++)
{ {
std::vector<cv::String> l = impl->split_string(k[i], '|', true); std::vector<String> l = impl->split_string(k[i], '|', true);
CommandLineParserParams p; CommandLineParserParams p;
p.keys = impl->split_string(l[0]); p.keys = impl->split_string(l[0]);
p.def_value = l[1]; p.def_value = l[1];
@ -203,11 +203,11 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
jj = 0; jj = 0;
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
cv::String s = cv::String(argv[i]); String s = String(argv[i]);
if (s.find('=') != cv::String::npos && s.find('=') < s.length()) if (s.find('=') != String::npos && s.find('=') < s.length())
{ {
std::vector<cv::String> k_v = impl->split_string(s, '=', true); std::vector<String> k_v = impl->split_string(s, '=', true);
for (int h = 0; h < 2; h++) for (int h = 0; h < 2; h++)
{ {
if (k_v[0][0] == '-') if (k_v[0][0] == '-')
@ -253,12 +253,12 @@ CommandLineParser& CommandLineParser::operator = (const CommandLineParser& parse
return *this; return *this;
} }
void CommandLineParser::about(const cv::String& message) void CommandLineParser::about(const String& message)
{ {
impl->about_message = message; impl->about_message = message;
} }
void CommandLineParser::Impl::apply_params(const cv::String& key, const cv::String& value) void CommandLineParser::Impl::apply_params(const String& key, const String& value)
{ {
for (size_t i = 0; i < data.size(); i++) for (size_t i = 0; i < data.size(); i++)
{ {
@ -273,7 +273,7 @@ void CommandLineParser::Impl::apply_params(const cv::String& key, const cv::Stri
} }
} }
void CommandLineParser::Impl::apply_params(int i, cv::String value) void CommandLineParser::Impl::apply_params(int i, String value)
{ {
for (size_t j = 0; j < data.size(); j++) for (size_t j = 0; j < data.size(); j++)
{ {
@ -295,28 +295,28 @@ void CommandLineParser::Impl::sort_params()
std::sort (data.begin(), data.end(), cmp_params); std::sort (data.begin(), data.end(), cmp_params);
} }
cv::String CommandLineParser::Impl::cat_string(const cv::String& str) const String CommandLineParser::Impl::cat_string(const String& str) const
{ {
int left = 0, right = (int)str.length(); int left = 0, right = (int)str.length();
while( left <= right && str[left] == ' ' ) while( left <= right && str[left] == ' ' )
left++; left++;
while( right > left && str[right-1] == ' ' ) while( right > left && str[right-1] == ' ' )
right--; right--;
return left >= right ? cv::String("") : str.substr(left, right-left); return left >= right ? String("") : str.substr(left, right-left);
} }
cv::String CommandLineParser::getPathToApplication() const String CommandLineParser::getPathToApplication() const
{ {
return impl->path_to_app; return impl->path_to_app;
} }
bool CommandLineParser::has(const cv::String& name) const bool CommandLineParser::has(const String& name) const
{ {
for (size_t i = 0; i < impl->data.size(); i++) for (size_t i = 0; i < impl->data.size(); i++)
{ {
for (size_t j = 0; j < impl->data[i].keys.size(); j++) for (size_t j = 0; j < impl->data[i].keys.size(); j++)
{ {
if (name.compare(impl->data[i].keys[j]) == 0 && cv::String("true").compare(impl->data[i].def_value) == 0) if (name.compare(impl->data[i].keys[j]) == 0 && String("true").compare(impl->data[i].def_value) == 0)
{ {
return true; return true;
} }
@ -350,7 +350,7 @@ void CommandLineParser::printMessage() const
{ {
if (impl->data[i].number > -1) if (impl->data[i].number > -1)
{ {
cv::String name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1); String name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
printf("%s ", name.c_str()); printf("%s ", name.c_str());
} }
} }
@ -364,7 +364,7 @@ void CommandLineParser::printMessage() const
printf("\t"); printf("\t");
for (size_t j = 0; j < impl->data[i].keys.size(); j++) for (size_t j = 0; j < impl->data[i].keys.size(); j++)
{ {
cv::String k = impl->data[i].keys[j]; String k = impl->data[i].keys[j];
if (k.length() > 1) if (k.length() > 1)
{ {
printf("--"); printf("--");
@ -380,7 +380,7 @@ void CommandLineParser::printMessage() const
printf(", "); printf(", ");
} }
} }
cv::String dv = impl->cat_string(impl->data[i].def_value); String dv = impl->cat_string(impl->data[i].def_value);
if (dv.compare("") != 0) if (dv.compare("") != 0)
{ {
printf(" (value:%s)", dv.c_str()); printf(" (value:%s)", dv.c_str());
@ -395,12 +395,12 @@ void CommandLineParser::printMessage() const
if (impl->data[i].number != -1) if (impl->data[i].number != -1)
{ {
printf("\t"); printf("\t");
cv::String k = impl->data[i].keys[0]; String k = impl->data[i].keys[0];
k = k.substr(1, k.length() - 1); k = k.substr(1, k.length() - 1);
printf("%s", k.c_str()); printf("%s", k.c_str());
cv::String dv = impl->cat_string(impl->data[i].def_value); String dv = impl->cat_string(impl->data[i].def_value);
if (dv.compare("") != 0) if (dv.compare("") != 0)
{ {
printf(" (value:%s)", dv.c_str()); printf(" (value:%s)", dv.c_str());
@ -410,11 +410,11 @@ void CommandLineParser::printMessage() const
} }
} }
std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::String& _str, char fs, char ss) const std::vector<String> CommandLineParser::Impl::split_range_string(const String& _str, char fs, char ss) const
{ {
cv::String str = _str; String str = _str;
std::vector<cv::String> vec; std::vector<String> vec;
cv::String word = ""; String word = "";
bool begin = false; bool begin = false;
while (!str.empty()) while (!str.empty())
@ -424,13 +424,13 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
if (begin == true) if (begin == true)
{ {
throw cv::Exception(CV_StsParseError, throw cv::Exception(CV_StsParseError,
cv::String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ cv::String(", ") + String(", ")
+ cv::String(1, fs) + String(1, fs)
+ cv::String(", ") + String(", ")
+ cv::String(1, ss) + String(1, ss)
+ cv::String(")"), + String(")"),
"", __FILE__, __LINE__ "", __FILE__, __LINE__
); );
} }
@ -444,13 +444,13 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
if (begin == false) if (begin == false)
{ {
throw cv::Exception(CV_StsParseError, throw cv::Exception(CV_StsParseError,
cv::String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ cv::String(", ") + String(", ")
+ cv::String(1, fs) + String(1, fs)
+ cv::String(", ") + String(", ")
+ cv::String(1, ss) + String(1, ss)
+ cv::String(")"), + String(")"),
"", __FILE__, __LINE__ "", __FILE__, __LINE__
); );
} }
@ -468,13 +468,13 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
if (begin == true) if (begin == true)
{ {
throw cv::Exception(CV_StsParseError, throw cv::Exception(CV_StsParseError,
cv::String("error in split_range_string(") String("error in split_range_string(")
+ str + str
+ cv::String(", ") + String(", ")
+ cv::String(1, fs) + String(1, fs)
+ cv::String(", ") + String(", ")
+ cv::String(1, ss) + String(1, ss)
+ cv::String(")"), + String(")"),
"", __FILE__, __LINE__ "", __FILE__, __LINE__
); );
} }
@ -482,11 +482,11 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
return vec; return vec;
} }
std::vector<cv::String> CommandLineParser::Impl::split_string(const cv::String& _str, char symbol, bool create_empty_item) const std::vector<String> CommandLineParser::Impl::split_string(const String& _str, char symbol, bool create_empty_item) const
{ {
cv::String str = _str; String str = _str;
std::vector<cv::String> vec; std::vector<String> vec;
cv::String word = ""; String word = "";
while (!str.empty()) while (!str.empty())
{ {

@ -1916,7 +1916,7 @@ static const int* getFontData(int fontFace)
} }
void putText( Mat& img, const cv::String& text, Point org, void putText( Mat& img, const String& text, Point org,
int fontFace, double fontScale, Scalar color, int fontFace, double fontScale, Scalar color,
int thickness, int line_type, bool bottomLeftOrigin ) int thickness, int line_type, bool bottomLeftOrigin )
@ -1978,7 +1978,7 @@ void putText( Mat& img, const cv::String& text, Point org,
} }
} }
Size getTextSize( const cv::String& text, int fontFace, double fontScale, int thickness, int* _base_line) Size getTextSize( const String& text, int fontFace, double fontScale, int thickness, int* _base_line)
{ {
Size size; Size size;
double view_x = 0; double view_x = 0;

@ -15,8 +15,8 @@
image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR); image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
// prepend a '_' for the Unix C symbol mangling convention // prepend a '_' for the Unix C symbol mangling convention
cv::String symbolName = "_"; String symbolName = "_";
symbolName += cv::String(name); symbolName += String(name);
NSSymbol symbol = image ? NSLookupSymbolInImage(image, &symbolName[0], NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : 0; NSSymbol symbol = image ? NSLookupSymbolInImage(image, &symbolName[0], NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : 0;

@ -208,10 +208,10 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
else CV_Error(CV_StsObjectNotFound, cv::format("could not open directory: %s", directory.c_str())); else CV_Error(CV_StsObjectNotFound, cv::format("could not open directory: %s", directory.c_str()));
} }
void cv::glob(cv::String pattern, std::vector<cv::String>& result, bool recursive) void cv::glob(String pattern, std::vector<String>& result, bool recursive)
{ {
result.clear(); result.clear();
cv::String path, wildchart; String path, wildchart;
if (isDir(pattern, 0)) if (isDir(pattern, 0))
{ {
@ -227,7 +227,7 @@ void cv::glob(cv::String pattern, std::vector<cv::String>& result, bool recursiv
else else
{ {
size_t pos = pattern.find_last_of(dir_separators); size_t pos = pattern.find_last_of(dir_separators);
if (pos == cv::String::npos) if (pos == String::npos)
{ {
wildchart = pattern; wildchart = pattern;
path = "."; path = ".";

@ -172,7 +172,7 @@ namespace
bool hasEqualOrGreaterBin(int major, int minor) const; bool hasEqualOrGreaterBin(int major, int minor) const;
private: private:
static void fromStr(const cv::String& set_as_str, std::vector<int>& arr); static void fromStr(const String& set_as_str, std::vector<int>& arr);
std::vector<int> bin; std::vector<int> bin;
std::vector<int> ptx; std::vector<int> ptx;
@ -218,9 +218,9 @@ namespace
return !bin.empty() && (bin.back() >= major * 10 + minor); return !bin.empty() && (bin.back() >= major * 10 + minor);
} }
void CudaArch::fromStr(const cv::String& set_as_str, std::vector<int>& arr) void CudaArch::fromStr(const String& set_as_str, std::vector<int>& arr)
{ {
if (set_as_str.find_first_not_of(" ") == cv::String::npos) if (set_as_str.find_first_not_of(" ") == String::npos)
return; return;
std::istringstream stream(set_as_str); std::istringstream stream(set_as_str);

@ -152,7 +152,7 @@ cv::String cv::FileStorage::getDefaultObjectName(const cv::String& _filename)
name = name_buf; name = name_buf;
if( strcmp( name, "_" ) == 0 ) if( strcmp( name, "_" ) == 0 )
strcpy( name, stubname ); strcpy( name, stubname );
return cv::String(name); return String(name);
} }
typedef struct CvGenericHash typedef struct CvGenericHash
@ -5104,7 +5104,7 @@ stop_search:
namespace cv namespace cv
{ {
static void getElemSize( const cv::String& fmt, size_t& elemSize, size_t& cn ) static void getElemSize( const String& fmt, size_t& elemSize, size_t& cn )
{ {
const char* dt = fmt.c_str(); const char* dt = fmt.c_str();
cn = 1; cn = 1;
@ -5124,7 +5124,7 @@ FileStorage::FileStorage()
state = UNDEFINED; state = UNDEFINED;
} }
FileStorage::FileStorage(const cv::String& filename, int flags, const cv::String& encoding) FileStorage::FileStorage(const String& filename, int flags, const String& encoding)
{ {
state = UNDEFINED; state = UNDEFINED;
open( filename, flags, encoding ); open( filename, flags, encoding );
@ -5145,7 +5145,7 @@ FileStorage::~FileStorage()
} }
} }
bool FileStorage::open(const cv::String& filename, int flags, const cv::String& encoding) bool FileStorage::open(const String& filename, int flags, const String& encoding)
{ {
release(); release();
fs = Ptr<CvFileStorage>(cvOpenFileStorage( filename.c_str(), 0, flags, fs = Ptr<CvFileStorage>(cvOpenFileStorage( filename.c_str(), 0, flags,
@ -5167,9 +5167,9 @@ void FileStorage::release()
state = UNDEFINED; state = UNDEFINED;
} }
cv::String FileStorage::releaseAndGetString() String FileStorage::releaseAndGetString()
{ {
cv::String buf; String buf;
if( fs.obj && fs.obj->outbuf ) if( fs.obj && fs.obj->outbuf )
icvClose(fs.obj, &buf); icvClose(fs.obj, &buf);
@ -5182,7 +5182,7 @@ FileNode FileStorage::root(int streamidx) const
return isOpened() ? FileNode(fs, cvGetRootFileNode(fs, streamidx)) : FileNode(); return isOpened() ? FileNode(fs, cvGetRootFileNode(fs, streamidx)) : FileNode();
} }
FileStorage& operator << (FileStorage& fs, const cv::String& str) FileStorage& operator << (FileStorage& fs, const String& str)
{ {
enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED, enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED,
VALUE_EXPECTED = FileStorage::VALUE_EXPECTED, VALUE_EXPECTED = FileStorage::VALUE_EXPECTED,
@ -5201,7 +5201,7 @@ FileStorage& operator << (FileStorage& fs, const cv::String& str)
fs.state = fs.structs.empty() || fs.structs.back() == '{' ? fs.state = fs.structs.empty() || fs.structs.back() == '{' ?
INSIDE_MAP + NAME_EXPECTED : VALUE_EXPECTED; INSIDE_MAP + NAME_EXPECTED : VALUE_EXPECTED;
cvEndWriteStruct( *fs ); cvEndWriteStruct( *fs );
fs.elname = cv::String(); fs.elname = String();
} }
else if( fs.state == NAME_EXPECTED + INSIDE_MAP ) else if( fs.state == NAME_EXPECTED + INSIDE_MAP )
{ {
@ -5225,12 +5225,12 @@ FileStorage& operator << (FileStorage& fs, const cv::String& str)
} }
cvStartWriteStruct( *fs, fs.elname.size() > 0 ? fs.elname.c_str() : 0, cvStartWriteStruct( *fs, fs.elname.size() > 0 ? fs.elname.c_str() : 0,
flags, *_str ? _str : 0 ); flags, *_str ? _str : 0 );
fs.elname = cv::String(); fs.elname = String();
} }
else else
{ {
write( fs, fs.elname, (_str[0] == '\\' && (_str[1] == '{' || _str[1] == '}' || write( fs, fs.elname, (_str[0] == '\\' && (_str[1] == '{' || _str[1] == '}' ||
_str[1] == '[' || _str[1] == ']')) ? cv::String(_str+1) : str ); _str[1] == '[' || _str[1] == ']')) ? String(_str+1) : str );
if( fs.state == INSIDE_MAP + VALUE_EXPECTED ) if( fs.state == INSIDE_MAP + VALUE_EXPECTED )
fs.state = INSIDE_MAP + NAME_EXPECTED; fs.state = INSIDE_MAP + NAME_EXPECTED;
} }
@ -5241,7 +5241,7 @@ FileStorage& operator << (FileStorage& fs, const cv::String& str)
} }
void FileStorage::writeRaw( const cv::String& fmt, const uchar* vec, size_t len ) void FileStorage::writeRaw( const String& fmt, const uchar* vec, size_t len )
{ {
if( !isOpened() ) if( !isOpened() )
return; return;
@ -5252,7 +5252,7 @@ void FileStorage::writeRaw( const cv::String& fmt, const uchar* vec, size_t len
} }
void FileStorage::writeObj( const cv::String& name, const void* obj ) void FileStorage::writeObj( const String& name, const void* obj )
{ {
if( !isOpened() ) if( !isOpened() )
return; return;
@ -5260,7 +5260,7 @@ void FileStorage::writeObj( const cv::String& name, const void* obj )
} }
FileNode FileStorage::operator[](const cv::String& nodename) const FileNode FileStorage::operator[](const String& nodename) const
{ {
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename.c_str())); return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename.c_str()));
} }
@ -5270,7 +5270,7 @@ FileNode FileStorage::operator[](const char* nodename) const
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename)); return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename));
} }
FileNode FileNode::operator[](const cv::String& nodename) const FileNode FileNode::operator[](const String& nodename) const
{ {
return FileNode(fs, cvGetFileNodeByName(fs, node, nodename.c_str())); return FileNode(fs, cvGetFileNodeByName(fs, node, nodename.c_str()));
} }
@ -5286,10 +5286,10 @@ FileNode FileNode::operator[](int i) const
i == 0 ? *this : FileNode(); i == 0 ? *this : FileNode();
} }
cv::String FileNode::name() const String FileNode::name() const
{ {
const char* str; const char* str;
return !node || (str = cvGetFileNodeName(node)) == 0 ? cv::String() : cv::String(str); return !node || (str = cvGetFileNodeName(node)) == 0 ? String() : String(str);
} }
void* FileNode::readObj() const void* FileNode::readObj() const
@ -5404,7 +5404,7 @@ FileNodeIterator& FileNodeIterator::operator -= (int ofs)
} }
FileNodeIterator& FileNodeIterator::readRaw( const cv::String& fmt, uchar* vec, size_t maxCount ) FileNodeIterator& FileNodeIterator::readRaw( const String& fmt, uchar* vec, size_t maxCount )
{ {
if( fs && container && remaining > 0 ) if( fs && container && remaining > 0 )
{ {
@ -5428,16 +5428,16 @@ FileNodeIterator& FileNodeIterator::readRaw( const cv::String& fmt, uchar* vec,
} }
void write( FileStorage& fs, const cv::String& name, int value ) void write( FileStorage& fs, const String& name, int value )
{ cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); } { cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); }
void write( FileStorage& fs, const cv::String& name, float value ) void write( FileStorage& fs, const String& name, float value )
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); } { cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
void write( FileStorage& fs, const cv::String& name, double value ) void write( FileStorage& fs, const String& name, double value )
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); } { cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
void write( FileStorage& fs, const cv::String& name, const cv::String& value ) void write( FileStorage& fs, const String& name, const String& value )
{ cvWriteString( *fs, name.size() ? name.c_str() : 0, value.c_str() ); } { cvWriteString( *fs, name.size() ? name.c_str() : 0, value.c_str() ); }
void writeScalar(FileStorage& fs, int value ) void writeScalar(FileStorage& fs, int value )
@ -5449,11 +5449,11 @@ void writeScalar(FileStorage& fs, float value )
void writeScalar(FileStorage& fs, double value ) void writeScalar(FileStorage& fs, double value )
{ cvWriteReal( *fs, 0, value ); } { cvWriteReal( *fs, 0, value ); }
void writeScalar(FileStorage& fs, const cv::String& value ) void writeScalar(FileStorage& fs, const String& value )
{ cvWriteString( *fs, 0, value.c_str() ); } { cvWriteString( *fs, 0, value.c_str() ); }
void write( FileStorage& fs, const cv::String& name, const Mat& value ) void write( FileStorage& fs, const String& name, const Mat& value )
{ {
if( value.dims <= 2 ) if( value.dims <= 2 )
{ {
@ -5468,15 +5468,15 @@ void write( FileStorage& fs, const cv::String& name, const Mat& value )
} }
// TODO: the 4 functions below need to be implemented more efficiently // TODO: the 4 functions below need to be implemented more efficiently
void write( FileStorage& fs, const cv::String& name, const SparseMat& value ) void write( FileStorage& fs, const String& name, const SparseMat& value )
{ {
Ptr<CvSparseMat> mat = (CvSparseMat*)value; Ptr<CvSparseMat> mat = (CvSparseMat*)value;
cvWrite( *fs, name.size() ? name.c_str() : 0, mat ); cvWrite( *fs, name.size() ? name.c_str() : 0, mat );
} }
WriteStructContext::WriteStructContext(FileStorage& _fs, const cv::String& name, WriteStructContext::WriteStructContext(FileStorage& _fs, const String& name,
int flags, const cv::String& typeName) : fs(&_fs) int flags, const String& typeName) : fs(&_fs)
{ {
cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags, cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags,
!typeName.empty() ? typeName.c_str() : 0); !typeName.empty() ? typeName.c_str() : 0);

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

@ -459,7 +459,7 @@ TEST(Core_globbing, accurasy)
std::string patternLena = cvtest::TS::ptr()->get_data_path() + "lena*.*"; std::string patternLena = cvtest::TS::ptr()->get_data_path() + "lena*.*";
std::string patternLenaPng = cvtest::TS::ptr()->get_data_path() + "lena.png"; std::string patternLenaPng = cvtest::TS::ptr()->get_data_path() + "lena.png";
std::vector<cv::String> lenas, pngLenas; std::vector<String> lenas, pngLenas;
cv::glob(patternLena, lenas, true); cv::glob(patternLena, lenas, true);
cv::glob(patternLenaPng, pngLenas, true); cv::glob(patternLenaPng, pngLenas, true);

@ -109,7 +109,7 @@ public:
}; };
//! writes vector of keypoints to the file storage //! writes vector of keypoints to the file storage
CV_EXPORTS void write(FileStorage& fs, const cv::String& name, const std::vector<KeyPoint>& keypoints); CV_EXPORTS void write(FileStorage& fs, const String& name, const std::vector<KeyPoint>& keypoints);
//! reads vector of keypoints from the specified file storage node //! reads vector of keypoints from the specified file storage node
CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector<KeyPoint>& keypoints); CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector<KeyPoint>& keypoints);
@ -179,7 +179,7 @@ public:
CV_WRAP virtual bool empty() const; CV_WRAP virtual bool empty() const;
// Create feature detector by detector name. // Create feature detector by detector name.
CV_WRAP static Ptr<FeatureDetector> create( const cv::String& detectorType ); CV_WRAP static Ptr<FeatureDetector> create( const String& detectorType );
protected: protected:
virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const = 0; virtual void detectImpl( const Mat& image, std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const = 0;
@ -229,7 +229,7 @@ public:
CV_WRAP virtual bool empty() const; CV_WRAP virtual bool empty() const;
CV_WRAP static Ptr<DescriptorExtractor> create( const cv::String& descriptorExtractorType ); CV_WRAP static Ptr<DescriptorExtractor> create( const String& descriptorExtractorType );
protected: protected:
virtual void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const = 0; virtual void computeImpl( const Mat& image, std::vector<KeyPoint>& keypoints, Mat& descriptors ) const = 0;
@ -264,7 +264,7 @@ public:
bool useProvidedKeypoints=false ) const = 0; bool useProvidedKeypoints=false ) const = 0;
// Create feature detector and descriptor extractor by name. // Create feature detector and descriptor extractor by name.
CV_WRAP static Ptr<Feature2D> create( const cv::String& name ); CV_WRAP static Ptr<Feature2D> create( const String& name );
}; };
/*! /*!
@ -765,7 +765,7 @@ public:
virtual Ptr<AdjusterAdapter> clone() const = 0; virtual Ptr<AdjusterAdapter> clone() const = 0;
static Ptr<AdjusterAdapter> create( const cv::String& detectorType ); static Ptr<AdjusterAdapter> create( const String& detectorType );
}; };
/** \brief an adaptively adjusting detector that iteratively detects until the desired number /** \brief an adaptively adjusting detector that iteratively detects until the desired number
* of features are detected. * of features are detected.
@ -1141,7 +1141,7 @@ public:
// but with empty train data. // but with empty train data.
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0; virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
CV_WRAP static Ptr<DescriptorMatcher> create( const cv::String& descriptorMatcherType ); CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
protected: protected:
/* /*
* Class to work with descriptors from several images as with one merged matrix. * Class to work with descriptors from several images as with one merged matrix.
@ -1367,8 +1367,8 @@ public:
// but with empty train data. // but with empty train data.
virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const = 0; virtual Ptr<GenericDescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
static Ptr<GenericDescriptorMatcher> create( const cv::String& genericDescritptorMatcherType, static Ptr<GenericDescriptorMatcher> create( const String& genericDescritptorMatcherType,
const cv::String &paramsFilename=cv::String() ); const String &paramsFilename=String() );
protected: protected:
// In fact the matching is implemented only by the following two methods. These methods suppose // In fact the matching is implemented only by the following two methods. These methods suppose

@ -92,12 +92,12 @@ void DescriptorExtractor::removeBorderKeypoints( std::vector<KeyPoint>& keypoint
KeyPointsFilter::runByImageBorder( keypoints, imageSize, borderSize ); KeyPointsFilter::runByImageBorder( keypoints, imageSize, borderSize );
} }
Ptr<DescriptorExtractor> DescriptorExtractor::create(const cv::String& descriptorExtractorType) Ptr<DescriptorExtractor> DescriptorExtractor::create(const String& descriptorExtractorType)
{ {
if( descriptorExtractorType.find("Opponent") == 0 ) if( descriptorExtractorType.find("Opponent") == 0 )
{ {
size_t pos = cv::String("Opponent").size(); size_t pos = String("Opponent").size();
cv::String type = descriptorExtractorType.substr(pos); String type = descriptorExtractorType.substr(pos);
return new OpponentColorDescriptorExtractor(DescriptorExtractor::create(type)); return new OpponentColorDescriptorExtractor(DescriptorExtractor::create(type));
} }

@ -86,7 +86,7 @@ void FeatureDetector::removeInvalidPoints( const Mat& mask, std::vector<KeyPoint
KeyPointsFilter::runByPixelsMask( keypoints, mask ); KeyPointsFilter::runByPixelsMask( keypoints, mask );
} }
Ptr<FeatureDetector> FeatureDetector::create( const cv::String& detectorType ) Ptr<FeatureDetector> FeatureDetector::create( const String& detectorType )
{ {
if( detectorType.find("Grid") == 0 ) if( detectorType.find("Grid") == 0 )
{ {

@ -199,7 +199,7 @@ Ptr<AdjusterAdapter> SurfAdjuster::clone() const
return cloned_obj; return cloned_obj;
} }
Ptr<AdjusterAdapter> AdjusterAdapter::create( const cv::String& detectorType ) Ptr<AdjusterAdapter> AdjusterAdapter::create( const String& detectorType )
{ {
Ptr<AdjusterAdapter> adapter; Ptr<AdjusterAdapter> adapter;

@ -44,7 +44,7 @@
using namespace cv; using namespace cv;
Ptr<Feature2D> Feature2D::create( const cv::String& feature2DType ) Ptr<Feature2D> Feature2D::create( const String& feature2DType )
{ {
return Algorithm::create<Feature2D>("Feature2D." + feature2DType); return Algorithm::create<Feature2D>("Feature2D." + feature2DType);
} }

@ -58,7 +58,7 @@ size_t KeyPoint::hash() const
return _Val; return _Val;
} }
void write(FileStorage& fs, const cv::String& objname, const std::vector<KeyPoint>& keypoints) void write(FileStorage& fs, const String& objname, const std::vector<KeyPoint>& keypoints)
{ {
WriteStructContext ws(fs, objname, CV_NODE_SEQ + CV_NODE_FLOW); WriteStructContext ws(fs, objname, CV_NODE_SEQ + CV_NODE_FLOW);

@ -456,7 +456,7 @@ void BFMatcher::radiusMatchImpl( const Mat& queryDescriptors, std::vector<std::v
/* /*
* Factory function for DescriptorMatcher creating * Factory function for DescriptorMatcher creating
*/ */
Ptr<DescriptorMatcher> DescriptorMatcher::create( const cv::String& descriptorMatcherType ) Ptr<DescriptorMatcher> DescriptorMatcher::create( const String& descriptorMatcherType )
{ {
DescriptorMatcher* dm = 0; DescriptorMatcher* dm = 0;
if( !descriptorMatcherType.compare( "FlannBased" ) ) if( !descriptorMatcherType.compare( "FlannBased" ) )
@ -540,7 +540,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
for(int i = 0; i < (int)ip.size(); ++i) for(int i = 0; i < (int)ip.size(); ++i)
{ {
CV_Assert(ip[i].type() == FileNode::MAP); CV_Assert(ip[i].type() == FileNode::MAP);
cv::String _name = (cv::String)ip[i]["name"]; String _name = (String)ip[i]["name"];
int type = (int)ip[i]["type"]; int type = (int)ip[i]["type"];
switch(type) switch(type)
@ -559,7 +559,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
indexParams->setDouble(_name, (double) ip[i]["value"]); indexParams->setDouble(_name, (double) ip[i]["value"]);
break; break;
case CV_USRTYPE1: case CV_USRTYPE1:
indexParams->setString(_name, (cv::String) ip[i]["value"]); indexParams->setString(_name, (String) ip[i]["value"]);
break; break;
case CV_MAKETYPE(CV_USRTYPE1,2): case CV_MAKETYPE(CV_USRTYPE1,2):
indexParams->setBool(_name, (int) ip[i]["value"] != 0); indexParams->setBool(_name, (int) ip[i]["value"] != 0);
@ -579,7 +579,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
for(int i = 0; i < (int)sp.size(); ++i) for(int i = 0; i < (int)sp.size(); ++i)
{ {
CV_Assert(sp[i].type() == FileNode::MAP); CV_Assert(sp[i].type() == FileNode::MAP);
cv::String _name = (cv::String)sp[i]["name"]; String _name = (String)sp[i]["name"];
int type = (int)sp[i]["type"]; int type = (int)sp[i]["type"];
switch(type) switch(type)
@ -598,7 +598,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
searchParams->setDouble(_name, (double) ip[i]["value"]); searchParams->setDouble(_name, (double) ip[i]["value"]);
break; break;
case CV_USRTYPE1: case CV_USRTYPE1:
searchParams->setString(_name, (cv::String) ip[i]["value"]); searchParams->setString(_name, (String) ip[i]["value"]);
break; break;
case CV_MAKETYPE(CV_USRTYPE1,2): case CV_MAKETYPE(CV_USRTYPE1,2):
searchParams->setBool(_name, (int) ip[i]["value"] != 0); searchParams->setBool(_name, (int) ip[i]["value"] != 0);
@ -618,9 +618,9 @@ void FlannBasedMatcher::write( FileStorage& fs) const
if (indexParams) if (indexParams)
{ {
std::vector<cv::String> names; std::vector<String> names;
std::vector<int> types; std::vector<int> types;
std::vector<cv::String> strValues; std::vector<String> strValues;
std::vector<double> numValues; std::vector<double> numValues;
indexParams->getAll(names, types, strValues, numValues); indexParams->getAll(names, types, strValues, numValues);
@ -669,9 +669,9 @@ void FlannBasedMatcher::write( FileStorage& fs) const
if (searchParams) if (searchParams)
{ {
std::vector<cv::String> names; std::vector<String> names;
std::vector<int> types; std::vector<int> types;
std::vector<cv::String> strValues; std::vector<String> strValues;
std::vector<double> numValues; std::vector<double> numValues;
searchParams->getAll(names, types, strValues, numValues); searchParams->getAll(names, types, strValues, numValues);
@ -1060,8 +1060,8 @@ bool GenericDescriptorMatcher::empty() const
/* /*
* Factory function for GenericDescriptorMatch creating * Factory function for GenericDescriptorMatch creating
*/ */
Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::create( const cv::String& genericDescritptorMatcherType, Ptr<GenericDescriptorMatcher> GenericDescriptorMatcher::create( const String& genericDescritptorMatcherType,
const cv::String &paramsFilename ) const String &paramsFilename )
{ {
Ptr<GenericDescriptorMatcher> descriptorMatcher = Ptr<GenericDescriptorMatcher> descriptorMatcher =
Algorithm::create<GenericDescriptorMatcher>("DescriptorMatcher." + genericDescritptorMatcherType); Algorithm::create<GenericDescriptorMatcher>("DescriptorMatcher." + genericDescritptorMatcherType);

@ -138,7 +138,7 @@ The method constructs a fast search structure from a set of features using the s
struct SavedIndexParams : public IndexParams struct SavedIndexParams : public IndexParams
{ {
SavedIndexParams( cv::String filename ); SavedIndexParams( String filename );
}; };
@ -199,7 +199,7 @@ flann::Index_<T>::save
------------------------------ ------------------------------
Saves the index to a file. Saves the index to a file.
.. ocv:function:: void flann::Index_<T>::save(cv::String filename) .. ocv:function:: void flann::Index_<T>::save(String filename)
:param filename: The file to save the index to :param filename: The file to save the index to

@ -112,7 +112,7 @@ public:
int radiusSearch(const Mat& query, Mat& indices, Mat& dists, int radiusSearch(const Mat& query, Mat& indices, Mat& dists,
DistanceType radius, const ::cvflann::SearchParams& params); DistanceType radius, const ::cvflann::SearchParams& params);
void save(cv::String filename) { nnIndex->save(filename); } void save(String filename) { nnIndex->save(filename); }
int veclen() const { return nnIndex->veclen(); } int veclen() const { return nnIndex->veclen(); }
@ -244,7 +244,7 @@ public:
int radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params); int radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params); int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params);
void save(cv::String filename) void save(String filename)
{ {
if (nnIndex_L1) nnIndex_L1->save(filename); if (nnIndex_L1) nnIndex_L1->save(filename);
if (nnIndex_L2) nnIndex_L2->save(filename); if (nnIndex_L2) nnIndex_L2->save(filename);

@ -73,7 +73,7 @@ hid_t get_hdf5_type<double>() { return H5T_NATIVE_DOUBLE; }
#define CHECK_ERROR(x,y) if ((x)<0) throw FLANNException((y)); #define CHECK_ERROR(x,y) if ((x)<0) throw FLANNException((y));
template<typename T> template<typename T>
void save_to_file(const cvflann::Matrix<T>& dataset, const cv::String& filename, const cv::String& name) void save_to_file(const cvflann::Matrix<T>& dataset, const String& filename, const String& name)
{ {
#if H5Eset_auto_vers == 2 #if H5Eset_auto_vers == 2
@ -125,7 +125,7 @@ void save_to_file(const cvflann::Matrix<T>& dataset, const cv::String& filename,
template<typename T> template<typename T>
void load_from_file(cvflann::Matrix<T>& dataset, const cv::String& filename, const cv::String& name) void load_from_file(cvflann::Matrix<T>& dataset, const String& filename, const String& name)
{ {
herr_t status; herr_t status;
hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT); hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
@ -166,7 +166,7 @@ namespace mpi
* @param name Name of dataset inside file * @param name Name of dataset inside file
*/ */
template<typename T> template<typename T>
void load_from_file(cvflann::Matrix<T>& dataset, const cv::String& filename, const cv::String& name) void load_from_file(cvflann::Matrix<T>& dataset, const String& filename, const String& name)
{ {
MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL; MPI_Info info = MPI_INFO_NULL;

@ -59,20 +59,20 @@ struct CV_EXPORTS IndexParams
IndexParams(); IndexParams();
~IndexParams(); ~IndexParams();
cv::String getString(const cv::String& key, const cv::String& defaultVal=cv::String()) const; String getString(const String& key, const String& defaultVal=String()) const;
int getInt(const cv::String& key, int defaultVal=-1) const; int getInt(const String& key, int defaultVal=-1) const;
double getDouble(const cv::String& key, double defaultVal=-1) const; double getDouble(const String& key, double defaultVal=-1) const;
void setString(const cv::String& key, const cv::String& value); void setString(const String& key, const String& value);
void setInt(const cv::String& key, int value); void setInt(const String& key, int value);
void setDouble(const cv::String& key, double value); void setDouble(const String& key, double value);
void setFloat(const cv::String& key, float value); void setFloat(const String& key, float value);
void setBool(const cv::String& key, bool value); void setBool(const String& key, bool value);
void setAlgorithm(int value); void setAlgorithm(int value);
void getAll(std::vector<cv::String>& names, void getAll(std::vector<String>& names,
std::vector<int>& types, std::vector<int>& types,
std::vector<cv::String>& strValues, std::vector<String>& strValues,
std::vector<double>& numValues) const; std::vector<double>& numValues) const;
void* params; void* params;
@ -119,7 +119,7 @@ struct CV_EXPORTS LshIndexParams : public IndexParams
struct CV_EXPORTS SavedIndexParams : public IndexParams struct CV_EXPORTS SavedIndexParams : public IndexParams
{ {
SavedIndexParams(const cv::String& filename); SavedIndexParams(const String& filename);
}; };
struct CV_EXPORTS SearchParams : public IndexParams struct CV_EXPORTS SearchParams : public IndexParams
@ -142,8 +142,8 @@ public:
OutputArray dists, double radius, int maxResults, OutputArray dists, double radius, int maxResults,
const SearchParams& params=SearchParams()); const SearchParams& params=SearchParams());
CV_WRAP virtual void save(const cv::String& filename) const; CV_WRAP virtual void save(const String& filename) const;
CV_WRAP virtual bool load(InputArray features, const cv::String& filename); CV_WRAP virtual bool load(InputArray features, const String& filename);
CV_WRAP virtual void release(); CV_WRAP virtual void release();
CV_WRAP cvflann::flann_distance_t getDistance() const; CV_WRAP cvflann::flann_distance_t getDistance() const;
CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const; CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const;

@ -26,7 +26,7 @@ IndexParams::IndexParams()
} }
template<typename T> template<typename T>
T getParam(const IndexParams& _p, const cv::String& key, const T& defaultVal=T()) T getParam(const IndexParams& _p, const String& key, const T& defaultVal=T())
{ {
::cvflann::IndexParams& p = get_params(_p); ::cvflann::IndexParams& p = get_params(_p);
::cvflann::IndexParams::const_iterator it = p.find(key); ::cvflann::IndexParams::const_iterator it = p.find(key);
@ -36,49 +36,49 @@ T getParam(const IndexParams& _p, const cv::String& key, const T& defaultVal=T()
} }
template<typename T> template<typename T>
void setParam(IndexParams& _p, const cv::String& key, const T& value) void setParam(IndexParams& _p, const String& key, const T& value)
{ {
::cvflann::IndexParams& p = get_params(_p); ::cvflann::IndexParams& p = get_params(_p);
p[key] = value; p[key] = value;
} }
cv::String IndexParams::getString(const cv::String& key, const cv::String& defaultVal) const String IndexParams::getString(const String& key, const String& defaultVal) const
{ {
return getParam(*this, key, defaultVal); return getParam(*this, key, defaultVal);
} }
int IndexParams::getInt(const cv::String& key, int defaultVal) const int IndexParams::getInt(const String& key, int defaultVal) const
{ {
return getParam(*this, key, defaultVal); return getParam(*this, key, defaultVal);
} }
double IndexParams::getDouble(const cv::String& key, double defaultVal) const double IndexParams::getDouble(const String& key, double defaultVal) const
{ {
return getParam(*this, key, defaultVal); return getParam(*this, key, defaultVal);
} }
void IndexParams::setString(const cv::String& key, const cv::String& value) void IndexParams::setString(const String& key, const String& value)
{ {
setParam(*this, key, value); setParam(*this, key, value);
} }
void IndexParams::setInt(const cv::String& key, int value) void IndexParams::setInt(const String& key, int value)
{ {
setParam(*this, key, value); setParam(*this, key, value);
} }
void IndexParams::setDouble(const cv::String& key, double value) void IndexParams::setDouble(const String& key, double value)
{ {
setParam(*this, key, value); setParam(*this, key, value);
} }
void IndexParams::setFloat(const cv::String& key, float value) void IndexParams::setFloat(const String& key, float value)
{ {
setParam(*this, key, value); setParam(*this, key, value);
} }
void IndexParams::setBool(const cv::String& key, bool value) void IndexParams::setBool(const String& key, bool value)
{ {
setParam(*this, key, value); setParam(*this, key, value);
} }
@ -88,9 +88,9 @@ void IndexParams::setAlgorithm(int value)
setParam(*this, "algorithm", (cvflann::flann_algorithm_t)value); setParam(*this, "algorithm", (cvflann::flann_algorithm_t)value);
} }
void IndexParams::getAll(std::vector<cv::String>& names, void IndexParams::getAll(std::vector<String>& names,
std::vector<int>& types, std::vector<int>& types,
std::vector<cv::String>& strValues, std::vector<String>& strValues,
std::vector<double>& numValues) const std::vector<double>& numValues) const
{ {
names.clear(); names.clear();
@ -106,7 +106,7 @@ void IndexParams::getAll(std::vector<cv::String>& names,
names.push_back(it->first); names.push_back(it->first);
try try
{ {
cv::String val = it->second.cast<cv::String>(); String val = it->second.cast<String>();
types.push_back(CV_USRTYPE1); types.push_back(CV_USRTYPE1);
strValues.push_back(val); strValues.push_back(val);
numValues.push_back(-1); numValues.push_back(-1);
@ -285,9 +285,9 @@ LshIndexParams::LshIndexParams(int table_number, int key_size, int multi_probe_l
p["multi_probe_level"] = multi_probe_level; p["multi_probe_level"] = multi_probe_level;
} }
SavedIndexParams::SavedIndexParams(const cv::String& _filename) SavedIndexParams::SavedIndexParams(const String& _filename)
{ {
cv::String filename = _filename; String filename = _filename;
::cvflann::IndexParams& p = get_params(*this); ::cvflann::IndexParams& p = get_params(*this);
p["algorithm"] = FLANN_INDEX_SAVED; p["algorithm"] = FLANN_INDEX_SAVED;
@ -357,7 +357,7 @@ void Index::build(InputArray _data, const IndexParams& params, flann_distance_t
algo = getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR); algo = getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR);
if( algo == FLANN_INDEX_SAVED ) if( algo == FLANN_INDEX_SAVED )
{ {
load(_data, getParam<cv::String>(params, "filename", cv::String())); load(_data, getParam<String>(params, "filename", String()));
return; return;
} }
@ -654,7 +654,7 @@ template<typename Distance> void saveIndex(const Index* index0, const void* inde
saveIndex_< ::cvflann::Index<Distance> >(index0, index, fout); saveIndex_< ::cvflann::Index<Distance> >(index0, index, fout);
} }
void Index::save(const cv::String& filename) const void Index::save(const String& filename) const
{ {
FILE* fout = fopen(filename.c_str(), "wb"); FILE* fout = fopen(filename.c_str(), "wb");
if (fout == NULL) if (fout == NULL)
@ -720,7 +720,7 @@ bool loadIndex(Index* index0, void*& index, const Mat& data, FILE* fin, const Di
return loadIndex_<Distance, ::cvflann::Index<Distance> >(index0, index, data, fin, dist); return loadIndex_<Distance, ::cvflann::Index<Distance> >(index0, index, data, fin, dist);
} }
bool Index::load(InputArray _data, const cv::String& filename) bool Index::load(InputArray _data, const String& filename)
{ {
Mat data = _data.getMat(); Mat data = _data.getMat();
bool ok = true; bool ok = true;

@ -704,8 +704,8 @@ gpu::VideoWriter_GPU::VideoWriter_GPU
Constructors. Constructors.
.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU() .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU()
.. 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 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 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>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR)
.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& 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. Initializes or reinitializes video writer.
.. 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 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 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>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR) .. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR)
.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) .. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>& 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 int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS
EncoderParams(); EncoderParams();
explicit EncoderParams(const cv::String& configFile); explicit EncoderParams(const String& configFile);
void load(const cv::String& configFile); void load(const String& configFile);
void save(const cv::String& configFile) const; void save(const String& configFile) const;
}; };
@ -810,7 +810,7 @@ gpu::VideoWriter_GPU::EncoderParams::EncoderParams
Constructors. Constructors.
.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams() .. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams()
.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile) .. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const String& configFile)
:param configFile: Config file name. :param configFile: Config file name.
@ -822,7 +822,7 @@ gpu::VideoWriter_GPU::EncoderParams::load
----------------------------------------- -----------------------------------------
Reads parameters from config file. Reads parameters from config file.
.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile) .. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::load(const String& configFile)
:param configFile: Config file name. :param configFile: Config file name.
@ -832,7 +832,7 @@ gpu::VideoWriter_GPU::EncoderParams::save
----------------------------------------- -----------------------------------------
Saves parameters to config file. Saves parameters to config file.
.. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::save(const cv::String& configFile) const .. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::save(const String& configFile) const
:param configFile: Config file name. :param configFile: Config file name.
@ -982,7 +982,7 @@ gpu::VideoReader_GPU::VideoReader_GPU
Constructors. Constructors.
.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU() .. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU()
.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::String& filename) .. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const String& filename)
.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr<VideoSource>& source) .. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr<VideoSource>& source)
:param filename: Name of the input video file. :param filename: Name of the input video file.
@ -997,7 +997,7 @@ gpu::VideoReader_GPU::open
-------------------------- --------------------------
Initializes or reinitializes video reader. Initializes or reinitializes video reader.
.. ocv:function:: void gpu::VideoReader_GPU::open(const cv::String& filename) .. ocv:function:: void gpu::VideoReader_GPU::open(const String& filename)
.. ocv:function:: void gpu::VideoReader_GPU::open(const cv::Ptr<VideoSource>& source) .. ocv:function:: void gpu::VideoReader_GPU::open(const cv::Ptr<VideoSource>& 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. 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.

@ -1384,11 +1384,11 @@ class CV_EXPORTS CascadeClassifier_GPU
{ {
public: public:
CascadeClassifier_GPU(); CascadeClassifier_GPU();
CascadeClassifier_GPU(const cv::String& filename); CascadeClassifier_GPU(const String& filename);
~CascadeClassifier_GPU(); ~CascadeClassifier_GPU();
bool empty() const; bool empty() const;
bool load(const cv::String& filename); bool load(const String& filename);
void release(); void release();
/* returns number of detected objects */ /* returns number of detected objects */
@ -2170,15 +2170,15 @@ public:
}; };
VideoWriter_GPU(); VideoWriter_GPU();
VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const 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 String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
~VideoWriter_GPU(); ~VideoWriter_GPU();
// all methods throws cv::Exception if error occurs // all methods throws cv::Exception if error occurs
void open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); void open(const 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 String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
void open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); void open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
void open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); void open(const cv::Ptr<EncoderCallBack>& encoderCallback, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
@ -2210,10 +2210,10 @@ public:
int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS
EncoderParams(); EncoderParams();
explicit EncoderParams(const cv::String& configFile); explicit EncoderParams(const String& configFile);
void load(const cv::String& configFile); void load(const String& configFile);
void save(const cv::String& configFile) const; void save(const String& configFile) const;
}; };
EncoderParams getParams() const; EncoderParams getParams() const;
@ -2301,12 +2301,12 @@ public:
class VideoSource; class VideoSource;
VideoReader_GPU(); VideoReader_GPU();
explicit VideoReader_GPU(const cv::String& filename); explicit VideoReader_GPU(const String& filename);
explicit VideoReader_GPU(const cv::Ptr<VideoSource>& source); explicit VideoReader_GPU(const cv::Ptr<VideoSource>& source);
~VideoReader_GPU(); ~VideoReader_GPU();
void open(const cv::String& filename); void open(const String& filename);
void open(const cv::Ptr<VideoSource>& source); void open(const cv::Ptr<VideoSource>& source);
bool isOpened() const; bool isOpened() const;

@ -50,10 +50,10 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU() { throw_nogpu(); } cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU() { throw_nogpu(); }
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::String&) { throw_nogpu(); } cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const String&) { throw_nogpu(); }
cv::gpu::CascadeClassifier_GPU::~CascadeClassifier_GPU() { 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::empty() const { throw_nogpu(); return true; }
bool cv::gpu::CascadeClassifier_GPU::load(const cv::String&) { throw_nogpu(); return true; } bool cv::gpu::CascadeClassifier_GPU::load(const String&) { throw_nogpu(); return true; }
Size cv::gpu::CascadeClassifier_GPU::getClassifierSize() const { throw_nogpu(); return Size();} Size cv::gpu::CascadeClassifier_GPU::getClassifierSize() const { throw_nogpu(); return Size();}
void cv::gpu::CascadeClassifier_GPU::release() { throw_nogpu(); } void cv::gpu::CascadeClassifier_GPU::release() { throw_nogpu(); }
int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat&, GpuMat&, double, int, Size) {throw_nogpu(); return -1;} 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; bool findLargestObject, bool visualizeInPlace, cv::Size ncvMinSize, cv::Size maxObjectSize) = 0;
virtual cv::Size getClassifierCvSize() const = 0; virtual cv::Size getClassifierCvSize() const = 0;
virtual bool read(const cv::String& classifierAsXml) = 0; virtual bool read(const String& classifierAsXml) = 0;
}; };
struct cv::gpu::CascadeClassifier_GPU::HaarCascade : cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl struct cv::gpu::CascadeClassifier_GPU::HaarCascade : cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl
@ -82,7 +82,7 @@ public:
ncvSetDebugOutputHandler(NCVDebugOutputHandler); ncvSetDebugOutputHandler(NCVDebugOutputHandler);
} }
bool read(const cv::String& filename) bool read(const String& filename)
{ {
ncvSafeCall( load(filename) ); ncvSafeCall( load(filename) );
return true; return true;
@ -169,9 +169,9 @@ public:
cv::Size getClassifierCvSize() const { return cv::Size(haar.ClassifierSize.width, haar.ClassifierSize.height); } cv::Size getClassifierCvSize() const { return cv::Size(haar.ClassifierSize.width, haar.ClassifierSize.height); }
private: private:
static void NCVDebugOutputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } static void NCVDebugOutputHandler(const String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
NCVStatus load(const cv::String& classifierFile) NCVStatus load(const String& classifierFile)
{ {
int devId = cv::gpu::getDevice(); int devId = cv::gpu::getDevice();
ncvAssertCUDAReturn(cudaGetDeviceProperties(&devProp, devId), NCV_CUDA_ERROR); ncvAssertCUDAReturn(cudaGetDeviceProperties(&devProp, devId), NCV_CUDA_ERROR);
@ -458,7 +458,7 @@ public:
virtual cv::Size getClassifierCvSize() const { return NxM; } virtual cv::Size getClassifierCvSize() const { return NxM; }
bool read(const cv::String& classifierAsXml) bool read(const String& classifierAsXml)
{ {
FileStorage fs(classifierAsXml, FileStorage::READ); FileStorage fs(classifierAsXml, FileStorage::READ);
return fs.isOpened() ? read(fs.getFirstTopLevelNode()) : false; return fs.isOpened() ? read(fs.getFirstTopLevelNode()) : false;
@ -512,10 +512,10 @@ private:
const char *GPU_CC_FEATURES = "features"; const char *GPU_CC_FEATURES = "features";
const char *GPU_CC_RECT = "rect"; const char *GPU_CC_RECT = "rect";
cv::String stageTypeStr = (cv::String)root[GPU_CC_STAGE_TYPE]; String stageTypeStr = (String)root[GPU_CC_STAGE_TYPE];
CV_Assert(stageTypeStr == GPU_CC_BOOST); CV_Assert(stageTypeStr == GPU_CC_BOOST);
cv::String featureTypeStr = (cv::String)root[GPU_CC_FEATURE_TYPE]; String featureTypeStr = (String)root[GPU_CC_FEATURE_TYPE];
CV_Assert(featureTypeStr == GPU_CC_LBP); CV_Assert(featureTypeStr == GPU_CC_LBP);
NxM.width = (int)root[GPU_CC_WIDTH]; NxM.width = (int)root[GPU_CC_WIDTH];
@ -662,7 +662,7 @@ private:
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU() cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU()
: findLargestObject(false), visualizeInPlace(false), impl(0) {} : findLargestObject(false), visualizeInPlace(false), impl(0) {}
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::String& filename) cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const String& filename)
: findLargestObject(false), visualizeInPlace(false), impl(0) { load(filename); } : findLargestObject(false), visualizeInPlace(false), impl(0) { load(filename); }
cv::gpu::CascadeClassifier_GPU::~CascadeClassifier_GPU() { release(); } 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); return impl->process(image, objectsBuf, (float)scaleFactor, minNeighbors, findLargestObject, visualizeInPlace, minSize, maxObjectSize);
} }
bool cv::gpu::CascadeClassifier_GPU::load(const cv::String& filename) bool cv::gpu::CascadeClassifier_GPU::load(const String& filename)
{ {
release(); release();
cv::String fext = filename.substr(filename.find_last_of(".") + 1); String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
if (fext == "nvbin") if (fext == "nvbin")
@ -710,7 +710,7 @@ bool cv::gpu::CascadeClassifier_GPU::load(const cv::String& filename)
} }
const char *GPU_CC_LBP = "LBP"; const char *GPU_CC_LBP = "LBP";
cv::String featureTypeStr = (cv::String)fs.getFirstTopLevelNode()["featureType"]; String featureTypeStr = (String)fs.getFirstTopLevelNode()["featureType"];
if (featureTypeStr == GPU_CC_LBP) if (featureTypeStr == GPU_CC_LBP)
impl = new LbpCascade(); impl = new LbpCascade();
else else
@ -759,7 +759,7 @@ void groupRectangles(std::vector<NcvRect32u> &hypotheses, int groupThreshold, do
hypotheses.resize(rects.size()); hypotheses.resize(rects.size());
} }
NCVStatus loadFromXML(const cv::String &filename, NCVStatus loadFromXML(const String &filename,
HaarClassifierCascadeDescriptor &haar, HaarClassifierCascadeDescriptor &haar,
std::vector<HaarStage64> &haarStages, std::vector<HaarStage64> &haarStages,
std::vector<HaarClassifierNode128> &haarClassifierNodes, std::vector<HaarClassifierNode128> &haarClassifierNodes,

@ -51,7 +51,7 @@ namespace
struct ErrorEntry struct ErrorEntry
{ {
int code; int code;
cv::String str; String str;
}; };
class ErrorEntryComparer class ErrorEntryComparer
@ -65,11 +65,11 @@ namespace
int code_; int code_;
}; };
cv::String getErrorString(int code, const ErrorEntry* errors, size_t n) String getErrorString(int code, const ErrorEntry* errors, size_t n)
{ {
size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors; size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors;
const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code"); const String& msg = (idx != n) ? errors[idx].str : String("Unknown error code");
std::ostringstream ostr; std::ostringstream ostr;
ostr << msg << " [Code = " << code << "]"; ostr << msg << " [Code = " << code << "]";
@ -131,7 +131,7 @@ namespace
const size_t cu_errors_num = sizeof(cu_errors) / sizeof(cu_errors[0]); const size_t cu_errors_num = sizeof(cu_errors) / sizeof(cu_errors[0]);
} }
cv::String cv::gpu::detail::cuGetErrString(CUresult res) String cv::gpu::detail::cuGetErrString(CUresult res)
{ {
return getErrorString(res, cu_errors, cu_errors_num); return getErrorString(res, cu_errors, cu_errors_num);
} }

@ -50,7 +50,7 @@
namespace cv { namespace gpu { namespace cv { namespace gpu {
namespace detail namespace detail
{ {
cv::String cuGetErrString(CUresult res); String cuGetErrString(CUresult res);
inline void cuSafeCall_impl(CUresult res, const char* file, int line) inline void cuSafeCall_impl(CUresult res, const char* file, int line)
{ {

@ -3,7 +3,7 @@
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID) #if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const cv::String& fname) cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const String& fname)
{ {
CUVIDSOURCEPARAMS params; CUVIDSOURCEPARAMS params;
std::memset(&params, 0, sizeof(CUVIDSOURCEPARAMS)); std::memset(&params, 0, sizeof(CUVIDSOURCEPARAMS));

@ -54,7 +54,7 @@ namespace cv { namespace gpu
class CuvidVideoSource : public VideoReader_GPU::VideoSource class CuvidVideoSource : public VideoReader_GPU::VideoSource
{ {
public: public:
explicit CuvidVideoSource(const cv::String& fname); explicit CuvidVideoSource(const String& fname);
~CuvidVideoSource() { cuvidDestroyVideoSource(videoSource_); } ~CuvidVideoSource() { cuvidDestroyVideoSource(videoSource_); }
VideoReader_GPU::FormatInfo format() const; VideoReader_GPU::FormatInfo format() const;

@ -54,7 +54,7 @@ namespace
struct ErrorEntry struct ErrorEntry
{ {
int code; int code;
cv::String str; String str;
}; };
struct ErrorEntryComparer struct ErrorEntryComparer
@ -64,11 +64,11 @@ namespace
bool operator()(const ErrorEntry& e) const { return e.code == code; } bool operator()(const ErrorEntry& e) const { return e.code == code; }
}; };
cv::String getErrorString(int code, const ErrorEntry* errors, size_t n) String getErrorString(int code, const ErrorEntry* errors, size_t n)
{ {
size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors; size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors;
const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code"); const String& msg = (idx != n) ? errors[idx].str : String("Unknown error code");
std::ostringstream ostr; std::ostringstream ostr;
ostr << msg << " [Code = " << code << "]"; ostr << msg << " [Code = " << code << "]";
@ -221,25 +221,25 @@ namespace cv
{ {
void nppError(int code, const char *file, const int line, const char *func) void nppError(int code, const char *file, const int line, const char *func)
{ {
cv::String msg = getErrorString(code, npp_errors, npp_error_num); String msg = getErrorString(code, npp_errors, npp_error_num);
cv::gpu::error(msg.c_str(), file, line, func); cv::gpu::error(msg.c_str(), file, line, func);
} }
void ncvError(int code, const char *file, const int line, const char *func) void ncvError(int code, const char *file, const int line, const char *func)
{ {
cv::String msg = getErrorString(code, ncv_errors, ncv_error_num); String msg = getErrorString(code, ncv_errors, ncv_error_num);
cv::gpu::error(msg.c_str(), file, line, func); cv::gpu::error(msg.c_str(), file, line, func);
} }
void cufftError(int code, const char *file, const int line, const char *func) void cufftError(int code, const char *file, const int line, const char *func)
{ {
cv::String msg = getErrorString(code, cufft_errors, cufft_error_num); String msg = getErrorString(code, cufft_errors, cufft_error_num);
cv::gpu::error(msg.c_str(), file, line, func); cv::gpu::error(msg.c_str(), file, line, func);
} }
void cublasError(int code, const char *file, const int line, const char *func) void cublasError(int code, const char *file, const int line, const char *func)
{ {
cv::String msg = getErrorString(code, cublas_errors, cublas_error_num); String msg = getErrorString(code, cublas_errors, cublas_error_num);
cv::gpu::error(msg.c_str(), file, line, func); cv::gpu::error(msg.c_str(), file, line, func);
} }
} }

@ -96,7 +96,7 @@ namespace
} }
} }
cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const cv::String& fname) : cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const String& fname) :
stream_(0) stream_(0)
{ {
CV_Assert( init_MediaStream_FFMPEG() ); CV_Assert( init_MediaStream_FFMPEG() );

@ -57,7 +57,7 @@ namespace cv { namespace gpu
class FFmpegVideoSource : public VideoReader_GPU::VideoSource class FFmpegVideoSource : public VideoReader_GPU::VideoSource
{ {
public: public:
FFmpegVideoSource(const cv::String& fname); FFmpegVideoSource(const String& fname);
~FFmpegVideoSource(); ~FFmpegVideoSource();
VideoReader_GPU::FormatInfo format() const; VideoReader_GPU::FormatInfo format() const;

@ -2099,7 +2099,7 @@ NCVStatus ncvGrowDetectionsVector_host(NCVVector<Ncv32u> &pixelMask,
} }
NCVStatus loadFromXML(const cv::String &filename, NCVStatus loadFromXML(const String &filename,
HaarClassifierCascadeDescriptor &haar, HaarClassifierCascadeDescriptor &haar,
std::vector<HaarStage64> &haarStages, std::vector<HaarStage64> &haarStages,
std::vector<HaarClassifierNode128> &haarClassifierNodes, std::vector<HaarClassifierNode128> &haarClassifierNodes,
@ -2110,7 +2110,7 @@ NCVStatus loadFromXML(const cv::String &filename,
#define NVBIN_HAAR_VERSION 0x1 #define NVBIN_HAAR_VERSION 0x1
static NCVStatus loadFromNVBIN(const cv::String &filename, static NCVStatus loadFromNVBIN(const String &filename,
HaarClassifierCascadeDescriptor &haar, HaarClassifierCascadeDescriptor &haar,
std::vector<HaarStage64> &haarStages, std::vector<HaarStage64> &haarStages,
std::vector<HaarClassifierNode128> &haarClassifierNodes, std::vector<HaarClassifierNode128> &haarClassifierNodes,
@ -2174,13 +2174,13 @@ static NCVStatus loadFromNVBIN(const cv::String &filename,
} }
NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages, NCVStatus ncvHaarGetClassifierSize(const String &filename, Ncv32u &numStages,
Ncv32u &numNodes, Ncv32u &numFeatures) Ncv32u &numNodes, Ncv32u &numFeatures)
{ {
size_t readCount; size_t readCount;
NCVStatus ncvStat; NCVStatus ncvStat;
cv::String fext = filename.substr(filename.find_last_of(".") + 1); String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
if (fext == "nvbin") if (fext == "nvbin")
@ -2226,7 +2226,7 @@ NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages
} }
NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename, NCVStatus ncvHaarLoadFromFile_host(const String &filename,
HaarClassifierCascadeDescriptor &haar, HaarClassifierCascadeDescriptor &haar,
NCVVector<HaarStage64> &h_HaarStages, NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes, NCVVector<HaarClassifierNode128> &h_HaarNodes,
@ -2238,7 +2238,7 @@ NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename,
NCVStatus ncvStat; NCVStatus ncvStat;
cv::String fext = filename.substr(filename.find_last_of(".") + 1); String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
std::vector<HaarStage64> haarStages; std::vector<HaarStage64> haarStages;
@ -2272,7 +2272,7 @@ NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename,
} }
NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename, NCVStatus ncvHaarStoreNVBIN_host(const String &filename,
HaarClassifierCascadeDescriptor haar, HaarClassifierCascadeDescriptor haar,
NCVVector<HaarStage64> &h_HaarStages, NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes, NCVVector<HaarClassifierNode128> &h_HaarNodes,

@ -438,18 +438,18 @@ NCV_EXPORTS NCVStatus ncvGrowDetectionsVector_host(NCVVector<Ncv32u> &pixelMask,
Ncv32f curScale); Ncv32f curScale);
NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages, NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const String &filename, Ncv32u &numStages,
Ncv32u &numNodes, Ncv32u &numFeatures); Ncv32u &numNodes, Ncv32u &numFeatures);
NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename, NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const String &filename,
HaarClassifierCascadeDescriptor &haar, HaarClassifierCascadeDescriptor &haar,
NCVVector<HaarStage64> &h_HaarStages, NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes, NCVVector<HaarClassifierNode128> &h_HaarNodes,
NCVVector<HaarFeature64> &h_HaarFeatures); NCVVector<HaarFeature64> &h_HaarFeatures);
NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename, NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const String &filename,
HaarClassifierCascadeDescriptor haar, HaarClassifierCascadeDescriptor haar,
NCVVector<HaarStage64> &h_HaarStages, NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes, NCVVector<HaarClassifierNode128> &h_HaarNodes,

@ -52,7 +52,7 @@
//============================================================================== //==============================================================================
static void stdDebugOutput(const cv::String &msg) static void stdDebugOutput(const String &msg)
{ {
std::cout << msg; std::cout << msg;
} }
@ -61,7 +61,7 @@ static void stdDebugOutput(const cv::String &msg)
static NCVDebugOutputHandler *debugOutputHandler = stdDebugOutput; static NCVDebugOutputHandler *debugOutputHandler = stdDebugOutput;
void ncvDebugOutput(const cv::String &msg) void ncvDebugOutput(const String &msg)
{ {
debugOutputHandler(msg); debugOutputHandler(msg);
} }

@ -243,10 +243,10 @@ const Ncv32u K_LOG2_WARP_SIZE = 5;
//============================================================================== //==============================================================================
NCV_EXPORTS void ncvDebugOutput(const cv::String &msg); NCV_EXPORTS void ncvDebugOutput(const String &msg);
typedef void NCVDebugOutputHandler(const cv::String &msg); typedef void NCVDebugOutputHandler(const String &msg);
NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func); NCV_EXPORTS void ncvSetDebugOutputHandler(NCVDebugOutputHandler* func);

@ -68,7 +68,7 @@ namespace
namespace namespace
{ {
static void outputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } static void outputHandler(const 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) void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& frame1, GpuMat& u, GpuMat& v, Stream& s)

@ -49,10 +49,10 @@ class cv::gpu::VideoReader_GPU::Impl
}; };
cv::gpu::VideoReader_GPU::VideoReader_GPU() { throw_nogpu(); } cv::gpu::VideoReader_GPU::VideoReader_GPU() { throw_nogpu(); }
cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::String&) { throw_nogpu(); } cv::gpu::VideoReader_GPU::VideoReader_GPU(const String&) { throw_nogpu(); }
cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr<VideoSource>&) { throw_nogpu(); } cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr<VideoSource>&) { throw_nogpu(); }
cv::gpu::VideoReader_GPU::~VideoReader_GPU() { } cv::gpu::VideoReader_GPU::~VideoReader_GPU() { }
void cv::gpu::VideoReader_GPU::open(const cv::String&) { throw_nogpu(); } void cv::gpu::VideoReader_GPU::open(const String&) { throw_nogpu(); }
void cv::gpu::VideoReader_GPU::open(const cv::Ptr<VideoSource>&) { throw_nogpu(); } void cv::gpu::VideoReader_GPU::open(const cv::Ptr<VideoSource>&) { throw_nogpu(); }
bool cv::gpu::VideoReader_GPU::isOpened() const { return false; } bool cv::gpu::VideoReader_GPU::isOpened() const { return false; }
void cv::gpu::VideoReader_GPU::close() { } void cv::gpu::VideoReader_GPU::close() { }
@ -294,7 +294,7 @@ cv::gpu::VideoReader_GPU::VideoReader_GPU()
{ {
} }
cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::String& filename) cv::gpu::VideoReader_GPU::VideoReader_GPU(const String& filename)
{ {
open(filename); open(filename);
} }
@ -309,7 +309,7 @@ cv::gpu::VideoReader_GPU::~VideoReader_GPU()
close(); close();
} }
void cv::gpu::VideoReader_GPU::open(const cv::String& filename) void cv::gpu::VideoReader_GPU::open(const String& filename)
{ {
CV_Assert( !filename.empty() ); CV_Assert( !filename.empty() );

@ -49,13 +49,13 @@ class cv::gpu::VideoWriter_GPU::Impl
}; };
cv::gpu::VideoWriter_GPU::VideoWriter_GPU() { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU() { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const 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 String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::~VideoWriter_GPU() {} cv::gpu::VideoWriter_GPU::~VideoWriter_GPU() {}
void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const 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 String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
bool cv::gpu::VideoWriter_GPU::isOpened() const { return false; } 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 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() { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String&) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const String&) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String&) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::EncoderParams::load(const String&) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String&) const { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::EncoderParams::save(const String&) const { throw_nogpu(); }
#else // !defined HAVE_CUDA || !defined WIN32 #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 class EncoderCallBackFFMPEG : public cv::gpu::VideoWriter_GPU::EncoderCallBack
{ {
public: public:
EncoderCallBackFFMPEG(const cv::String& fileName, cv::Size frameSize, double fps); EncoderCallBackFFMPEG(const String& fileName, cv::Size frameSize, double fps);
~EncoderCallBackFFMPEG(); ~EncoderCallBackFFMPEG();
unsigned char* acquireBitStream(int* bufferSize); unsigned char* acquireBitStream(int* bufferSize);
@ -799,7 +799,7 @@ namespace
} }
} }
EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const cv::String& fileName, cv::Size frameSize, double fps) : EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const String& fileName, cv::Size frameSize, double fps) :
stream_(0), isKeyFrame_(false) stream_(0), isKeyFrame_(false)
{ {
int buf_size = std::max(frameSize.area() * 4, 1024 * 1024); 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 cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format) cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const String& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
{ {
open(fileName, frameSize, fps, format); open(fileName, frameSize, fps, format);
} }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{ {
open(fileName, frameSize, fps, params, format); open(fileName, frameSize, fps, params, format);
} }
@ -868,14 +868,14 @@ cv::gpu::VideoWriter_GPU::~VideoWriter_GPU()
close(); close();
} }
void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format) void cv::gpu::VideoWriter_GPU::open(const String& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
{ {
close(); close();
cv::Ptr<EncoderCallBack> encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps)); cv::Ptr<EncoderCallBack> encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps));
open(encoderCallback, frameSize, fps, format); open(encoderCallback, frameSize, fps, format);
} }
void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) void cv::gpu::VideoWriter_GPU::open(const String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{ {
close(); close();
cv::Ptr<EncoderCallBack> encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps)); cv::Ptr<EncoderCallBack> encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps));
@ -944,12 +944,12 @@ cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams()
DisableSPSPPS = 0; DisableSPSPPS = 0;
} }
cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile) cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const String& configFile)
{ {
load(configFile); load(configFile);
} }
void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile) void cv::gpu::VideoWriter_GPU::EncoderParams::load(const String& configFile)
{ {
cv::FileStorage fs(configFile, cv::FileStorage::READ); cv::FileStorage fs(configFile, cv::FileStorage::READ);
CV_Assert( fs.isOpened() ); CV_Assert( fs.isOpened() );
@ -975,7 +975,7 @@ void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile)
cv::read(fs["DisableSPSPPS" ], DisableSPSPPS, 0); cv::read(fs["DisableSPSPPS" ], DisableSPSPPS, 0);
} }
void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String& configFile) const void cv::gpu::VideoWriter_GPU::EncoderParams::save(const String& configFile) const
{ {
cv::FileStorage fs(configFile, cv::FileStorage::WRITE); cv::FileStorage fs(configFile, cv::FileStorage::WRITE);
CV_Assert( fs.isOpened() ); CV_Assert( fs.isOpened() );

@ -67,21 +67,21 @@ enum {
WND_PROP_OPENGL = CV_WND_PROP_OPENGL // opengl support WND_PROP_OPENGL = CV_WND_PROP_OPENGL // opengl support
}; };
CV_EXPORTS_W void namedWindow(const cv::String& winname, int flags = WINDOW_AUTOSIZE); CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
CV_EXPORTS_W void destroyWindow(const cv::String& winname); CV_EXPORTS_W void destroyWindow(const String& winname);
CV_EXPORTS_W void destroyAllWindows(); CV_EXPORTS_W void destroyAllWindows();
CV_EXPORTS_W int startWindowThread(); CV_EXPORTS_W int startWindowThread();
CV_EXPORTS_W int waitKey(int delay = 0); CV_EXPORTS_W int waitKey(int delay = 0);
CV_EXPORTS_W void imshow(const cv::String& winname, InputArray mat); CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
CV_EXPORTS_W void resizeWindow(const cv::String& winname, int width, int height); CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
CV_EXPORTS_W void moveWindow(const cv::String& winname, int x, int y); CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
CV_EXPORTS_W void setWindowProperty(const cv::String& winname, int prop_id, double prop_value);//YV CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);//YV
CV_EXPORTS_W double getWindowProperty(const cv::String& winname, int prop_id);//YV CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);//YV
enum enum
{ {
@ -110,45 +110,45 @@ enum
typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata); typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
//! assigns callback for mouse events //! assigns callback for mouse events
CV_EXPORTS void setMouseCallback(const cv::String& winname, MouseCallback onMouse, void* userdata = 0); CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata); typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
CV_EXPORTS int createTrackbar(const cv::String& trackbarname, const cv::String& winname, CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
int* value, int count, int* value, int count,
TrackbarCallback onChange = 0, TrackbarCallback onChange = 0,
void* userdata = 0); void* userdata = 0);
CV_EXPORTS_W int getTrackbarPos(const cv::String& trackbarname, const cv::String& winname); CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname);
CV_EXPORTS_W void setTrackbarPos(const cv::String& trackbarname, const cv::String& winname, int pos); CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos);
// OpenGL support // OpenGL support
typedef void (*OpenGlDrawCallback)(void* userdata); typedef void (*OpenGlDrawCallback)(void* userdata);
CV_EXPORTS void setOpenGlDrawCallback(const cv::String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0); CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
CV_EXPORTS void setOpenGlContext(const cv::String& winname); CV_EXPORTS void setOpenGlContext(const String& winname);
CV_EXPORTS void updateWindow(const cv::String& winname); CV_EXPORTS void updateWindow(const String& winname);
//Only for Qt //Only for Qt
CV_EXPORTS CvFont fontQt(const cv::String& nameFont, int pointSize=-1, CV_EXPORTS CvFont fontQt(const String& nameFont, int pointSize=-1,
Scalar color=Scalar::all(0), int weight=CV_FONT_NORMAL, Scalar color=Scalar::all(0), int weight=CV_FONT_NORMAL,
int style=CV_STYLE_NORMAL, int spacing=0); int style=CV_STYLE_NORMAL, int spacing=0);
CV_EXPORTS void addText( const Mat& img, const cv::String& text, Point org, CvFont font); CV_EXPORTS void addText( const Mat& img, const String& text, Point org, CvFont font);
CV_EXPORTS void displayOverlay(const cv::String& winname, const cv::String& text, int delayms CV_DEFAULT(0)); CV_EXPORTS void displayOverlay(const String& winname, const String& text, int delayms CV_DEFAULT(0));
CV_EXPORTS void displayStatusBar(const cv::String& winname, const cv::String& text, int delayms CV_DEFAULT(0)); CV_EXPORTS void displayStatusBar(const String& winname, const String& text, int delayms CV_DEFAULT(0));
CV_EXPORTS void saveWindowParameters(const cv::String& windowName); CV_EXPORTS void saveWindowParameters(const String& windowName);
CV_EXPORTS void loadWindowParameters(const cv::String& windowName); CV_EXPORTS void loadWindowParameters(const String& windowName);
CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]); CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
CV_EXPORTS void stopLoop(); CV_EXPORTS void stopLoop();
typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata); typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
CV_EXPORTS int createButton( const cv::String& bar_name, ButtonCallback on_change, CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
void* userdata=NULL, int type=CV_PUSH_BUTTON, void* userdata=NULL, int type=CV_PUSH_BUTTON,
bool initial_button_state=0); bool initial_button_state=0);
@ -182,12 +182,12 @@ enum
IMWRITE_PXM_BINARY =32 IMWRITE_PXM_BINARY =32
}; };
CV_EXPORTS_W Mat imread( const cv::String& filename, int flags=1 ); CV_EXPORTS_W Mat imread( const String& filename, int flags=1 );
CV_EXPORTS_W bool imwrite( const cv::String& filename, InputArray img, CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
const std::vector<int>& params=std::vector<int>()); const std::vector<int>& params=std::vector<int>());
CV_EXPORTS_W Mat imdecode( InputArray buf, int flags ); CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst ); CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst );
CV_EXPORTS_W bool imencode( const cv::String& ext, InputArray img, CV_EXPORTS_W bool imencode( const String& ext, InputArray img,
CV_OUT std::vector<uchar>& buf, CV_OUT std::vector<uchar>& buf,
const std::vector<int>& params=std::vector<int>()); const std::vector<int>& params=std::vector<int>());
@ -200,11 +200,11 @@ class CV_EXPORTS_W VideoCapture
{ {
public: public:
CV_WRAP VideoCapture(); CV_WRAP VideoCapture();
CV_WRAP VideoCapture(const cv::String& filename); CV_WRAP VideoCapture(const String& filename);
CV_WRAP VideoCapture(int device); CV_WRAP VideoCapture(int device);
virtual ~VideoCapture(); virtual ~VideoCapture();
CV_WRAP virtual bool open(const cv::String& filename); CV_WRAP virtual bool open(const String& filename);
CV_WRAP virtual bool open(int device); CV_WRAP virtual bool open(int device);
CV_WRAP virtual bool isOpened() const; CV_WRAP virtual bool isOpened() const;
CV_WRAP virtual void release(); CV_WRAP virtual void release();
@ -226,11 +226,11 @@ class CV_EXPORTS_W VideoWriter
{ {
public: public:
CV_WRAP VideoWriter(); CV_WRAP VideoWriter();
CV_WRAP VideoWriter(const cv::String& filename, int fourcc, double fps, CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,
Size frameSize, bool isColor=true); Size frameSize, bool isColor=true);
virtual ~VideoWriter(); virtual ~VideoWriter();
CV_WRAP virtual bool open(const cv::String& filename, int fourcc, double fps, CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,
Size frameSize, bool isColor=true); Size frameSize, bool isColor=true);
CV_WRAP virtual bool isOpened() const; CV_WRAP virtual bool isOpened() const;
CV_WRAP virtual void release(); CV_WRAP virtual void release();

@ -110,7 +110,7 @@ void RBaseStream::readBlock()
} }
bool RBaseStream::open( const cv::String& filename ) bool RBaseStream::open( const String& filename )
{ {
close(); close();
allocate(); allocate();
@ -388,7 +388,7 @@ void WBaseStream::writeBlock()
} }
bool WBaseStream::open( const cv::String& filename ) bool WBaseStream::open( const String& filename )
{ {
close(); close();
allocate(); allocate();

@ -66,7 +66,7 @@ public:
RBaseStream(); RBaseStream();
virtual ~RBaseStream(); virtual ~RBaseStream();
virtual bool open( const cv::String& filename ); virtual bool open( const String& filename );
virtual bool open( const Mat& buf ); virtual bool open( const Mat& buf );
virtual void close(); virtual void close();
bool isOpened(); bool isOpened();
@ -123,7 +123,7 @@ public:
WBaseStream(); WBaseStream();
virtual ~WBaseStream(); virtual ~WBaseStream();
virtual bool open( const cv::String& filename ); virtual bool open( const String& filename );
virtual bool open( std::vector<uchar>& buf ); virtual bool open( std::vector<uchar>& buf );
virtual void close(); virtual void close();
bool isOpened(); bool isOpened();

@ -445,7 +445,7 @@ namespace cv
VideoCapture::VideoCapture() VideoCapture::VideoCapture()
{} {}
VideoCapture::VideoCapture(const cv::String& filename) VideoCapture::VideoCapture(const String& filename)
{ {
open(filename); open(filename);
} }
@ -460,7 +460,7 @@ VideoCapture::~VideoCapture()
cap.release(); cap.release();
} }
bool VideoCapture::open(const cv::String& filename) bool VideoCapture::open(const String& filename)
{ {
if (!isOpened()) if (!isOpened())
cap = cvCreateFileCapture(filename.c_str()); cap = cvCreateFileCapture(filename.c_str());
@ -532,7 +532,7 @@ double VideoCapture::get(int propId)
VideoWriter::VideoWriter() VideoWriter::VideoWriter()
{} {}
VideoWriter::VideoWriter(const cv::String& filename, int fourcc, double fps, Size frameSize, bool isColor) VideoWriter::VideoWriter(const String& filename, int fourcc, double fps, Size frameSize, bool isColor)
{ {
open(filename, fourcc, fps, frameSize, isColor); open(filename, fourcc, fps, frameSize, isColor);
} }
@ -547,7 +547,7 @@ VideoWriter::~VideoWriter()
release(); release();
} }
bool VideoWriter::open(const cv::String& filename, int fourcc, double fps, Size frameSize, bool isColor) bool VideoWriter::open(const String& filename, int fourcc, double fps, Size frameSize, bool isColor)
{ {
writer = cvCreateVideoWriter(filename.c_str(), fourcc, fps, frameSize, isColor); writer = cvCreateVideoWriter(filename.c_str(), fourcc, fps, frameSize, isColor);
return isOpened(); return isOpened();

@ -54,7 +54,7 @@ BaseImageDecoder::BaseImageDecoder()
m_buf_supported = false; m_buf_supported = false;
} }
bool BaseImageDecoder::setSource( const cv::String& filename ) bool BaseImageDecoder::setSource( const String& filename )
{ {
m_filename = filename; m_filename = filename;
m_buf.release(); m_buf.release();
@ -65,7 +65,7 @@ bool BaseImageDecoder::setSource( const Mat& buf )
{ {
if( !m_buf_supported ) if( !m_buf_supported )
return false; return false;
m_filename = cv::String(); m_filename = String();
m_buf = buf; m_buf = buf;
return true; return true;
} }
@ -75,7 +75,7 @@ size_t BaseImageDecoder::signatureLength() const
return m_signature.size(); return m_signature.size();
} }
bool BaseImageDecoder::checkSignature( const cv::String& signature ) const bool BaseImageDecoder::checkSignature( const String& signature ) const
{ {
size_t len = signatureLength(); size_t len = signatureLength();
return signature.size() >= len && memcmp( signature.c_str(), m_signature.c_str(), len ) == 0; return signature.size() >= len && memcmp( signature.c_str(), m_signature.c_str(), len ) == 0;
@ -96,12 +96,12 @@ bool BaseImageEncoder::isFormatSupported( int depth ) const
return depth == CV_8U; return depth == CV_8U;
} }
cv::String BaseImageEncoder::getDescription() const String BaseImageEncoder::getDescription() const
{ {
return m_description; return m_description;
} }
bool BaseImageEncoder::setDestination( const cv::String& filename ) bool BaseImageEncoder::setDestination( const String& filename )
{ {
m_filename = filename; m_filename = filename;
m_buf = 0; m_buf = 0;
@ -114,7 +114,7 @@ bool BaseImageEncoder::setDestination( std::vector<uchar>& buf )
return false; return false;
m_buf = &buf; m_buf = &buf;
m_buf->clear(); m_buf->clear();
m_filename = cv::String(); m_filename = String();
return true; return true;
} }
@ -127,7 +127,7 @@ void BaseImageEncoder::throwOnEror() const
{ {
if(!m_last_error.empty()) if(!m_last_error.empty())
{ {
cv::String msg = "Raw image encoder error: " + m_last_error; String msg = "Raw image encoder error: " + m_last_error;
CV_Error( CV_BadImageSize, msg.c_str() ); CV_Error( CV_BadImageSize, msg.c_str() );
} }
} }

@ -65,21 +65,21 @@ public:
int height() const { return m_height; }; int height() const { return m_height; };
virtual int type() const { return m_type; }; virtual int type() const { return m_type; };
virtual bool setSource( const cv::String& filename ); virtual bool setSource( const String& filename );
virtual bool setSource( const Mat& buf ); virtual bool setSource( const Mat& buf );
virtual bool readHeader() = 0; virtual bool readHeader() = 0;
virtual bool readData( Mat& img ) = 0; virtual bool readData( Mat& img ) = 0;
virtual size_t signatureLength() const; virtual size_t signatureLength() const;
virtual bool checkSignature( const cv::String& signature ) const; virtual bool checkSignature( const String& signature ) const;
virtual ImageDecoder newDecoder() const; virtual ImageDecoder newDecoder() const;
protected: protected:
int m_width; // width of the image ( filled by readHeader ) int m_width; // width of the image ( filled by readHeader )
int m_height; // height of the image ( filled by readHeader ) int m_height; // height of the image ( filled by readHeader )
int m_type; int m_type;
cv::String m_filename; String m_filename;
cv::String m_signature; String m_signature;
Mat m_buf; Mat m_buf;
bool m_buf_supported; bool m_buf_supported;
}; };
@ -93,23 +93,23 @@ public:
virtual ~BaseImageEncoder() {}; virtual ~BaseImageEncoder() {};
virtual bool isFormatSupported( int depth ) const; virtual bool isFormatSupported( int depth ) const;
virtual bool setDestination( const cv::String& filename ); virtual bool setDestination( const String& filename );
virtual bool setDestination( std::vector<uchar>& buf ); virtual bool setDestination( std::vector<uchar>& buf );
virtual bool write( const Mat& img, const std::vector<int>& params ) = 0; virtual bool write( const Mat& img, const std::vector<int>& params ) = 0;
virtual cv::String getDescription() const; virtual String getDescription() const;
virtual ImageEncoder newEncoder() const; virtual ImageEncoder newEncoder() const;
virtual void throwOnEror() const; virtual void throwOnEror() const;
protected: protected:
cv::String m_description; String m_description;
cv::String m_filename; String m_filename;
std::vector<uchar>* m_buf; std::vector<uchar>* m_buf;
bool m_buf_supported; bool m_buf_supported;
cv::String m_last_error; String m_last_error;
}; };
} }

@ -82,7 +82,7 @@ static JasperInitializer initialize_jasper;
Jpeg2KDecoder::Jpeg2KDecoder() Jpeg2KDecoder::Jpeg2KDecoder()
{ {
m_signature = '\0' + cv::String() + '\0' + cv::String() + '\0' + cv::String("\x0cjP \r\n\x87\n"); m_signature = '\0' + String() + '\0' + String() + '\0' + String("\x0cjP \r\n\x87\n");
m_stream = 0; m_stream = 0;
m_image = 0; m_image = 0;
} }

@ -107,7 +107,7 @@ size_t PxMDecoder::signatureLength() const
return 3; return 3;
} }
bool PxMDecoder::checkSignature( const cv::String& signature ) const bool PxMDecoder::checkSignature( const String& signature ) const
{ {
return signature.size() >= 3 && signature[0] == 'P' && return signature.size() >= 3 && signature[0] == 'P' &&
'1' <= signature[1] && signature[1] <= '6' && '1' <= signature[1] && signature[1] <= '6' &&

@ -61,7 +61,7 @@ public:
void close(); void close();
size_t signatureLength() const; size_t signatureLength() const;
bool checkSignature( const cv::String& signature ) const; bool checkSignature( const String& signature ) const;
ImageDecoder newDecoder() const; ImageDecoder newDecoder() const;
protected: protected:

@ -94,7 +94,7 @@ size_t TiffDecoder::signatureLength() const
return 4; return 4;
} }
bool TiffDecoder::checkSignature( const cv::String& signature ) const bool TiffDecoder::checkSignature( const String& signature ) const
{ {
return signature.size() >= 4 && return signature.size() >= 4 &&
(memcmp(signature.c_str(), fmtSignTiffII, 4) == 0 || (memcmp(signature.c_str(), fmtSignTiffII, 4) == 0 ||

@ -102,7 +102,7 @@ public:
void close(); void close();
size_t signatureLength() const; size_t signatureLength() const;
bool checkSignature( const cv::String& signature ) const; bool checkSignature( const String& signature ) const;
ImageDecoder newDecoder() const; ImageDecoder newDecoder() const;
protected: protected:

@ -71,7 +71,7 @@ ImageDecoder WebPDecoder::newDecoder() const
return new WebPDecoder; return new WebPDecoder;
} }
bool WebPDecoder::checkSignature( const cv::String& signature ) const bool WebPDecoder::checkSignature( const String& signature ) const
{ {
size_t len = signatureLength(); size_t len = signatureLength();
bool ret = false; bool ret = false;

@ -60,7 +60,7 @@ public:
bool readData( Mat& img ); bool readData( Mat& img );
bool readHeader(); bool readHeader();
void close(); void close();
bool checkSignature( const cv::String& signature ) const; bool checkSignature( const String& signature ) const;
ImageDecoder newDecoder() const; ImageDecoder newDecoder() const;

@ -96,7 +96,7 @@ struct ImageCodecInitializer
static ImageCodecInitializer codecs; static ImageCodecInitializer codecs;
static ImageDecoder findDecoder( const cv::String& filename ) static ImageDecoder findDecoder( const String& filename )
{ {
size_t i, maxlen = 0; size_t i, maxlen = 0;
for( i = 0; i < codecs.decoders.size(); i++ ) for( i = 0; i < codecs.decoders.size(); i++ )
@ -108,7 +108,7 @@ static ImageDecoder findDecoder( const cv::String& filename )
FILE* f= fopen( filename.c_str(), "rb" ); FILE* f= fopen( filename.c_str(), "rb" );
if( !f ) if( !f )
return ImageDecoder(); return ImageDecoder();
cv::String signature(maxlen, ' '); String signature(maxlen, ' ');
maxlen = fread( (void*)signature.c_str(), 1, maxlen, f ); maxlen = fread( (void*)signature.c_str(), 1, maxlen, f );
fclose(f); fclose(f);
signature = signature.substr(0, maxlen); signature = signature.substr(0, maxlen);
@ -137,7 +137,7 @@ static ImageDecoder findDecoder( const Mat& buf )
size_t bufSize = buf.rows*buf.cols*buf.elemSize(); size_t bufSize = buf.rows*buf.cols*buf.elemSize();
maxlen = std::min(maxlen, bufSize); maxlen = std::min(maxlen, bufSize);
cv::String signature(maxlen, ' '); String signature(maxlen, ' ');
memcpy( (void*)signature.c_str(), buf.data, maxlen ); memcpy( (void*)signature.c_str(), buf.data, maxlen );
for( i = 0; i < codecs.decoders.size(); i++ ) for( i = 0; i < codecs.decoders.size(); i++ )
@ -149,7 +149,7 @@ static ImageDecoder findDecoder( const Mat& buf )
return ImageDecoder(); return ImageDecoder();
} }
static ImageEncoder findEncoder( const cv::String& _ext ) static ImageEncoder findEncoder( const String& _ext )
{ {
if( _ext.size() <= 1 ) if( _ext.size() <= 1 )
return ImageEncoder(); return ImageEncoder();
@ -163,7 +163,7 @@ static ImageEncoder findEncoder( const cv::String& _ext )
for( size_t i = 0; i < codecs.encoders.size(); i++ ) for( size_t i = 0; i < codecs.encoders.size(); i++ )
{ {
cv::String description = codecs.encoders[i]->getDescription(); String description = codecs.encoders[i]->getDescription();
const char* descr = strchr( description.c_str(), '(' ); const char* descr = strchr( description.c_str(), '(' );
while( descr ) while( descr )
@ -191,7 +191,7 @@ static ImageEncoder findEncoder( const cv::String& _ext )
enum { LOAD_CVMAT=0, LOAD_IMAGE=1, LOAD_MAT=2 }; enum { LOAD_CVMAT=0, LOAD_IMAGE=1, LOAD_MAT=2 };
static void* static void*
imread_( const cv::String& filename, int flags, int hdrtype, Mat* mat=0 ) imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
{ {
IplImage* image = 0; IplImage* image = 0;
CvMat *matrix = 0; CvMat *matrix = 0;
@ -253,14 +253,14 @@ imread_( const cv::String& filename, int flags, int hdrtype, Mat* mat=0 )
hdrtype == LOAD_IMAGE ? (void*)image : (void*)mat; hdrtype == LOAD_IMAGE ? (void*)image : (void*)mat;
} }
Mat imread( const cv::String& filename, int flags ) Mat imread( const String& filename, int flags )
{ {
Mat img; Mat img;
imread_( filename, flags, LOAD_MAT, &img ); imread_( filename, flags, LOAD_MAT, &img );
return img; return img;
} }
static bool imwrite_( const cv::String& filename, const Mat& image, static bool imwrite_( const String& filename, const Mat& image,
const std::vector<int>& params, bool flipv ) const std::vector<int>& params, bool flipv )
{ {
Mat temp; Mat temp;
@ -292,7 +292,7 @@ static bool imwrite_( const cv::String& filename, const Mat& image,
return code; return code;
} }
bool imwrite( const cv::String& filename, InputArray _img, bool imwrite( const String& filename, InputArray _img,
const std::vector<int>& params ) const std::vector<int>& params )
{ {
Mat img = _img.getMat(); Mat img = _img.getMat();
@ -306,7 +306,7 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
IplImage* image = 0; IplImage* image = 0;
CvMat *matrix = 0; CvMat *matrix = 0;
Mat temp, *data = &temp; Mat temp, *data = &temp;
cv::String filename; String filename;
ImageDecoder decoder = findDecoder(buf); ImageDecoder decoder = findDecoder(buf);
if( decoder.empty() ) if( decoder.empty() )
@ -400,7 +400,7 @@ Mat imdecode( InputArray _buf, int flags, Mat* dst )
return *dst; return *dst;
} }
bool imencode( const cv::String& ext, InputArray _image, bool imencode( const String& ext, InputArray _image,
std::vector<uchar>& buf, const std::vector<int>& params ) std::vector<uchar>& buf, const std::vector<int>& params )
{ {
Mat image = _image.getMat(); Mat image = _image.getMat();
@ -429,7 +429,7 @@ bool imencode( const cv::String& ext, InputArray _image,
} }
else else
{ {
cv::String filename = tempfile(); String filename = tempfile();
code = encoder->setDestination(filename); code = encoder->setDestination(filename);
CV_Assert( code ); CV_Assert( code );

@ -153,12 +153,12 @@ CV_IMPL double cvGetWindowProperty(const char* name, int prop_id)
} }
} }
void cv::namedWindow( const cv::String& winname, int flags ) void cv::namedWindow( const String& winname, int flags )
{ {
cvNamedWindow( winname.c_str(), flags ); cvNamedWindow( winname.c_str(), flags );
} }
void cv::destroyWindow( const cv::String& winname ) void cv::destroyWindow( const String& winname )
{ {
cvDestroyWindow( winname.c_str() ); cvDestroyWindow( winname.c_str() );
} }
@ -168,22 +168,22 @@ void cv::destroyAllWindows()
cvDestroyAllWindows(); cvDestroyAllWindows();
} }
void cv::resizeWindow( const cv::String& winname, int width, int height ) void cv::resizeWindow( const String& winname, int width, int height )
{ {
cvResizeWindow( winname.c_str(), width, height ); cvResizeWindow( winname.c_str(), width, height );
} }
void cv::moveWindow( const cv::String& winname, int x, int y ) void cv::moveWindow( const String& winname, int x, int y )
{ {
cvMoveWindow( winname.c_str(), x, y ); cvMoveWindow( winname.c_str(), x, y );
} }
void cv::setWindowProperty(const cv::String& winname, int prop_id, double prop_value) void cv::setWindowProperty(const String& winname, int prop_id, double prop_value)
{ {
cvSetWindowProperty( winname.c_str(), prop_id, prop_value); cvSetWindowProperty( winname.c_str(), prop_id, prop_value);
} }
double cv::getWindowProperty(const cv::String& winname, int prop_id) double cv::getWindowProperty(const String& winname, int prop_id)
{ {
return cvGetWindowProperty(winname.c_str(), prop_id); return cvGetWindowProperty(winname.c_str(), prop_id);
} }
@ -193,7 +193,7 @@ int cv::waitKey(int delay)
return cvWaitKey(delay); return cvWaitKey(delay);
} }
int cv::createTrackbar(const cv::String& trackbarName, const cv::String& winName, int cv::createTrackbar(const String& trackbarName, const String& winName,
int* value, int count, TrackbarCallback callback, int* value, int count, TrackbarCallback callback,
void* userdata) void* userdata)
{ {
@ -201,17 +201,17 @@ int cv::createTrackbar(const cv::String& trackbarName, const cv::String& winName
value, count, callback, userdata); value, count, callback, userdata);
} }
void cv::setTrackbarPos( const cv::String& trackbarName, const cv::String& winName, int value ) void cv::setTrackbarPos( const String& trackbarName, const String& winName, int value )
{ {
cvSetTrackbarPos(trackbarName.c_str(), winName.c_str(), value ); cvSetTrackbarPos(trackbarName.c_str(), winName.c_str(), value );
} }
int cv::getTrackbarPos( const cv::String& trackbarName, const cv::String& winName ) int cv::getTrackbarPos( const String& trackbarName, const String& winName )
{ {
return cvGetTrackbarPos(trackbarName.c_str(), winName.c_str()); return cvGetTrackbarPos(trackbarName.c_str(), winName.c_str());
} }
void cv::setMouseCallback( const cv::String& windowName, MouseCallback onMouse, void* param) void cv::setMouseCallback( const String& windowName, MouseCallback onMouse, void* param)
{ {
cvSetMouseCallback(windowName.c_str(), onMouse, param); cvSetMouseCallback(windowName.c_str(), onMouse, param);
} }
@ -223,17 +223,17 @@ int cv::startWindowThread()
// OpenGL support // OpenGL support
void cv::setOpenGlDrawCallback(const cv::String& name, OpenGlDrawCallback callback, void* userdata) void cv::setOpenGlDrawCallback(const String& name, OpenGlDrawCallback callback, void* userdata)
{ {
cvSetOpenGlDrawCallback(name.c_str(), callback, userdata); cvSetOpenGlDrawCallback(name.c_str(), callback, userdata);
} }
void cv::setOpenGlContext(const cv::String& windowName) void cv::setOpenGlContext(const String& windowName)
{ {
cvSetOpenGlContext(windowName.c_str()); cvSetOpenGlContext(windowName.c_str());
} }
void cv::updateWindow(const cv::String& windowName) void cv::updateWindow(const String& windowName)
{ {
cvUpdateWindow(windowName.c_str()); cvUpdateWindow(windowName.c_str());
} }
@ -254,7 +254,7 @@ namespace
} }
#endif // HAVE_OPENGL #endif // HAVE_OPENGL
void cv::imshow( const cv::String& winname, InputArray _img ) void cv::imshow( const String& winname, InputArray _img )
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
Mat img = _img.getMat(); Mat img = _img.getMat();
@ -342,23 +342,23 @@ CV_IMPL void cvUpdateWindow(const char*)
#if defined (HAVE_QT) #if defined (HAVE_QT)
CvFont cv::fontQt(const cv::String& nameFont, int pointSize, Scalar color, int weight, int style, int /*spacing*/) CvFont cv::fontQt(const String& nameFont, int pointSize, Scalar color, int weight, int style, int /*spacing*/)
{ {
return cvFontQt(nameFont.c_str(), pointSize,color,weight, style); return cvFontQt(nameFont.c_str(), pointSize,color,weight, style);
} }
void cv::addText( const Mat& img, const cv::String& text, Point org, CvFont font) void cv::addText( const Mat& img, const String& text, Point org, CvFont font)
{ {
CvMat _img = img; CvMat _img = img;
cvAddText( &_img, text.c_str(), org,&font); cvAddText( &_img, text.c_str(), org,&font);
} }
void cv::displayStatusBar(const cv::String& name, const cv::String& text, int delayms) void cv::displayStatusBar(const String& name, const String& text, int delayms)
{ {
cvDisplayStatusBar(name.c_str(),text.c_str(), delayms); cvDisplayStatusBar(name.c_str(),text.c_str(), delayms);
} }
void cv::displayOverlay(const cv::String& name, const cv::String& text, int delayms) void cv::displayOverlay(const String& name, const String& text, int delayms)
{ {
cvDisplayOverlay(name.c_str(),text.c_str(), delayms); cvDisplayOverlay(name.c_str(),text.c_str(), delayms);
} }
@ -373,40 +373,40 @@ void cv::stopLoop()
cvStopLoop(); cvStopLoop();
} }
void cv::saveWindowParameters(const cv::String& windowName) void cv::saveWindowParameters(const String& windowName)
{ {
cvSaveWindowParameters(windowName.c_str()); cvSaveWindowParameters(windowName.c_str());
} }
void cv::loadWindowParameters(const cv::String& windowName) void cv::loadWindowParameters(const String& windowName)
{ {
cvLoadWindowParameters(windowName.c_str()); cvLoadWindowParameters(windowName.c_str());
} }
int cv::createButton(const cv::String& button_name, ButtonCallback on_change, void* userdata, int button_type , bool initial_button_state ) int cv::createButton(const String& button_name, ButtonCallback on_change, void* userdata, int button_type , bool initial_button_state )
{ {
return cvCreateButton(button_name.c_str(), on_change, userdata, button_type , initial_button_state ); return cvCreateButton(button_name.c_str(), on_change, userdata, button_type , initial_button_state );
} }
#else #else
CvFont cv::fontQt(const cv::String&, int, Scalar, int, int, int) CvFont cv::fontQt(const String&, int, Scalar, int, int, int)
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
return CvFont(); return CvFont();
} }
void cv::addText( const Mat&, const cv::String&, Point, CvFont) void cv::addText( const Mat&, const String&, Point, CvFont)
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
} }
void cv::displayStatusBar(const cv::String&, const cv::String&, int) void cv::displayStatusBar(const String&, const String&, int)
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
} }
void cv::displayOverlay(const cv::String&, const cv::String&, int ) void cv::displayOverlay(const String&, const String&, int )
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
} }
@ -422,17 +422,17 @@ void cv::stopLoop()
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
} }
void cv::saveWindowParameters(const cv::String&) void cv::saveWindowParameters(const String&)
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
} }
void cv::loadWindowParameters(const cv::String&) void cv::loadWindowParameters(const String&)
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
} }
int cv::createButton(const cv::String&, ButtonCallback, void*, int , bool ) int cv::createButton(const String&, ButtonCallback, void*, int , bool )
{ {
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support"); CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
return 0; return 0;

@ -287,11 +287,11 @@ type_dict = {
"suffix" : "II"}, "suffix" : "II"},
"String" : { "j_type" : "String", "jn_type" : "String", "String" : { "j_type" : "String", "jn_type" : "String",
"jni_type" : "jstring", "jni_name" : "n_%(n)s", "jni_type" : "jstring", "jni_name" : "n_%(n)s",
"jni_var" : 'const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); cv::String n_%(n)s( utf_%(n)s ? utf_%(n)s : "" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)', "jni_var" : 'const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); String n_%(n)s( utf_%(n)s ? utf_%(n)s : "" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)',
"suffix" : "Ljava_lang_String_2"}, "suffix" : "Ljava_lang_String_2"},
"c_string": { "j_type" : "String", "jn_type" : "String", "c_string": { "j_type" : "String", "jn_type" : "String",
"jni_type" : "jstring", "jni_name" : "n_%(n)s.c_str()", "jni_type" : "jstring", "jni_name" : "n_%(n)s.c_str()",
"jni_var" : 'const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); cv::String n_%(n)s( utf_%(n)s ? utf_%(n)s : "" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)', "jni_var" : 'const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); String n_%(n)s( utf_%(n)s ? utf_%(n)s : "" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)',
"suffix" : "Ljava_lang_String_2"}, "suffix" : "Ljava_lang_String_2"},
"TermCriteria": { "j_type" : "TermCriteria", "jn_args" : (("int", ".type"), ("int", ".maxCount"), ("double", ".epsilon")), "TermCriteria": { "j_type" : "TermCriteria", "jn_args" : (("int", ".type"), ("int", ".maxCount"), ("double", ".epsilon")),
"jni_var" : "TermCriteria %(n)s(%(n)s_type, %(n)s_maxCount, %(n)s_epsilon)", "jni_type" : "jdoubleArray", "jni_var" : "TermCriteria %(n)s(%(n)s_type, %(n)s_maxCount, %(n)s_epsilon)", "jni_type" : "jdoubleArray",
@ -417,7 +417,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
{ {
'j_code' : 'j_code' :
""" """
// C++: Size getTextSize(const cv::String& text, int fontFace, double fontScale, int thickness, int* baseLine); // C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);
//javadoc:getTextSize(text, fontFace, fontScale, thickness, baseLine) //javadoc:getTextSize(text, fontFace, fontScale, thickness, baseLine)
public static Size getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine) { public static Size getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine) {
if(baseLine != null && baseLine.length != 1) if(baseLine != null && baseLine.length != 1)
@ -430,7 +430,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
""" private static native double[] n_getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine);\n""", """ private static native double[] n_getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine);\n""",
'cpp_code' : 'cpp_code' :
""" """
// C++: Size getTextSize(const cv::String& text, int fontFace, double fontScale, int thickness, int* baseLine); // C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray); JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
@ -445,7 +445,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
} }
const char* utf_text = env->GetStringUTFChars(text, 0); const char* utf_text = env->GetStringUTFChars(text, 0);
cv::String n_text( utf_text ? utf_text : "" ); String n_text( utf_text ? utf_text : "" );
env->ReleaseStringUTFChars(text, utf_text); env->ReleaseStringUTFChars(text, utf_text);
int _baseLine; int _baseLine;

@ -84,7 +84,7 @@ public:
//not supported: SimpleBlob, Dense //not supported: SimpleBlob, Dense
CV_WRAP static javaFeatureDetector* create( int detectorType ) CV_WRAP static javaFeatureDetector* create( int detectorType )
{ {
cv::String name; String name;
if (detectorType > DYNAMICDETECTOR) if (detectorType > DYNAMICDETECTOR)
{ {
name = "Dynamic"; name = "Dynamic";
@ -146,14 +146,14 @@ public:
return (javaFeatureDetector*)((FeatureDetector*) detector); return (javaFeatureDetector*)((FeatureDetector*) detector);
} }
CV_WRAP void write( const cv::String& fileName ) const CV_WRAP void write( const String& fileName ) const
{ {
FileStorage fs(fileName, FileStorage::WRITE); FileStorage fs(fileName, FileStorage::WRITE);
((FeatureDetector*)this)->write(fs); ((FeatureDetector*)this)->write(fs);
fs.release(); fs.release();
} }
CV_WRAP void read( const cv::String& fileName ) CV_WRAP void read( const String& fileName )
{ {
FileStorage fs(fileName, FileStorage::READ); FileStorage fs(fileName, FileStorage::READ);
((FeatureDetector*)this)->read(fs.root()); ((FeatureDetector*)this)->read(fs.root());
@ -208,7 +208,7 @@ public:
//supported: FlannBased, BruteForce, BruteForce-L1, BruteForce-Hamming, BruteForce-HammingLUT //supported: FlannBased, BruteForce, BruteForce-L1, BruteForce-Hamming, BruteForce-HammingLUT
CV_WRAP static javaDescriptorMatcher* create( int matcherType ) CV_WRAP static javaDescriptorMatcher* create( int matcherType )
{ {
cv::String name; String name;
switch(matcherType) switch(matcherType)
{ {
@ -240,14 +240,14 @@ public:
return (javaDescriptorMatcher*)((DescriptorMatcher*) matcher); return (javaDescriptorMatcher*)((DescriptorMatcher*) matcher);
} }
CV_WRAP void write( const cv::String& fileName ) const CV_WRAP void write( const String& fileName ) const
{ {
FileStorage fs(fileName, FileStorage::WRITE); FileStorage fs(fileName, FileStorage::WRITE);
((DescriptorMatcher*)this)->write(fs); ((DescriptorMatcher*)this)->write(fs);
fs.release(); fs.release();
} }
CV_WRAP void read( const cv::String& fileName ) CV_WRAP void read( const String& fileName )
{ {
FileStorage fs(fileName, FileStorage::READ); FileStorage fs(fileName, FileStorage::READ);
((DescriptorMatcher*)this)->read(fs.root()); ((DescriptorMatcher*)this)->read(fs.root());
@ -294,7 +294,7 @@ public:
//not supported: Calonder //not supported: Calonder
CV_WRAP static javaDescriptorExtractor* create( int extractorType ) CV_WRAP static javaDescriptorExtractor* create( int extractorType )
{ {
cv::String name; String name;
if (extractorType > OPPONENTEXTRACTOR) if (extractorType > OPPONENTEXTRACTOR)
{ {
@ -332,14 +332,14 @@ public:
return (javaDescriptorExtractor*)((DescriptorExtractor*) extractor); return (javaDescriptorExtractor*)((DescriptorExtractor*) extractor);
} }
CV_WRAP void write( const cv::String& fileName ) const CV_WRAP void write( const String& fileName ) const
{ {
FileStorage fs(fileName, FileStorage::WRITE); FileStorage fs(fileName, FileStorage::WRITE);
((DescriptorExtractor*)this)->write(fs); ((DescriptorExtractor*)this)->write(fs);
fs.release(); fs.release();
} }
CV_WRAP void read( const cv::String& fileName ) CV_WRAP void read( const String& fileName )
{ {
FileStorage fs(fileName, FileStorage::READ); FileStorage fs(fileName, FileStorage::READ);
((DescriptorExtractor*)this)->read(fs.root()); ((DescriptorExtractor*)this)->read(fs.root());
@ -401,7 +401,7 @@ public:
//unsupported: Vector //unsupported: Vector
CV_WRAP static javaGenericDescriptorMatcher* create( int matcherType ) CV_WRAP static javaGenericDescriptorMatcher* create( int matcherType )
{ {
cv::String name; String name;
switch(matcherType) switch(matcherType)
{ {
@ -421,14 +421,14 @@ public:
return (javaGenericDescriptorMatcher*)((GenericDescriptorMatcher*) matcher); return (javaGenericDescriptorMatcher*)((GenericDescriptorMatcher*) matcher);
} }
CV_WRAP void write( const cv::String& fileName ) const CV_WRAP void write( const String& fileName ) const
{ {
FileStorage fs(fileName, FileStorage::WRITE); FileStorage fs(fileName, FileStorage::WRITE);
((GenericDescriptorMatcher*)this)->write(fs); ((GenericDescriptorMatcher*)this)->write(fs);
fs.release(); fs.release();
} }
CV_WRAP void read( const cv::String& fileName ) CV_WRAP void read( const String& fileName )
{ {
FileStorage fs(fileName, FileStorage::READ); FileStorage fs(fileName, FileStorage::READ);
((GenericDescriptorMatcher*)this)->read(fs.root()); ((GenericDescriptorMatcher*)this)->read(fs.root());

@ -1887,7 +1887,7 @@ public:
void setVerbose(bool verbose); void setVerbose(bool verbose);
void read(const FileNode& node); void read(const FileNode& node);
void write(FileStorage& fs, const cv::String& name=cv::String()) const; void write(FileStorage& fs, const String& name=String()) const;
int radius; int radius;
int threshold; int threshold;
@ -1918,7 +1918,7 @@ public:
const PatchGenerator& patchGenerator=PatchGenerator()); const PatchGenerator& patchGenerator=PatchGenerator());
virtual ~FernClassifier(); virtual ~FernClassifier();
virtual void read(const FileNode& n); virtual void read(const FileNode& n);
virtual void write(FileStorage& fs, const cv::String& name=cv::String()) const; virtual void write(FileStorage& fs, const String& name=String()) const;
virtual void trainFromSingleView(const Mat& image, virtual void trainFromSingleView(const Mat& image,
const std::vector<KeyPoint>& keypoints, const std::vector<KeyPoint>& keypoints,
int _patchSize=PATCH_SIZE, int _patchSize=PATCH_SIZE,
@ -2062,8 +2062,8 @@ public:
inline void applyQuantization(int num_quant_bits) { makePosteriors2(num_quant_bits); } inline void applyQuantization(int num_quant_bits) { makePosteriors2(num_quant_bits); }
// debug // debug
void savePosteriors(cv::String url, bool append=false); void savePosteriors(String url, bool append=false);
void savePosteriors2(cv::String url, bool append=false); void savePosteriors2(String url, bool append=false);
private: private:
int classes_; int classes_;
@ -2181,9 +2181,9 @@ public:
void write(std::ostream &os) const; void write(std::ostream &os) const;
// experimental and debug // experimental and debug
void saveAllFloatPosteriors(cv::String file_url); void saveAllFloatPosteriors(String file_url);
void saveAllBytePosteriors(cv::String file_url); void saveAllBytePosteriors(String file_url);
void setFloatPosteriorsFromTextfile_176(cv::String url); void setFloatPosteriorsFromTextfile_176(String url);
float countZeroElements(); float countZeroElements();
std::vector<RandomizedTree> trees_; std::vector<RandomizedTree> trees_;
@ -2356,7 +2356,7 @@ protected:
CvAffinePose* m_affine_poses; // an array of poses CvAffinePose* m_affine_poses; // an array of poses
CvMat** m_transforms; // an array of affine transforms corresponding to poses CvMat** m_transforms; // an array of affine transforms corresponding to poses
cv::String m_feature_name; // the name of the feature associated with the descriptor 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) 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 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, 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); int pca_dim_high = 100, int pca_dim_low = 100);
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(), OneWayDescriptorBase(CvSize patch_size, int pose_count, const String &pca_filename, const String &train_path = String(), const String &images_list = String(),
float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1, 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); int pca_dim_high = 100, int pca_dim_low = 100);
@ -2516,7 +2516,7 @@ public:
void ConvertDescriptorsArrayToTree(); // Converting pca_descriptors array to KD tree void ConvertDescriptorsArrayToTree(); // Converting pca_descriptors array to KD tree
// GetPCAFilename: get default PCA filename // GetPCAFilename: get default PCA filename
static cv::String GetPCAFilename () { return "pca.yml"; } static String GetPCAFilename () { return "pca.yml"; }
virtual bool empty() const { return m_train_feature_count <= 0 ? true : false; } 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, 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); const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1);
OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename, OneWayDescriptorObject(CvSize patch_size, int pose_count, const String &pca_filename,
const cv::String &train_path = cv::String (), const cv::String &images_list = cv::String (), const String &train_path = String (), const String &images_list = String (),
float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1); 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, Params( int poseCount = POSE_COUNT,
Size patchSize = Size(PATCH_WIDTH, PATCH_HEIGHT), Size patchSize = Size(PATCH_WIDTH, PATCH_HEIGHT),
cv::String pcaFilename = cv::String(), String pcaFilename = String(),
cv::String trainPath = cv::String(), cv::String trainImagesList = cv::String(), String trainPath = String(), String trainImagesList = String(),
float minScale = GET_MIN_SCALE(), float maxScale = GET_MAX_SCALE(), float minScale = GET_MIN_SCALE(), float maxScale = GET_MAX_SCALE(),
float stepScale = GET_STEP_SCALE() ); float stepScale = GET_STEP_SCALE() );
int poseCount; int poseCount;
Size patchSize; Size patchSize;
cv::String pcaFilename; String pcaFilename;
cv::String trainPath; String trainPath;
cv::String trainImagesList; String trainImagesList;
float minScale, maxScale, stepScale; float minScale, maxScale, stepScale;
}; };
@ -2706,7 +2706,7 @@ public:
int compressionMethod=FernClassifier::COMPRESSION_NONE, int compressionMethod=FernClassifier::COMPRESSION_NONE,
const PatchGenerator& patchGenerator=PatchGenerator() ); const PatchGenerator& patchGenerator=PatchGenerator() );
Params( const cv::String& filename ); Params( const String& filename );
int nclasses; int nclasses;
int patchSize; int patchSize;
@ -2717,7 +2717,7 @@ public:
int compressionMethod; int compressionMethod;
PatchGenerator patchGenerator; PatchGenerator patchGenerator;
cv::String filename; String filename;
}; };
FernDescriptorMatcher( const Params& params=Params() ); FernDescriptorMatcher( const Params& params=Params() );
@ -2759,7 +2759,7 @@ template<typename T>
class CV_EXPORTS CalonderDescriptorExtractor : public DescriptorExtractor class CV_EXPORTS CalonderDescriptorExtractor : public DescriptorExtractor
{ {
public: public:
CalonderDescriptorExtractor( const cv::String& classifierFile ); CalonderDescriptorExtractor( const String& classifierFile );
virtual void read( const FileNode &fn ); virtual void read( const FileNode &fn );
virtual void write( FileStorage &fs ) const; virtual void write( FileStorage &fs ) const;
@ -2777,7 +2777,7 @@ protected:
}; };
template<typename T> template<typename T>
CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const cv::String& classifier_file) CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const String& classifier_file)
{ {
classifier_.read( classifier_file.c_str() ); classifier_.read( classifier_file.c_str() );
} }
@ -2867,7 +2867,7 @@ public:
void setVerbose(bool verbose); void setVerbose(bool verbose);
void read(const FileNode& node); void read(const FileNode& node);
void write(FileStorage& fs, const cv::String& name=cv::String()) const; void write(FileStorage& fs, const String& name=String()) const;
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT std::vector<Point2f>& corners) const; bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT std::vector<Point2f>& corners) const;
bool operator()(const std::vector<Mat>& pyr, const std::vector<KeyPoint>& keypoints, bool operator()(const std::vector<Mat>& pyr, const std::vector<KeyPoint>& keypoints,
CV_OUT Mat& H, CV_OUT std::vector<Point2f>& corners, CV_OUT Mat& H, CV_OUT std::vector<Point2f>& corners,

@ -626,7 +626,7 @@ void RandomizedTree::write(std::ostream &os) const
} }
void RandomizedTree::savePosteriors(cv::String url, bool append) void RandomizedTree::savePosteriors(String url, bool append)
{ {
std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out)); std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out));
for (int i=0; i<num_leaves_; i++) { for (int i=0; i<num_leaves_; i++) {
@ -641,7 +641,7 @@ void RandomizedTree::savePosteriors(cv::String url, bool append)
file.close(); file.close();
} }
void RandomizedTree::savePosteriors2(cv::String url, bool append) void RandomizedTree::savePosteriors2(String url, bool append)
{ {
std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out)); std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out));
for (int i=0; i<num_leaves_; i++) { for (int i=0; i<num_leaves_; i++) {
@ -915,7 +915,7 @@ printf("RTreeClassifier::write: num_quant_bits_=%i\n", num_quant_bits_);
tree_it->write(os); tree_it->write(os);
} }
void RTreeClassifier::saveAllFloatPosteriors(cv::String url) void RTreeClassifier::saveAllFloatPosteriors(String url)
{ {
printf("[DEBUG] writing all float posteriors to %s...\n", url.c_str()); printf("[DEBUG] writing all float posteriors to %s...\n", url.c_str());
for (int i=0; i<(int)trees_.size(); ++i) for (int i=0; i<(int)trees_.size(); ++i)
@ -923,7 +923,7 @@ void RTreeClassifier::saveAllFloatPosteriors(cv::String url)
printf("[DEBUG] done\n"); printf("[DEBUG] done\n");
} }
void RTreeClassifier::saveAllBytePosteriors(cv::String url) void RTreeClassifier::saveAllBytePosteriors(String url)
{ {
printf("[DEBUG] writing all byte posteriors to %s...\n", url.c_str()); printf("[DEBUG] writing all byte posteriors to %s...\n", url.c_str());
for (int i=0; i<(int)trees_.size(); ++i) for (int i=0; i<(int)trees_.size(); ++i)
@ -932,7 +932,7 @@ void RTreeClassifier::saveAllBytePosteriors(cv::String url)
} }
void RTreeClassifier::setFloatPosteriorsFromTextfile_176(cv::String url) void RTreeClassifier::setFloatPosteriorsFromTextfile_176(String url)
{ {
std::ifstream ifs(url.c_str()); std::ifstream ifs(url.c_str());

@ -465,7 +465,7 @@ namespace cv{
void OneWayDescriptor::Initialize(int pose_count, IplImage* frontal, const char* feature_name, int norm) void OneWayDescriptor::Initialize(int pose_count, IplImage* frontal, const char* feature_name, int norm)
{ {
m_feature_name = cv::String(feature_name); m_feature_name = String(feature_name);
CvRect roi = cvGetImageROI(frontal); CvRect roi = cvGetImageROI(frontal);
m_center = rect_center(roi); m_center = rect_center(roi);
@ -482,7 +482,7 @@ namespace cv{
Initialize(pose_count, frontal, feature_name, 1); Initialize(pose_count, frontal, feature_name, 1);
return; return;
} }
m_feature_name = cv::String(feature_name); m_feature_name = String(feature_name);
CvRect roi = cvGetImageROI(frontal); CvRect roi = cvGetImageROI(frontal);
m_center = rect_center(roi); m_center = rect_center(roi);
@ -1287,8 +1287,8 @@ namespace cv{
} }
OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename, OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const String &pca_filename,
const cv::String &train_path, const cv::String &images_list, float _scale_min, float _scale_max, const String &train_path, const String &images_list, float _scale_min, float _scale_max,
float _scale_step, int pyr_levels, float _scale_step, int pyr_levels,
int pca_dim_high, int pca_dim_low) 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) : 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; m_part_id = 0;
} }
OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename, OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const 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) : const String &train_path, const 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) OneWayDescriptorBase(patch_size, pose_count, pca_filename, train_path, images_list, _scale_min, _scale_max, _scale_step, pyr_levels)
{ {
m_part_id = 0; m_part_id = 0;
@ -2145,7 +2145,7 @@ namespace cv{
void readPCAFeatures(const FileNode &fn, CvMat** avg, CvMat** eigenvectors, const char* postfix) void readPCAFeatures(const FileNode &fn, CvMat** avg, CvMat** eigenvectors, const char* postfix)
{ {
cv::String str = cv::String ("avg") + postfix; String str = String ("avg") + postfix;
CvMat* _avg = reinterpret_cast<CvMat*> (fn[str].readObj()); CvMat* _avg = reinterpret_cast<CvMat*> (fn[str].readObj());
if (_avg != 0) if (_avg != 0)
{ {
@ -2153,7 +2153,7 @@ namespace cv{
cvReleaseMat(&_avg); cvReleaseMat(&_avg);
} }
str = cv::String ("eigenvectors") + postfix; str = String ("eigenvectors") + postfix;
CvMat* _eigenvectors = reinterpret_cast<CvMat*> (fn[str].readObj()); CvMat* _eigenvectors = reinterpret_cast<CvMat*> (fn[str].readObj());
if (_eigenvectors != 0) if (_eigenvectors != 0)
{ {
@ -2166,8 +2166,8 @@ namespace cv{
* OneWayDescriptorMatcher * * OneWayDescriptorMatcher *
\****************************************************************************************/ \****************************************************************************************/
OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, cv::String _pcaFilename, OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, String _pcaFilename,
cv::String _trainPath, cv::String _trainImagesList, String _trainPath, String _trainImagesList,
float _minScale, float _maxScale, float _stepScale ) : float _minScale, float _maxScale, float _stepScale ) :
poseCount(_poseCount), patchSize(_patchSize), pcaFilename(_pcaFilename), poseCount(_poseCount), patchSize(_patchSize), pcaFilename(_pcaFilename),
trainPath(_trainPath), trainImagesList(_trainImagesList), trainPath(_trainPath), trainImagesList(_trainImagesList),
@ -2271,7 +2271,7 @@ namespace cv{
void OneWayDescriptorMatcher::read( const FileNode &fn ) void OneWayDescriptorMatcher::read( const FileNode &fn )
{ {
base = new OneWayDescriptorObject( params.patchSize, params.poseCount, cv::String (), cv::String (), cv::String (), base = new OneWayDescriptorObject( params.patchSize, params.poseCount, String (), String (), String (),
params.minScale, params.maxScale, params.stepScale ); params.minScale, params.maxScale, params.stepScale );
base->Read (fn); base->Read (fn);
} }

@ -617,7 +617,7 @@ void LDetector::read(const FileNode& objnode)
clusteringDistance = (int)objnode["clustering-distance"]; clusteringDistance = (int)objnode["clustering-distance"];
} }
void LDetector::write(FileStorage& fs, const cv::String& name) const void LDetector::write(FileStorage& fs, const String& name) const
{ {
WriteStructContext ws(fs, name, CV_NODE_MAP); WriteStructContext ws(fs, name, CV_NODE_MAP);
@ -707,7 +707,7 @@ FernClassifier::FernClassifier(const std::vector<std::vector<Point2f> >& points,
} }
void FernClassifier::write(FileStorage& fs, const cv::String& objname) const void FernClassifier::write(FileStorage& fs, const String& objname) const
{ {
WriteStructContext ws(fs, objname, CV_NODE_MAP); WriteStructContext ws(fs, objname, CV_NODE_MAP);
@ -1228,7 +1228,7 @@ nstructs(_nstructs), structSize(_structSize), nviews(_nviews),
compressionMethod(_compressionMethod), patchGenerator(_patchGenerator) compressionMethod(_compressionMethod), patchGenerator(_patchGenerator)
{} {}
FernDescriptorMatcher::Params::Params( const cv::String& _filename ) FernDescriptorMatcher::Params::Params( const String& _filename )
{ {
filename = _filename; filename = _filename;
} }
@ -1476,7 +1476,7 @@ void PlanarObjectDetector::read(const FileNode& node)
} }
void PlanarObjectDetector::write(FileStorage& fs, const cv::String& objname) const void PlanarObjectDetector::write(FileStorage& fs, const String& objname) const
{ {
WriteStructContext ws(fs, objname, CV_NODE_MAP); WriteStructContext ws(fs, objname, CV_NODE_MAP);

@ -48,7 +48,7 @@ Class for loading the data from a ``.csv`` file.
void set_miss_ch( char ch ); void set_miss_ch( char ch );
char get_miss_ch() const; char get_miss_ch() const;
const std::map<cv::String, int>& get_class_labels_map() const; const std::map<String, int>& get_class_labels_map() const;
protected: protected:
... ...
@ -245,7 +245,7 @@ CvMLData::get_class_labels_map
------------------------------- -------------------------------
Returns a map that converts strings to labels. Returns a map that converts strings to labels.
.. ocv:function:: const std::map<cv::String, int>& CvMLData::get_class_labels_map() const .. ocv:function:: const std::map<String, int>& 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. 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.

@ -58,7 +58,7 @@ namespace cv
const char* noImage2dOption = "-D DISABLE_IMAGE2D"; const char* noImage2dOption = "-D DISABLE_IMAGE2D";
static void openCLExecuteKernelSURF(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], static void openCLExecuteKernelSURF(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth) size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth)
{ {
if(support_image2d()) 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); const int max_samples_j = 1 + ((img_cols - min_size) >> octave);
Context *clCxt = det.clCxt; Context *clCxt = det.clCxt;
cv::String kernelName = "icvCalcLayerDetAndTrace"; String kernelName = "icvCalcLayerDetAndTrace";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
if(sumTex) 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; const int min_margin = ((calcSize(octave, 2) >> 1) >> octave) + 1;
Context *clCxt = det.clCxt; Context *clCxt = det.clCxt;
cv::String kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer"; String kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data)); 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) oclMat &keypoints, oclMat &counters_, int octave, int layer_rows, int max_features)
{ {
Context *clCxt = det.clCxt; Context *clCxt = det.clCxt;
cv::String kernelName = "icvInterpolateKeypoint"; String kernelName = "icvInterpolateKeypoint";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data)); 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) void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeatures)
{ {
Context *clCxt = counters.clCxt; Context *clCxt = counters.clCxt;
cv::String kernelName = "icvCalcOrientation"; String kernelName = "icvCalcOrientation";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > 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) void SURF_OCL_Invoker::icvSetUpright_gpu(const oclMat &keypoints, int nFeatures)
{ {
Context *clCxt = counters.clCxt; Context *clCxt = counters.clCxt;
cv::String kernelName = "icvSetUpright"; String kernelName = "icvSetUpright";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > 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 // compute unnormalized descriptors, then normalize them - odd indexing since grid must be 2D
Context *clCxt = descriptors.clCxt; Context *clCxt = descriptors.clCxt;
cv::String kernelName; String kernelName;
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = {1, 1, 1}; size_t localThreads[3] = {1, 1, 1};
size_t globalThreads[3] = {1, 1, 1}; size_t globalThreads[3] = {1, 1, 1};

@ -307,24 +307,24 @@ public:
}; };
LatentSvmDetector(); LatentSvmDetector();
LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::String>& classNames=std::vector<cv::String>() ); LatentSvmDetector( const std::vector<String>& filenames, const std::vector<String>& classNames=std::vector<String>() );
virtual ~LatentSvmDetector(); virtual ~LatentSvmDetector();
virtual void clear(); virtual void clear();
virtual bool empty() const; virtual bool empty() const;
bool load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& classNames=std::vector<cv::String>() ); bool load( const std::vector<String>& filenames, const std::vector<String>& classNames=std::vector<String>() );
virtual void detect( const Mat& image, virtual void detect( const Mat& image,
std::vector<ObjectDetection>& objectDetections, std::vector<ObjectDetection>& objectDetections,
float overlapThreshold=0.5f, float overlapThreshold=0.5f,
int numThreads=-1 ); int numThreads=-1 );
const std::vector<cv::String>& getClassNames() const; const std::vector<String>& getClassNames() const;
size_t getClassCount() const; size_t getClassCount() const;
private: private:
std::vector<CvLatentSvmDetector*> detectors; std::vector<CvLatentSvmDetector*> detectors;
std::vector<cv::String> classNames; std::vector<String> classNames;
}; };
CV_EXPORTS void groupRectangles(CV_OUT CV_IN_OUT std::vector<Rect>& rectList, int groupThreshold, double eps=0.2); CV_EXPORTS void groupRectangles(CV_OUT CV_IN_OUT std::vector<Rect>& rectList, int groupThreshold, double eps=0.2);
@ -369,11 +369,11 @@ class CV_EXPORTS_W CascadeClassifier
{ {
public: public:
CV_WRAP CascadeClassifier(); CV_WRAP CascadeClassifier();
CV_WRAP CascadeClassifier( const cv::String& filename ); CV_WRAP CascadeClassifier( const String& filename );
virtual ~CascadeClassifier(); virtual ~CascadeClassifier();
CV_WRAP virtual bool empty() const; CV_WRAP virtual bool empty() const;
CV_WRAP bool load( const cv::String& filename ); CV_WRAP bool load( const String& filename );
virtual bool read( const FileNode& node ); virtual bool read( const FileNode& node );
CV_WRAP virtual void detectMultiScale( const Mat& image, CV_WRAP virtual void detectMultiScale( const Mat& image,
CV_OUT std::vector<Rect>& objects, CV_OUT std::vector<Rect>& objects,
@ -524,7 +524,7 @@ public:
gammaCorrection(_gammaCorrection), nlevels(_nlevels) gammaCorrection(_gammaCorrection), nlevels(_nlevels)
{} {}
CV_WRAP HOGDescriptor(const cv::String& filename) CV_WRAP HOGDescriptor(const String& filename)
{ {
load(filename); load(filename);
} }
@ -543,10 +543,10 @@ public:
CV_WRAP virtual void setSVMDetector(InputArray _svmdetector); CV_WRAP virtual void setSVMDetector(InputArray _svmdetector);
virtual bool read(FileNode& fn); virtual bool read(FileNode& fn);
virtual void write(FileStorage& fs, const cv::String& objname) const; virtual void write(FileStorage& fs, const String& objname) const;
CV_WRAP virtual bool load(const cv::String& filename, const cv::String& objname=cv::String()); CV_WRAP virtual bool load(const String& filename, const String& objname=String());
CV_WRAP virtual void save(const cv::String& filename, const cv::String& objname=cv::String()) const; CV_WRAP virtual void save(const String& filename, const String& objname=String()) const;
virtual void copyTo(HOGDescriptor& c) const; virtual void copyTo(HOGDescriptor& c) const;
CV_WRAP virtual void compute(const Mat& img, CV_WRAP virtual void compute(const Mat& img,
@ -609,16 +609,16 @@ public:
int groupThreshold = 0) const; int groupThreshold = 0) const;
// read/parse Dalal's alt model file // read/parse Dalal's alt model file
void readALTModel(cv::String modelfile); void readALTModel(String modelfile);
}; };
CV_EXPORTS_W void findDataMatrix(InputArray image, CV_EXPORTS_W void findDataMatrix(InputArray image,
CV_OUT std::vector<cv::String>& codes, CV_OUT std::vector<String>& codes,
OutputArray corners=noArray(), OutputArray corners=noArray(),
OutputArrayOfArrays dmtx=noArray()); OutputArrayOfArrays dmtx=noArray());
CV_EXPORTS_W void drawDataMatrixCodes(InputOutputArray image, CV_EXPORTS_W void drawDataMatrixCodes(InputOutputArray image,
const std::vector<cv::String>& codes, const std::vector<String>& codes,
InputArray corners); InputArray corners);
} }
@ -758,7 +758,7 @@ public:
return processImpl(src, mask); return processImpl(src, mask);
} }
virtual cv::String name() const =0; virtual String name() const =0;
virtual void read(const FileNode& fn) =0; virtual void read(const FileNode& fn) =0;
virtual void write(FileStorage& fs) const =0; virtual void write(FileStorage& fs) const =0;
@ -770,7 +770,7 @@ public:
* - "ColorGradient" * - "ColorGradient"
* - "DepthNormal" * - "DepthNormal"
*/ */
static Ptr<Modality> create(const cv::String& modality_type); static Ptr<Modality> create(const String& modality_type);
/** /**
* \brief Load a modality from file. * \brief Load a modality from file.
@ -804,7 +804,7 @@ public:
*/ */
ColorGradient(float weak_threshold, size_t num_features, float strong_threshold); ColorGradient(float weak_threshold, size_t num_features, float strong_threshold);
virtual cv::String name() const; virtual String name() const;
virtual void read(const FileNode& fn); virtual void read(const FileNode& fn);
virtual void write(FileStorage& fs) const; virtual void write(FileStorage& fs) const;
@ -842,7 +842,7 @@ public:
DepthNormal(int distance_threshold, int difference_threshold, size_t num_features, DepthNormal(int distance_threshold, int difference_threshold, size_t num_features,
int extract_threshold); int extract_threshold);
virtual cv::String name() const; virtual String name() const;
virtual void read(const FileNode& fn); virtual void read(const FileNode& fn);
virtual void write(FileStorage& fs) const; virtual void write(FileStorage& fs) const;
@ -871,7 +871,7 @@ struct CV_EXPORTS Match
{ {
} }
Match(int x, int y, float similarity, const cv::String& class_id, int template_id); Match(int x, int y, float similarity, const String& class_id, int template_id);
/// Sort matches with high similarity to the front /// Sort matches with high similarity to the front
bool operator<(const Match& rhs) const bool operator<(const Match& rhs) const
@ -891,11 +891,11 @@ struct CV_EXPORTS Match
int x; int x;
int y; int y;
float similarity; float similarity;
cv::String class_id; String class_id;
int template_id; int template_id;
}; };
inline Match::Match(int _x, int _y, float _similarity, const cv::String& _class_id, int _template_id) inline Match::Match(int _x, int _y, float _similarity, const String& _class_id, int _template_id)
: x(_x), y(_y), similarity(_similarity), class_id(_class_id), template_id(_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. * empty or the same size as its corresponding source.
*/ */
void match(const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches, void match(const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches,
const std::vector<cv::String>& class_ids = std::vector<cv::String>(), const std::vector<String>& class_ids = std::vector<String>(),
OutputArrayOfArrays quantized_images = noArray(), OutputArrayOfArrays quantized_images = noArray(),
const std::vector<Mat>& masks = std::vector<Mat>()) const; const std::vector<Mat>& masks = std::vector<Mat>()) const;
@ -951,13 +951,13 @@ public:
* *
* \return Template ID, or -1 if failed to extract a valid template. * \return Template ID, or -1 if failed to extract a valid template.
*/ */
int addTemplate(const std::vector<Mat>& sources, const cv::String& class_id, int addTemplate(const std::vector<Mat>& sources, const String& class_id,
const Mat& object_mask, Rect* bounding_box = NULL); const Mat& object_mask, Rect* bounding_box = NULL);
/** /**
* \brief Add a new object template computed by external means. * \brief Add a new object template computed by external means.
*/ */
int addSyntheticTemplate(const std::vector<Template>& templates, const cv::String& class_id); int addSyntheticTemplate(const std::vector<Template>& templates, const String& class_id);
/** /**
* \brief Get the modalities used by this detector. * \brief Get the modalities used by this detector.
@ -983,23 +983,23 @@ public:
* For example, with 2 modalities (Gradient, Normal) and two pyramid levels * For example, with 2 modalities (Gradient, Normal) and two pyramid levels
* (L0, L1), the order is (GradientL0, NormalL0, GradientL1, NormalL1). * (L0, L1), the order is (GradientL0, NormalL0, GradientL1, NormalL1).
*/ */
const std::vector<Template>& getTemplates(const cv::String& class_id, int template_id) const; const std::vector<Template>& getTemplates(const String& class_id, int template_id) const;
int numTemplates() const; int numTemplates() const;
int numTemplates(const cv::String& class_id) const; int numTemplates(const String& class_id) const;
int numClasses() const { return static_cast<int>(class_templates.size()); } int numClasses() const { return static_cast<int>(class_templates.size()); }
std::vector<cv::String> classIds() const; std::vector<String> classIds() const;
void read(const FileNode& fn); void read(const FileNode& fn);
void write(FileStorage& fs) const; void write(FileStorage& fs) const;
cv::String readClass(const FileNode& fn, const cv::String &class_id_override = ""); String readClass(const FileNode& fn, const String &class_id_override = "");
void writeClass(const cv::String& class_id, FileStorage& fs) const; void writeClass(const String& class_id, FileStorage& fs) const;
void readClasses(const std::vector<cv::String>& class_ids, void readClasses(const std::vector<String>& class_ids,
const cv::String& format = "templates_%s.yml.gz"); const String& format = "templates_%s.yml.gz");
void writeClasses(const cv::String& format = "templates_%s.yml.gz") const; void writeClasses(const String& format = "templates_%s.yml.gz") const;
protected: protected:
std::vector< Ptr<Modality> > modalities; std::vector< Ptr<Modality> > modalities;
@ -1007,7 +1007,7 @@ protected:
std::vector<int> T_at_level; std::vector<int> T_at_level;
typedef std::vector<Template> TemplatePyramid; typedef std::vector<Template> TemplatePyramid;
typedef std::map<cv::String, std::vector<TemplatePyramid> > TemplatesMap; typedef std::map<String, std::vector<TemplatePyramid> > TemplatesMap;
TemplatesMap class_templates; TemplatesMap class_templates;
typedef std::vector<Mat> LinearMemories; typedef std::vector<Mat> LinearMemories;
@ -1017,7 +1017,7 @@ protected:
void matchClass(const LinearMemoryPyramid& lm_pyramid, void matchClass(const LinearMemoryPyramid& lm_pyramid,
const std::vector<Size>& sizes, const std::vector<Size>& sizes,
float threshold, std::vector<Match>& matches, float threshold, std::vector<Match>& matches,
const cv::String& class_id, const String& class_id,
const std::vector<TemplatePyramid>& template_pyramids) const; const std::vector<TemplatePyramid>& template_pyramids) const;
}; };

@ -852,7 +852,7 @@ CascadeClassifier::CascadeClassifier()
{ {
} }
CascadeClassifier::CascadeClassifier(const cv::String& filename) CascadeClassifier::CascadeClassifier(const String& filename)
{ {
load(filename); load(filename);
} }
@ -866,7 +866,7 @@ bool CascadeClassifier::empty() const
return oldCascade.empty() && data.stages.empty(); return oldCascade.empty() && data.stages.empty();
} }
bool CascadeClassifier::load(const cv::String& filename) bool CascadeClassifier::load(const String& filename)
{ {
oldCascade.release(); oldCascade.release();
data = Data(); data = Data();
@ -1207,13 +1207,13 @@ bool CascadeClassifier::Data::read(const FileNode &root)
static const float THRESHOLD_EPS = 1e-5f; static const float THRESHOLD_EPS = 1e-5f;
// load stage params // load stage params
cv::String stageTypeStr = (cv::String)root[CC_STAGE_TYPE]; String stageTypeStr = (String)root[CC_STAGE_TYPE];
if( stageTypeStr == CC_BOOST ) if( stageTypeStr == CC_BOOST )
stageType = BOOST; stageType = BOOST;
else else
return false; return false;
cv::String featureTypeStr = (cv::String)root[CC_FEATURE_TYPE]; String featureTypeStr = (String)root[CC_FEATURE_TYPE];
if( featureTypeStr == CC_HAAR ) if( featureTypeStr == CC_HAAR )
featureType = FeatureEvaluator::HAAR; featureType = FeatureEvaluator::HAAR;
else if( featureTypeStr == CC_LBP ) else if( featureTypeStr == CC_LBP )

@ -489,7 +489,7 @@ namespace cv
{ {
void findDataMatrix(InputArray _image, void findDataMatrix(InputArray _image,
std::vector<cv::String>& codes, std::vector<String>& codes,
OutputArray _corners, OutputArray _corners,
OutputArrayOfArrays _dmtx) OutputArrayOfArrays _dmtx)
{ {
@ -513,7 +513,7 @@ void findDataMatrix(InputArray _image,
for( i = 0; i < n; i++ ) for( i = 0; i < n; i++ )
{ {
CvDataMatrixCode& rc_i = rc[i]; CvDataMatrixCode& rc_i = rc[i];
codes[i] = cv::String(rc_i.msg); codes[i] = String(rc_i.msg);
if( corners.data ) if( corners.data )
{ {
@ -535,7 +535,7 @@ void findDataMatrix(InputArray _image,
} }
void drawDataMatrixCodes(InputOutputArray _image, void drawDataMatrixCodes(InputOutputArray _image,
const std::vector<cv::String>& codes, const std::vector<String>& codes,
InputArray _corners) InputArray _corners)
{ {
Mat image = _image.getMat(); Mat image = _image.getMat();

@ -121,7 +121,7 @@ bool HOGDescriptor::read(FileNode& obj)
return true; return true;
} }
void HOGDescriptor::write(FileStorage& fs, const cv::String& objName) const void HOGDescriptor::write(FileStorage& fs, const String& objName) const
{ {
if( !objName.empty() ) if( !objName.empty() )
fs << objName; fs << objName;
@ -143,14 +143,14 @@ void HOGDescriptor::write(FileStorage& fs, const cv::String& objName) const
fs << "}"; fs << "}";
} }
bool HOGDescriptor::load(const cv::String& filename, const cv::String& objname) bool HOGDescriptor::load(const String& filename, const String& objname)
{ {
FileStorage fs(filename, FileStorage::READ); FileStorage fs(filename, FileStorage::READ);
FileNode obj = !objname.empty() ? fs[objname] : fs.getFirstTopLevelNode(); FileNode obj = !objname.empty() ? fs[objname] : fs.getFirstTopLevelNode();
return read(obj); return read(obj);
} }
void HOGDescriptor::save(const cv::String& filename, const cv::String& objName) const void HOGDescriptor::save(const String& filename, const String& objName) const
{ {
FileStorage fs(filename, FileStorage::WRITE); FileStorage fs(filename, FileStorage::WRITE);
write(fs, !objName.empty() ? objName : FileStorage::getDefaultObjectName(filename)); write(fs, !objName.empty() ? objName : FileStorage::getDefaultObjectName(filename));
@ -2788,29 +2788,29 @@ void HOGDescriptor::detectMultiScaleROI(const cv::Mat& img,
cv::groupRectangles(foundLocations, groupThreshold, 0.2); cv::groupRectangles(foundLocations, groupThreshold, 0.2);
} }
void HOGDescriptor::readALTModel(cv::String modelfile) void HOGDescriptor::readALTModel(String modelfile)
{ {
// read model from SVMlight format.. // read model from SVMlight format..
FILE *modelfl; FILE *modelfl;
if ((modelfl = fopen(modelfile.c_str(), "rb")) == NULL) if ((modelfl = fopen(modelfile.c_str(), "rb")) == NULL)
{ {
cv::String eerr("file not exist"); String eerr("file not exist");
cv::String efile(__FILE__); String efile(__FILE__);
cv::String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__); throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
} }
char version_buffer[10]; char version_buffer[10];
if (!fread (&version_buffer,sizeof(char),10,modelfl)) if (!fread (&version_buffer,sizeof(char),10,modelfl))
{ {
cv::String eerr("version?"); String eerr("version?");
cv::String efile(__FILE__); String efile(__FILE__);
cv::String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__); throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
} }
if(strcmp(version_buffer,"V6.01")) { if(strcmp(version_buffer,"V6.01")) {
cv::String eerr("version doesnot match"); String eerr("version doesnot match");
cv::String efile(__FILE__); String efile(__FILE__);
cv::String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__); throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
} }
/* read version number */ /* read version number */
@ -2819,9 +2819,9 @@ void HOGDescriptor::readALTModel(cv::String modelfile)
{ throw Exception(); } { throw Exception(); }
if (version < 200) if (version < 200)
{ {
cv::String eerr("version doesnot match"); String eerr("version doesnot match");
cv::String efile(__FILE__); String efile(__FILE__);
cv::String efunc(__FUNCTION__); String efunc(__FUNCTION__);
throw Exception(); throw Exception();
} }
int kernel_type; int kernel_type;

@ -158,7 +158,7 @@ LatentSvmDetector::ObjectDetection::ObjectDetection( const Rect& _rect, float _s
LatentSvmDetector::LatentSvmDetector() LatentSvmDetector::LatentSvmDetector()
{} {}
LatentSvmDetector::LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames ) LatentSvmDetector::LatentSvmDetector( const std::vector<String>& filenames, const std::vector<String>& _classNames )
{ {
load( filenames, _classNames ); load( filenames, _classNames );
} }
@ -182,7 +182,7 @@ bool LatentSvmDetector::empty() const
return detectors.empty(); return detectors.empty();
} }
const std::vector<cv::String>& LatentSvmDetector::getClassNames() const const std::vector<String>& LatentSvmDetector::getClassNames() const
{ {
return classNames; return classNames;
} }
@ -192,13 +192,13 @@ size_t LatentSvmDetector::getClassCount() const
return classNames.size(); return classNames.size();
} }
static cv::String extractModelName( const cv::String& filename ) static String extractModelName( const String& filename )
{ {
size_t startPos = filename.rfind('/'); size_t startPos = filename.rfind('/');
if( startPos == cv::String::npos ) if( startPos == String::npos )
startPos = filename.rfind('\\'); startPos = filename.rfind('\\');
if( startPos == cv::String::npos ) if( startPos == String::npos )
startPos = 0; startPos = 0;
else else
startPos++; startPos++;
@ -210,7 +210,7 @@ static cv::String extractModelName( const cv::String& filename )
return filename.substr(startPos, substrLength); return filename.substr(startPos, substrLength);
} }
bool LatentSvmDetector::load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames ) bool LatentSvmDetector::load( const std::vector<String>& filenames, const std::vector<String>& _classNames )
{ {
clear(); clear();
@ -218,7 +218,7 @@ bool LatentSvmDetector::load( const std::vector<cv::String>& filenames, const st
for( size_t i = 0; i < filenames.size(); i++ ) for( size_t i = 0; i < filenames.size(); i++ )
{ {
const cv::String filename = filenames[i]; const String filename = filenames[i];
if( filename.length() < 5 || filename.substr(filename.length()-4, 4) != ".xml" ) if( filename.length() < 5 || filename.substr(filename.length()-4, 4) != ".xml" )
continue; continue;

@ -201,7 +201,7 @@ void QuantizedPyramid::selectScatteredFeatures(const std::vector<Candidate>& can
} }
} }
Ptr<Modality> Modality::create(const cv::String& modality_type) Ptr<Modality> Modality::create(const String& modality_type)
{ {
if (modality_type == "ColorGradient") if (modality_type == "ColorGradient")
return new ColorGradient(); return new ColorGradient();
@ -213,7 +213,7 @@ Ptr<Modality> Modality::create(const cv::String& modality_type)
Ptr<Modality> Modality::create(const FileNode& fn) Ptr<Modality> Modality::create(const FileNode& fn)
{ {
cv::String type = fn["type"]; String type = fn["type"];
Ptr<Modality> modality = create(type); Ptr<Modality> modality = create(type);
modality->read(fn); modality->read(fn);
return modality; return modality;
@ -566,7 +566,7 @@ ColorGradient::ColorGradient(float _weak_threshold, size_t _num_features, float
static const char CG_NAME[] = "ColorGradient"; static const char CG_NAME[] = "ColorGradient";
cv::String ColorGradient::name() const String ColorGradient::name() const
{ {
return CG_NAME; return CG_NAME;
} }
@ -579,7 +579,7 @@ Ptr<QuantizedPyramid> ColorGradient::processImpl(const Mat& src,
void ColorGradient::read(const FileNode& fn) void ColorGradient::read(const FileNode& fn)
{ {
cv::String type = fn["type"]; String type = fn["type"];
CV_Assert(type == CG_NAME); CV_Assert(type == CG_NAME);
weak_threshold = fn["weak_threshold"]; weak_threshold = fn["weak_threshold"];
@ -887,7 +887,7 @@ DepthNormal::DepthNormal(int _distance_threshold, int _difference_threshold, siz
static const char DN_NAME[] = "DepthNormal"; static const char DN_NAME[] = "DepthNormal";
cv::String DepthNormal::name() const String DepthNormal::name() const
{ {
return DN_NAME; return DN_NAME;
} }
@ -901,7 +901,7 @@ Ptr<QuantizedPyramid> DepthNormal::processImpl(const Mat& src,
void DepthNormal::read(const FileNode& fn) void DepthNormal::read(const FileNode& fn)
{ {
cv::String type = fn["type"]; String type = fn["type"];
CV_Assert(type == DN_NAME); CV_Assert(type == DN_NAME);
distance_threshold = fn["distance_threshold"]; distance_threshold = fn["distance_threshold"];
@ -1397,7 +1397,7 @@ Detector::Detector(const std::vector< Ptr<Modality> >& _modalities,
} }
void Detector::match(const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches, void Detector::match(const std::vector<Mat>& sources, float threshold, std::vector<Match>& matches,
const std::vector<cv::String>& class_ids, OutputArrayOfArrays quantized_images, const std::vector<String>& class_ids, OutputArrayOfArrays quantized_images,
const std::vector<Mat>& masks) const const std::vector<Mat>& masks) const
{ {
matches.clear(); matches.clear();
@ -1488,7 +1488,7 @@ struct MatchPredicate
void Detector::matchClass(const LinearMemoryPyramid& lm_pyramid, void Detector::matchClass(const LinearMemoryPyramid& lm_pyramid,
const std::vector<Size>& sizes, const std::vector<Size>& sizes,
float threshold, std::vector<Match>& matches, float threshold, std::vector<Match>& matches,
const cv::String& class_id, const String& class_id,
const std::vector<TemplatePyramid>& template_pyramids) const const std::vector<TemplatePyramid>& template_pyramids) const
{ {
// For each template... // For each template...
@ -1613,7 +1613,7 @@ void Detector::matchClass(const LinearMemoryPyramid& lm_pyramid,
} }
} }
int Detector::addTemplate(const std::vector<Mat>& sources, const cv::String& class_id, int Detector::addTemplate(const std::vector<Mat>& sources, const String& class_id,
const Mat& object_mask, Rect* bounding_box) const Mat& object_mask, Rect* bounding_box)
{ {
int num_modalities = static_cast<int>(modalities.size()); int num_modalities = static_cast<int>(modalities.size());
@ -1649,7 +1649,7 @@ int Detector::addTemplate(const std::vector<Mat>& sources, const cv::String& cla
return template_id; return template_id;
} }
int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const cv::String& class_id) int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const String& class_id)
{ {
std::vector<TemplatePyramid>& template_pyramids = class_templates[class_id]; std::vector<TemplatePyramid>& template_pyramids = class_templates[class_id];
int template_id = static_cast<int>(template_pyramids.size()); int template_id = static_cast<int>(template_pyramids.size());
@ -1657,7 +1657,7 @@ int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const
return template_id; return template_id;
} }
const std::vector<Template>& Detector::getTemplates(const cv::String& class_id, int template_id) const const std::vector<Template>& Detector::getTemplates(const String& class_id, int template_id) const
{ {
TemplatesMap::const_iterator i = class_templates.find(class_id); TemplatesMap::const_iterator i = class_templates.find(class_id);
CV_Assert(i != class_templates.end()); CV_Assert(i != class_templates.end());
@ -1674,7 +1674,7 @@ int Detector::numTemplates() const
return ret; return ret;
} }
int Detector::numTemplates(const cv::String& class_id) const int Detector::numTemplates(const String& class_id) const
{ {
TemplatesMap::const_iterator i = class_templates.find(class_id); TemplatesMap::const_iterator i = class_templates.find(class_id);
if (i == class_templates.end()) if (i == class_templates.end())
@ -1682,9 +1682,9 @@ int Detector::numTemplates(const cv::String& class_id) const
return static_cast<int>(i->second.size()); return static_cast<int>(i->second.size());
} }
std::vector<cv::String> Detector::classIds() const std::vector<String> Detector::classIds() const
{ {
std::vector<cv::String> ids; std::vector<String> ids;
TemplatesMap::const_iterator i = class_templates.begin(), iend = class_templates.end(); TemplatesMap::const_iterator i = class_templates.begin(), iend = class_templates.end();
for ( ; i != iend; ++i) for ( ; i != iend; ++i)
{ {
@ -1724,7 +1724,7 @@ void Detector::write(FileStorage& fs) const
fs << "]"; // modalities fs << "]"; // modalities
} }
cv::String Detector::readClass(const FileNode& fn, const cv::String &class_id_override) String Detector::readClass(const FileNode& fn, const String &class_id_override)
{ {
// Verify compatible with Detector settings // Verify compatible with Detector settings
FileNode mod_fn = fn["modalities"]; FileNode mod_fn = fn["modalities"];
@ -1732,14 +1732,14 @@ void Detector::write(FileStorage& fs) const
FileNodeIterator mod_it = mod_fn.begin(), mod_it_end = mod_fn.end(); FileNodeIterator mod_it = mod_fn.begin(), mod_it_end = mod_fn.end();
int i = 0; int i = 0;
for ( ; mod_it != mod_it_end; ++mod_it, ++i) for ( ; mod_it != mod_it_end; ++mod_it, ++i)
CV_Assert(modalities[i]->name() == (cv::String)(*mod_it)); CV_Assert(modalities[i]->name() == (String)(*mod_it));
CV_Assert((int)fn["pyramid_levels"] == pyramid_levels); CV_Assert((int)fn["pyramid_levels"] == pyramid_levels);
// Detector should not already have this class // Detector should not already have this class
cv::String class_id; String class_id;
if (class_id_override.empty()) if (class_id_override.empty())
{ {
cv::String class_id_tmp = fn["class_id"]; String class_id_tmp = fn["class_id"];
CV_Assert(class_templates.find(class_id_tmp) == class_templates.end()); CV_Assert(class_templates.find(class_id_tmp) == class_templates.end());
class_id = class_id_tmp; class_id = class_id_tmp;
} }
@ -1774,7 +1774,7 @@ void Detector::write(FileStorage& fs) const
return class_id; return class_id;
} }
void Detector::writeClass(const cv::String& class_id, FileStorage& fs) const void Detector::writeClass(const String& class_id, FileStorage& fs) const
{ {
TemplatesMap::const_iterator it = class_templates.find(class_id); TemplatesMap::const_iterator it = class_templates.find(class_id);
CV_Assert(it != class_templates.end()); CV_Assert(it != class_templates.end());
@ -1805,25 +1805,25 @@ void Detector::writeClass(const cv::String& class_id, FileStorage& fs) const
fs << "]"; // pyramids fs << "]"; // pyramids
} }
void Detector::readClasses(const std::vector<cv::String>& class_ids, void Detector::readClasses(const std::vector<String>& class_ids,
const cv::String& format) const String& format)
{ {
for (size_t i = 0; i < class_ids.size(); ++i) for (size_t i = 0; i < class_ids.size(); ++i)
{ {
const cv::String& class_id = class_ids[i]; const String& class_id = class_ids[i];
cv::String filename = cv::format(format.c_str(), class_id.c_str()); String filename = cv::format(format.c_str(), class_id.c_str());
FileStorage fs(filename, FileStorage::READ); FileStorage fs(filename, FileStorage::READ);
readClass(fs.root()); readClass(fs.root());
} }
} }
void Detector::writeClasses(const cv::String& format) const void Detector::writeClasses(const String& format) const
{ {
TemplatesMap::const_iterator it = class_templates.begin(), it_end = class_templates.end(); TemplatesMap::const_iterator it = class_templates.begin(), it_end = class_templates.end();
for ( ; it != it_end; ++it) for ( ; it != it_end; ++it)
{ {
const cv::String& class_id = it->first; const String& class_id = it->first;
cv::String filename = cv::format(format.c_str(), class_id.c_str()); String filename = cv::format(format.c_str(), class_id.c_str());
FileStorage fs(filename, FileStorage::WRITE); FileStorage fs(filename, FileStorage::WRITE);
writeClass(class_id, fs); writeClass(class_id, fs);
} }

@ -103,7 +103,7 @@ namespace cv
~Info(); ~Info();
void release(); void release();
Info &operator = (const Info &m); Info &operator = (const Info &m);
std::vector<cv::String> DeviceName; std::vector<String> DeviceName;
}; };
//////////////////////////////// Initialization & Info //////////////////////// //////////////////////////////// Initialization & Info ////////////////////////
//this function may be obsoleted //this function may be obsoleted
@ -161,7 +161,7 @@ namespace cv
//! Calls a kernel, by string. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing. //! Calls a kernel, by string. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
CV_EXPORTS double openCLExecuteKernelInterop(Context *clCxt , CV_EXPORTS double openCLExecuteKernelInterop(Context *clCxt ,
const char **source, cv::String kernelName, const char **source, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options, int channels, int depth, const char *build_options,
@ -170,7 +170,7 @@ namespace cv
//! Calls a kernel, by file. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing. //! Calls a kernel, by file. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
CV_EXPORTS double openCLExecuteKernelInterop(Context *clCxt , CV_EXPORTS double openCLExecuteKernelInterop(Context *clCxt ,
const char **fileName, const int numFiles, cv::String kernelName, const char **fileName, const int numFiles, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options, int channels, int depth, const char *build_options,

@ -79,18 +79,18 @@ namespace cv
cl_mem CV_EXPORTS openCLCreateBuffer(Context *clCxt, size_t flag, size_t size); cl_mem CV_EXPORTS openCLCreateBuffer(Context *clCxt, size_t flag, size_t size);
void CV_EXPORTS openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size); void CV_EXPORTS openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt, cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
const char **source, cv::String kernelName); const char **source, String kernelName);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt, cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
const char **source, cv::String kernelName, const char *build_options); const char **source, String kernelName, const char *build_options);
void CV_EXPORTS openCLVerifyKernel(const Context *clCxt, cl_kernel kernel, size_t *localThreads); void CV_EXPORTS openCLVerifyKernel(const Context *clCxt, cl_kernel kernel, size_t *localThreads);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, cv::String kernelName, std::vector< std::pair<size_t, const void *> > &args, void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, String kernelName, std::vector< std::pair<size_t, const void *> > &args,
int globalcols , int globalrows, size_t blockSize = 16, int kernel_expand_depth = -1, int kernel_expand_channel = -1); int globalcols , int globalrows, size_t blockSize = 16, int kernel_expand_depth = -1, int kernel_expand_channel = -1);
void CV_EXPORTS openCLExecuteKernel_(Context *clCxt , const char **source, cv::String kernelName, void CV_EXPORTS openCLExecuteKernel_(Context *clCxt , const char **source, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options); std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth); size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth);
void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, const char *build_options); int depth, const char *build_options);
@ -108,9 +108,9 @@ namespace cv
DISABLE DISABLE
}; };
void CV_EXPORTS openCLExecuteKernel2(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel2(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, FLUSH_MODE finish_mode = DISABLE); size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, FLUSH_MODE finish_mode = DISABLE);
void CV_EXPORTS openCLExecuteKernel2(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel2(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, char *build_options, FLUSH_MODE finish_mode = DISABLE); int depth, char *build_options, FLUSH_MODE finish_mode = DISABLE);
// bind oclMat to OpenCL image textures // bind oclMat to OpenCL image textures

@ -129,7 +129,7 @@ inline int divUp(int total, int grain)
/////////////////////// add subtract multiply divide ///////////////////////// /////////////////////// add subtract multiply divide /////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
template<typename T> template<typename T>
void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, const char **kernelString, void *_scalar) void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName, const char **kernelString, void *_scalar)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -188,11 +188,11 @@ void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::Str
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth);
} }
static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, const char **kernelString) static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName, const char **kernelString)
{ {
arithmetic_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL); arithmetic_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL);
} }
static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString) static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -266,7 +266,7 @@ void cv::ocl::subtract(const oclMat &src1, const oclMat &src2, oclMat &dst, cons
{ {
arithmetic_run(src1, src2, dst, mask, "arithm_sub_with_mask", &arithm_sub); arithmetic_run(src1, src2, dst, mask, "arithm_sub_with_mask", &arithm_sub);
} }
typedef void (*MulDivFunc)(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, typedef void (*MulDivFunc)(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName,
const char **kernelString, void *scalar); const char **kernelString, void *scalar);
void cv::ocl::multiply(const oclMat &src1, const oclMat &src2, oclMat &dst, double scalar) void cv::ocl::multiply(const oclMat &src1, const oclMat &src2, oclMat &dst, double scalar)
@ -286,7 +286,7 @@ void cv::ocl::divide(const oclMat &src1, const oclMat &src2, oclMat &dst, double
} }
template <typename WT , typename CL_WT> template <typename WT , typename CL_WT>
void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString, int isMatSubScalar) void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString, int isMatSubScalar)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -358,7 +358,7 @@ void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst,
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, channels, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, channels, depth);
} }
static void arithmetic_scalar_run(const oclMat &src, oclMat &dst, cv::String kernelName, const char **kernelString, double scalar) static void arithmetic_scalar_run(const oclMat &src, oclMat &dst, String kernelName, const char **kernelString, double scalar)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
@ -415,10 +415,10 @@ static void arithmetic_scalar_run(const oclMat &src, oclMat &dst, cv::String ker
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth);
} }
typedef void (*ArithmeticFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString, int isMatSubScalar); typedef void (*ArithmeticFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString, int isMatSubScalar);
static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString, int isMatSubScalar) static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString, int isMatSubScalar)
{ {
static ArithmeticFuncS tab[8] = static ArithmeticFuncS tab[8] =
{ {
@ -436,14 +436,14 @@ static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &ds
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__); cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__);
func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar); func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar);
} }
static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString) static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString)
{ {
arithmetic_scalar(src1, src2, dst, mask, kernelName, kernelString, 0); arithmetic_scalar(src1, src2, dst, mask, kernelName, kernelString, 0);
} }
void cv::ocl::add(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask) void cv::ocl::add(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask)
{ {
cv::String kernelName = mask.data ? "arithm_s_add_with_mask" : "arithm_s_add"; String kernelName = mask.data ? "arithm_s_add_with_mask" : "arithm_s_add";
const char **kernelString = mask.data ? &arithm_add_scalar_mask : &arithm_add_scalar; const char **kernelString = mask.data ? &arithm_add_scalar_mask : &arithm_add_scalar;
arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString); arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString);
@ -451,13 +451,13 @@ void cv::ocl::add(const oclMat &src1, const Scalar &src2, oclMat &dst, const ocl
void cv::ocl::subtract(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask) void cv::ocl::subtract(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask)
{ {
cv::String kernelName = mask.data ? "arithm_s_sub_with_mask" : "arithm_s_sub"; String kernelName = mask.data ? "arithm_s_sub_with_mask" : "arithm_s_sub";
const char **kernelString = mask.data ? &arithm_sub_scalar_mask : &arithm_sub_scalar; const char **kernelString = mask.data ? &arithm_sub_scalar_mask : &arithm_sub_scalar;
arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString, 1); arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString, 1);
} }
void cv::ocl::subtract(const Scalar &src2, const oclMat &src1, oclMat &dst, const oclMat &mask) void cv::ocl::subtract(const Scalar &src2, const oclMat &src1, oclMat &dst, const oclMat &mask)
{ {
cv::String kernelName = mask.data ? "arithm_s_sub_with_mask" : "arithm_s_sub"; String kernelName = mask.data ? "arithm_s_sub_with_mask" : "arithm_s_sub";
const char **kernelString = mask.data ? &arithm_sub_scalar_mask : &arithm_sub_scalar; const char **kernelString = mask.data ? &arithm_sub_scalar_mask : &arithm_sub_scalar;
arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString, -1); arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString, -1);
} }
@ -469,7 +469,7 @@ void cv::ocl::divide(double scalar, const oclMat &src, oclMat &dst)
return; return;
} }
cv::String kernelName = "arithm_s_div"; String kernelName = "arithm_s_div";
arithmetic_scalar_run(src, dst, kernelName, &arithm_div, scalar); arithmetic_scalar_run(src, dst, kernelName, &arithm_div, scalar);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -481,14 +481,14 @@ void cv::ocl::absdiff(const oclMat &src1, const oclMat &src2, oclMat &dst)
} }
void cv::ocl::absdiff(const oclMat &src1, const Scalar &src2, oclMat &dst) void cv::ocl::absdiff(const oclMat &src1, const Scalar &src2, oclMat &dst)
{ {
cv::String kernelName = "arithm_s_absdiff"; String kernelName = "arithm_s_absdiff";
oclMat mask; oclMat mask;
arithmetic_scalar( src1, src2, dst, mask, kernelName, &arithm_absdiff); arithmetic_scalar( src1, src2, dst, mask, kernelName, &arithm_absdiff);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
///////////////////////////////// compare /////////////////////////////////// ///////////////////////////////// compare ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void compare_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, const char **kernelString) static void compare_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName, const char **kernelString)
{ {
dst.create(src1.size(), CV_8UC1); dst.create(src1.size(), CV_8UC1);
CV_Assert(src1.oclchannels() == 1); CV_Assert(src1.oclchannels() == 1);
@ -528,7 +528,7 @@ void cv::ocl::compare(const oclMat &src1, const oclMat &src2, oclMat &dst , int
std::cout << "Selected device do not support double" << std::endl; std::cout << "Selected device do not support double" << std::endl;
return; return;
} }
cv::String kernelName; String kernelName;
const char **kernelString = NULL; const char **kernelString = NULL;
switch( cmpOp ) switch( cmpOp )
{ {
@ -700,7 +700,7 @@ void cv::ocl::meanStdDev(const oclMat &src, Scalar &mean, Scalar &stddev)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//////////////////////////////////// minMax ///////////////////////////////// //////////////////////////////////// minMax /////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen , int groupnum, cv::String kernelName) static void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen , int groupnum, String kernelName)
{ {
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;
int all_cols = src.step / (vlen * src.elemSize1()); int all_cols = src.step / (vlen * src.elemSize1());
@ -737,7 +737,7 @@ static void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem
} }
static void arithmetic_minMax_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum, cv::String kernelName) static void arithmetic_minMax_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum, String kernelName)
{ {
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;
size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1}; size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1};
@ -891,7 +891,7 @@ double cv::ocl::norm(const oclMat &src1, const oclMat &src2, int normType)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////// flip ////////////////////////////////////// ////////////////////////////////// flip //////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, cv::String kernelName) static void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, String kernelName)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
@ -940,7 +940,7 @@ static void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, cv::String
openCLExecuteKernel(clCxt, &arithm_flip, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, &arithm_flip, kernelName, globalThreads, localThreads, args, -1, depth);
} }
static void arithmetic_flip_cols_run(const oclMat &src, oclMat &dst, cv::String kernelName, bool isVertical) static void arithmetic_flip_cols_run(const oclMat &src, oclMat &dst, String kernelName, bool isVertical)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
@ -1011,7 +1011,7 @@ void cv::ocl::flip(const oclMat &src, oclMat &dst, int flipCode)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////// LUT ////////////////////////////////////// ////////////////////////////////// LUT //////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_lut_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName) static void arithmetic_lut_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName)
{ {
Context *clCxt = src1.clCxt; Context *clCxt = src1.clCxt;
int channels = src1.oclchannels(); int channels = src1.oclchannels();
@ -1105,14 +1105,14 @@ void cv::ocl::LUT(const oclMat &src, const oclMat &lut, oclMat &dst)
CV_Assert((lut.oclchannels() == 1 || lut.oclchannels() == cn) && lut.rows == 1 && lut.cols == 256); CV_Assert((lut.oclchannels() == 1 || lut.oclchannels() == cn) && lut.rows == 1 && lut.cols == 256);
dst.create(src.size(), CV_MAKETYPE(lut.depth(), cn)); dst.create(src.size(), CV_MAKETYPE(lut.depth(), cn));
//oclMat _lut(lut); //oclMat _lut(lut);
cv::String kernelName = "LUT"; String kernelName = "LUT";
arithmetic_lut_run(src, lut, dst, kernelName); arithmetic_lut_run(src, lut, dst, kernelName);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
//////////////////////////////// exp log ///////////////////////////////////// //////////////////////////////// exp log /////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, cv::String kernelName, const char **kernelString) static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, String kernelName, const char **kernelString)
{ {
dst.create(src.size(), src.type()); dst.create(src.size(), src.type());
CV_Assert(src.cols == dst.cols && CV_Assert(src.cols == dst.cols &&
@ -1161,7 +1161,7 @@ void cv::ocl::log(const oclMat &src, oclMat &dst)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////// magnitude phase /////////////////////////////// ////////////////////////////// magnitude phase ///////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName) static void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -1209,7 +1209,7 @@ void cv::ocl::magnitude(const oclMat &src1, const oclMat &src2, oclMat &dst)
arithmetic_magnitude_phase_run(src1, src2, dst, "arithm_magnitude"); arithmetic_magnitude_phase_run(src1, src2, dst, "arithm_magnitude");
} }
static void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, const char **kernelString) static void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName, const char **kernelString)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -1256,7 +1256,7 @@ void cv::ocl::phase(const oclMat &x, const oclMat &y, oclMat &Angle , bool angle
{ {
CV_Assert(x.type() == y.type() && x.size() == y.size() && (x.depth() == CV_32F || x.depth() == CV_64F)); CV_Assert(x.type() == y.type() && x.size() == y.size() && (x.depth() == CV_32F || x.depth() == CV_64F));
Angle.create(x.size(), x.type()); Angle.create(x.size(), x.type());
cv::String kernelName = angleInDegrees ? "arithm_phase_indegrees" : "arithm_phase_inradians"; String kernelName = angleInDegrees ? "arithm_phase_indegrees" : "arithm_phase_inradians";
if(angleInDegrees) if(angleInDegrees)
{ {
arithmetic_phase_run(x, y, Angle, kernelName, &arithm_phase); arithmetic_phase_run(x, y, Angle, kernelName, &arithm_phase);
@ -1273,7 +1273,7 @@ void cv::ocl::phase(const oclMat &x, const oclMat &y, oclMat &Angle , bool angle
////////////////////////////////// cartToPolar /////////////////////////////// ////////////////////////////////// cartToPolar ///////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_cartToPolar_run(const oclMat &src1, const oclMat &src2, oclMat &dst_mag, oclMat &dst_cart, static void arithmetic_cartToPolar_run(const oclMat &src1, const oclMat &src2, oclMat &dst_mag, oclMat &dst_cart,
cv::String kernelName, bool angleInDegrees) String kernelName, bool angleInDegrees)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -1328,7 +1328,7 @@ void cv::ocl::cartToPolar(const oclMat &x, const oclMat &y, oclMat &mag, oclMat
////////////////////////////////// polarToCart /////////////////////////////// ////////////////////////////////// polarToCart ///////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_ptc_run(const oclMat &src1, const oclMat &src2, oclMat &dst1, oclMat &dst2, bool angleInDegrees, static void arithmetic_ptc_run(const oclMat &src1, const oclMat &src2, oclMat &dst1, oclMat &dst2, bool angleInDegrees,
cv::String kernelName) String kernelName)
{ {
if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F) if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
{ {
@ -1530,7 +1530,7 @@ void cv::ocl::minMaxLoc(const oclMat &src, double *minVal, double *maxVal,
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
///////////////////////////// countNonZero /////////////////////////////////// ///////////////////////////// countNonZero ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void arithmetic_countNonZero_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, cv::String kernelName) static void arithmetic_countNonZero_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, String kernelName)
{ {
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;
int all_cols = src.step / (vlen * src.elemSize1()); int all_cols = src.step / (vlen * src.elemSize1());
@ -1568,7 +1568,7 @@ int cv::ocl::countNonZero(const oclMat &src)
int vlen = 8 , dbsize = groupnum * vlen; int vlen = 8 , dbsize = groupnum * vlen;
//cl_ulong start, end; //cl_ulong start, end;
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "arithm_op_nonzero"; String kernelName = "arithm_op_nonzero";
int *p = new int[dbsize], nonzero = 0; int *p = new int[dbsize], nonzero = 0;
cl_mem dstBuffer = openCLCreateBuffer(clCxt, CL_MEM_WRITE_ONLY, dbsize * sizeof(int)); cl_mem dstBuffer = openCLCreateBuffer(clCxt, CL_MEM_WRITE_ONLY, dbsize * sizeof(int));
arithmetic_countNonZero_run(src, dstBuffer, vlen, groupnum, kernelName); arithmetic_countNonZero_run(src, dstBuffer, vlen, groupnum, kernelName);
@ -1587,7 +1587,7 @@ int cv::ocl::countNonZero(const oclMat &src)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////bitwise_op//////////////////////////////////// ////////////////////////////////bitwise_op////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void bitwise_run(const oclMat &src1, oclMat &dst, cv::String kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, oclMat &dst, String kernelName, const char **kernelString)
{ {
dst.create(src1.size(), src1.type()); dst.create(src1.size(), src1.type());
@ -1629,7 +1629,7 @@ static void bitwise_run(const oclMat &src1, oclMat &dst, cv::String kernelName,
template<typename T> template<typename T>
void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, const char **kernelString, void *_scalar) void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName, const char **kernelString, void *_scalar)
{ {
dst.create(src1.size(), src1.type()); dst.create(src1.size(), src1.type());
CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols && CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols &&
@ -1681,11 +1681,11 @@ void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String
openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth); openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth);
} }
static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::String kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, String kernelName, const char **kernelString)
{ {
bitwise_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL); bitwise_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL);
} }
static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString)
{ {
dst.create(src1.size(), src1.type()); dst.create(src1.size(), src1.type());
CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols && CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols &&
@ -1738,7 +1738,7 @@ static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, con
template <typename WT , typename CL_WT> template <typename WT , typename CL_WT>
void bitwise_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString, int isMatSubScalar) void bitwise_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString, int isMatSubScalar)
{ {
dst.create(src1.size(), src1.type()); dst.create(src1.size(), src1.type());
@ -1804,10 +1804,10 @@ void bitwise_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, con
} }
typedef void (*BitwiseFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString, int isMatSubScalar); typedef void (*BitwiseFuncS)(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString, int isMatSubScalar);
static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString, int isMatSubScalar) static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString, int isMatSubScalar)
{ {
static BitwiseFuncS tab[8] = static BitwiseFuncS tab[8] =
{ {
@ -1837,7 +1837,7 @@ static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst,
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__); cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__);
func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar); func(src1, src2, dst, mask, kernelName, kernelString, isMatSubScalar);
} }
static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::String kernelName, const char **kernelString) static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, String kernelName, const char **kernelString)
{ {
bitwise_scalar(src1, src2, dst, mask, kernelName, kernelString, 0); bitwise_scalar(src1, src2, dst, mask, kernelName, kernelString, 0);
} }
@ -1850,7 +1850,7 @@ void cv::ocl::bitwise_not(const oclMat &src, oclMat &dst)
return; return;
} }
dst.create(src.size(), src.type()); dst.create(src.size(), src.type());
cv::String kernelName = "arithm_bitwise_not"; String kernelName = "arithm_bitwise_not";
bitwise_run(src, dst, kernelName, &arithm_bitwise_not); bitwise_run(src, dst, kernelName, &arithm_bitwise_not);
} }
@ -1863,7 +1863,7 @@ void cv::ocl::bitwise_or(const oclMat &src1, const oclMat &src2, oclMat &dst, co
return; return;
} }
oclMat emptyMat; oclMat emptyMat;
cv::String kernelName = mask.empty() ? "arithm_bitwise_or" : "arithm_bitwise_or_with_mask"; String kernelName = mask.empty() ? "arithm_bitwise_or" : "arithm_bitwise_or_with_mask";
if (mask.empty()) if (mask.empty())
bitwise_run(src1, src2, dst, kernelName, &arithm_bitwise_or); bitwise_run(src1, src2, dst, kernelName, &arithm_bitwise_or);
else else
@ -1878,7 +1878,7 @@ void cv::ocl::bitwise_or(const oclMat &src1, const Scalar &src2, oclMat &dst, co
std::cout << "Selected device do not support double" << std::endl; std::cout << "Selected device do not support double" << std::endl;
return; return;
} }
cv::String kernelName = mask.data ? "arithm_s_bitwise_or_with_mask" : "arithm_s_bitwise_or"; String kernelName = mask.data ? "arithm_s_bitwise_or_with_mask" : "arithm_s_bitwise_or";
if (mask.data) if (mask.data)
bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_or_scalar_mask); bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_or_scalar_mask);
else else
@ -1895,7 +1895,7 @@ void cv::ocl::bitwise_and(const oclMat &src1, const oclMat &src2, oclMat &dst, c
} }
oclMat emptyMat; oclMat emptyMat;
cv::String kernelName = mask.empty() ? "arithm_bitwise_and" : "arithm_bitwise_and_with_mask"; String kernelName = mask.empty() ? "arithm_bitwise_and" : "arithm_bitwise_and_with_mask";
if (mask.empty()) if (mask.empty())
bitwise_run(src1, src2, dst, kernelName, &arithm_bitwise_and); bitwise_run(src1, src2, dst, kernelName, &arithm_bitwise_and);
@ -1910,7 +1910,7 @@ void cv::ocl::bitwise_and(const oclMat &src1, const Scalar &src2, oclMat &dst, c
std::cout << "Selected device do not support double" << std::endl; std::cout << "Selected device do not support double" << std::endl;
return; return;
} }
cv::String kernelName = mask.data ? "arithm_s_bitwise_and_with_mask" : "arithm_s_bitwise_and"; String kernelName = mask.data ? "arithm_s_bitwise_and_with_mask" : "arithm_s_bitwise_and";
if (mask.data) if (mask.data)
bitwise_scalar(src1, src2, dst, mask, kernelName, &arithm_bitwise_and_scalar_mask); bitwise_scalar(src1, src2, dst, mask, kernelName, &arithm_bitwise_and_scalar_mask);
else else
@ -1925,7 +1925,7 @@ void cv::ocl::bitwise_xor(const oclMat &src1, const oclMat &src2, oclMat &dst, c
return; return;
} }
oclMat emptyMat; oclMat emptyMat;
cv::String kernelName = mask.empty() ? "arithm_bitwise_xor" : "arithm_bitwise_xor_with_mask"; String kernelName = mask.empty() ? "arithm_bitwise_xor" : "arithm_bitwise_xor_with_mask";
if (mask.empty()) if (mask.empty())
@ -1943,7 +1943,7 @@ void cv::ocl::bitwise_xor(const oclMat &src1, const Scalar &src2, oclMat &dst, c
std::cout << "Selected device do not support double" << std::endl; std::cout << "Selected device do not support double" << std::endl;
return; return;
} }
cv::String kernelName = mask.data ? "arithm_s_bitwise_xor_with_mask" : "arithm_s_bitwise_xor"; String kernelName = mask.data ? "arithm_s_bitwise_xor_with_mask" : "arithm_s_bitwise_xor";
if (mask.data) if (mask.data)
bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_xor_scalar_mask); bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_xor_scalar_mask);
else else
@ -2033,7 +2033,7 @@ oclMatExpr::operator oclMat() const
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#define TILE_DIM (32) #define TILE_DIM (32)
#define BLOCK_ROWS (256/TILE_DIM) #define BLOCK_ROWS (256/TILE_DIM)
static void transpose_run(const oclMat &src, oclMat &dst, cv::String kernelName) static void transpose_run(const oclMat &src, oclMat &dst, String kernelName)
{ {
if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F) if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.type() == CV_64F)
{ {
@ -2250,7 +2250,7 @@ void cv::ocl::magnitudeSqr(const oclMat &src1, oclMat &dst)
openCLExecuteKernel(clCxt, &arithm_magnitudeSqr, "magnitudeSqr", globalThreads, localThreads, args, 2, depth); openCLExecuteKernel(clCxt, &arithm_magnitudeSqr, "magnitudeSqr", globalThreads, localThreads, args, 2, depth);
} }
static void arithmetic_pow_run(const oclMat &src1, double p, oclMat &dst, cv::String kernelName, const char **kernelString) static void arithmetic_pow_run(const oclMat &src1, double p, oclMat &dst, String kernelName, const char **kernelString)
{ {
CV_Assert(src1.cols == dst.cols && src1.rows == dst.rows); CV_Assert(src1.cols == dst.cols && src1.rows == dst.rows);
CV_Assert(src1.type() == dst.type()); CV_Assert(src1.type() == dst.type());
@ -2301,7 +2301,7 @@ void cv::ocl::pow(const oclMat &x, double p, oclMat &y)
CV_Assert((x.type() == y.type() && x.size() == y.size() && x.depth() == CV_32F) || x.depth() == CV_64F); CV_Assert((x.type() == y.type() && x.size() == y.size() && x.depth() == CV_32F) || x.depth() == CV_64F);
y.create(x.size(), x.type()); y.create(x.size(), x.type());
cv::String kernelName = "arithm_pow"; String kernelName = "arithm_pow";
arithmetic_pow_run(x, p, y, kernelName, &arithm_pow); arithmetic_pow_run(x, p, y, kernelName, &arithm_pow);
} }

@ -68,13 +68,13 @@ namespace cv
} }
//lookup the binary given the file name //lookup the binary given the file name
cl_program progLookup(cv::String srcsign); cl_program progLookup(String srcsign);
//add program to the cache //add program to the cache
void addProgram(cv::String srcsign, cl_program program); void addProgram(String srcsign, cl_program program);
void releaseProgram(); void releaseProgram();
std::map <cv::String, cl_program> codeCache; std::map <String, cl_program> codeCache;
unsigned int cacheSize; unsigned int cacheSize;
//The presumed watermark for the cache volume (256MB). Is it enough? //The presumed watermark for the cache volume (256MB). Is it enough?
//We may need more delicate algorithms when necessary later. //We may need more delicate algorithms when necessary later.

@ -85,7 +85,7 @@ void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &
args.push_back( std::make_pair( sizeof(cl_int), (void *)&cols )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&cols ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&istep )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&istep ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&wstep )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&wstep ));
cv::String kernelName = "BlendLinear"; String kernelName = "BlendLinear";
openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth); openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth);
} }

@ -88,7 +88,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, const oclMat
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_UnrollMatch"; String kernelName = "BruteForceMatch_UnrollMatch";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -127,7 +127,7 @@ void match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/,
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_Match"; String kernelName = "BruteForceMatch_Match";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -173,7 +173,7 @@ void matchUnrolledCached(const oclMat &query, const oclMat &train, float maxDist
args.push_back( std::make_pair( sizeof(cl_int), (void *)&trainIdx.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&trainIdx.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_RadiusUnrollMatch"; String kernelName = "BruteForceMatch_RadiusUnrollMatch";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -211,7 +211,7 @@ void radius_match(const oclMat &query, const oclMat &train, float maxDistance, c
args.push_back( std::make_pair( sizeof(cl_int), (void *)&trainIdx.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&trainIdx.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_RadiusMatch"; String kernelName = "BruteForceMatch_RadiusMatch";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
//float *dis = (float *)clEnqueueMapBuffer(ctx->impl->clCmdQueue, (cl_mem)distance.data, CL_TRUE, CL_MAP_READ, 0, 8, 0, NULL, NULL, NULL); //float *dis = (float *)clEnqueueMapBuffer(ctx->impl->clCmdQueue, (cl_mem)distance.data, CL_TRUE, CL_MAP_READ, 0, 8, 0, NULL, NULL, NULL);
@ -498,7 +498,7 @@ void knn_matchUnrolledCached(const oclMat &query, const oclMat &train, const ocl
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_knnUnrollMatch"; String kernelName = "BruteForceMatch_knnUnrollMatch";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -531,7 +531,7 @@ void knn_match(const oclMat &query, const oclMat &train, const oclMat &/*mask*/,
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_knnMatch"; String kernelName = "BruteForceMatch_knnMatch";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -564,7 +564,7 @@ void calcDistanceUnrolled(const oclMat &query, const oclMat &train, const oclMat
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_calcDistanceUnrolled"; String kernelName = "BruteForceMatch_calcDistanceUnrolled";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -595,7 +595,7 @@ void calcDistance(const oclMat &query, const oclMat &train, const oclMat &/*mask
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType )); args.push_back( std::make_pair( sizeof(cl_int), (void *)&distType ));
cv::String kernelName = "BruteForceMatch_calcDistance"; String kernelName = "BruteForceMatch_calcDistance";
openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1); openCLExecuteKernel(ctx, &brute_force_match, kernelName, globalSize, localSize, args, -1, -1);
} }
@ -670,7 +670,7 @@ void findKnnMatch(int k, const oclMat &trainIdx, const oclMat &distance, const o
size_t globalSize[] = {trainIdx.rows * BLOCK_SIZE, 1, 1}; size_t globalSize[] = {trainIdx.rows * BLOCK_SIZE, 1, 1};
size_t localSize[] = {BLOCK_SIZE, 1, 1}; size_t localSize[] = {BLOCK_SIZE, 1, 1};
int block_size = BLOCK_SIZE; int block_size = BLOCK_SIZE;
cv::String kernelName = "BruteForceMatch_findBestMatch"; String kernelName = "BruteForceMatch_findBestMatch";
for (int i = 0; i < k; ++i) for (int i = 0; i < k; ++i)
{ {

@ -83,7 +83,7 @@ void cv::ocl::buildWarpPlaneMaps(Size /*src_size*/, Rect dst_roi, const Mat &K,
int tl_v = dst_roi.tl().y; int tl_v = dst_roi.tl().y;
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "buildWarpPlaneMaps"; String kernelName = "buildWarpPlaneMaps";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data));
@ -123,7 +123,7 @@ void cv::ocl::buildWarpCylindricalMaps(Size /*src_size*/, Rect dst_roi, const Ma
int tl_v = dst_roi.tl().y; int tl_v = dst_roi.tl().y;
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "buildWarpCylindricalMaps"; String kernelName = "buildWarpCylindricalMaps";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data));
@ -162,7 +162,7 @@ void cv::ocl::buildWarpSphericalMaps(Size /*src_size*/, Rect dst_roi, const Mat
int tl_v = dst_roi.tl().y; int tl_v = dst_roi.tl().y;
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "buildWarpSphericalMaps"; String kernelName = "buildWarpSphericalMaps";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data));
@ -205,7 +205,7 @@ void cv::ocl::buildWarpAffineMaps(const Mat &M, bool inverse, Size dsize, oclMat
oclMat coeffsOclMat(coeffsMat.reshape(1, 1)); oclMat coeffsOclMat(coeffsMat.reshape(1, 1));
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "buildWarpAffineMaps"; String kernelName = "buildWarpAffineMaps";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&xmap.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&xmap.data));
@ -244,7 +244,7 @@ void cv::ocl::buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, o
oclMat coeffsOclMat(coeffsMat.reshape(1, 1)); oclMat coeffsOclMat(coeffsMat.reshape(1, 1));
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "buildWarpPerspectiveMaps"; String kernelName = "buildWarpPerspectiveMaps";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&xmap.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&xmap.data));

@ -216,7 +216,7 @@ void cv::ocl::Canny(const oclMat &dx, const oclMat &dy, CannyBuf &buf, oclMat &d
void canny::calcSobelRowPass_gpu(const oclMat &src, oclMat &dx_buf, oclMat &dy_buf, int rows, int cols) void canny::calcSobelRowPass_gpu(const oclMat &src, oclMat &dx_buf, oclMat &dy_buf, int rows, int cols)
{ {
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "calcSobelRowPass"; String kernelName = "calcSobelRowPass";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src.data));
@ -239,7 +239,7 @@ void canny::calcSobelRowPass_gpu(const oclMat &src, oclMat &dx_buf, oclMat &dy_b
void canny::calcMagnitude_gpu(const oclMat &dx_buf, const oclMat &dy_buf, oclMat &dx, oclMat &dy, oclMat &mag, int rows, int cols, bool L2Grad) void canny::calcMagnitude_gpu(const oclMat &dx_buf, const oclMat &dy_buf, oclMat &dx, oclMat &dy, oclMat &mag, int rows, int cols, bool L2Grad)
{ {
Context *clCxt = dx_buf.clCxt; Context *clCxt = dx_buf.clCxt;
cv::String kernelName = "calcMagnitude_buf"; String kernelName = "calcMagnitude_buf";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dx_buf.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dx_buf.data));
@ -273,7 +273,7 @@ void canny::calcMagnitude_gpu(const oclMat &dx_buf, const oclMat &dy_buf, oclMat
void canny::calcMagnitude_gpu(const oclMat &dx, const oclMat &dy, oclMat &mag, int rows, int cols, bool L2Grad) void canny::calcMagnitude_gpu(const oclMat &dx, const oclMat &dy, oclMat &mag, int rows, int cols, bool L2Grad)
{ {
Context *clCxt = dx.clCxt; Context *clCxt = dx.clCxt;
cv::String kernelName = "calcMagnitude"; String kernelName = "calcMagnitude";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dx.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dx.data));
@ -324,7 +324,7 @@ void canny::calcMap_gpu(oclMat &dx, oclMat &dy, oclMat &mag, oclMat &map, int ro
size_t globalThreads[3] = {cols, rows, 1}; size_t globalThreads[3] = {cols, rows, 1};
cv::String kernelName = "calcMap"; String kernelName = "calcMap";
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
openCLExecuteKernel2(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1); openCLExecuteKernel2(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1);
@ -333,7 +333,7 @@ void canny::calcMap_gpu(oclMat &dx, oclMat &dy, oclMat &mag, oclMat &map, int ro
void canny::edgesHysteresisLocal_gpu(oclMat &map, oclMat &st1, void *counter, int rows, int cols) void canny::edgesHysteresisLocal_gpu(oclMat &map, oclMat &st1, void *counter, int rows, int cols)
{ {
Context *clCxt = map.clCxt; Context *clCxt = map.clCxt;
cv::String kernelName = "edgesHysteresisLocal"; String kernelName = "edgesHysteresisLocal";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map.data));
@ -355,7 +355,7 @@ void canny::edgesHysteresisGlobal_gpu(oclMat &map, oclMat &st1, oclMat &st2, voi
unsigned int count; unsigned int count;
openCLSafeCall(clEnqueueReadBuffer((cl_command_queue)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(float), &count, 0, NULL, NULL)); openCLSafeCall(clEnqueueReadBuffer((cl_command_queue)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(float), &count, 0, NULL, NULL));
Context *clCxt = map.clCxt; Context *clCxt = map.clCxt;
cv::String kernelName = "edgesHysteresisGlobal"; String kernelName = "edgesHysteresisGlobal";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = {128, 1, 1}; size_t localThreads[3] = {128, 1, 1};
@ -387,7 +387,7 @@ void canny::edgesHysteresisGlobal_gpu(oclMat &map, oclMat &st1, oclMat &st2, voi
void canny::getEdges_gpu(oclMat &map, oclMat &dst, int rows, int cols) void canny::getEdges_gpu(oclMat &map, oclMat &dst, int rows, int cols)
{ {
Context *clCxt = map.clCxt; Context *clCxt = map.clCxt;
cv::String kernelName = "getEdges"; String kernelName = "getEdges";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map.data));

@ -65,7 +65,7 @@ void cv::ocl::columnSum(const oclMat &src, oclMat &dst)
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
const cv::String kernelName = "columnSum"; const String kernelName = "columnSum";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;

@ -235,7 +235,7 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
int srcOffset_x = srcOffset % srcStep; int srcOffset_x = srcOffset % srcStep;
int srcOffset_y = srcOffset / srcStep; int srcOffset_y = srcOffset / srcStep;
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName; String kernelName;
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3] = {(src.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0], (src.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1}; size_t globalThreads[3] = {(src.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0], (src.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1};
@ -314,7 +314,7 @@ static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
int srcOffset_x = srcOffset % srcStep; int srcOffset_x = srcOffset % srcStep;
int srcOffset_y = srcOffset / srcStep; int srcOffset_y = srcOffset / srcStep;
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName; String kernelName;
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3] = {(src.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0], size_t globalThreads[3] = {(src.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0],
(src.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1}; (src.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1};
@ -606,7 +606,7 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
int cn = src.oclchannels(); int cn = src.oclchannels();
int depth = src.depth(); int depth = src.depth();
cv::String kernelName = "filter2D"; String kernelName = "filter2D";
size_t src_offset_x = (src.offset % src.step) / src.elemSize(); size_t src_offset_x = (src.offset % src.step) / src.elemSize();
size_t src_offset_y = src.offset / src.step; size_t src_offset_y = src.offset / src.step;
@ -762,7 +762,7 @@ static void GPUFilterBox_8u_C1R(const oclMat &src, oclMat &dst,
(src.rows == dst.rows)); (src.rows == dst.rows));
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "boxFilter_C1_D0"; String kernelName = "boxFilter_C1_D0";
char btype[30]; char btype[30];
@ -824,7 +824,7 @@ static void GPUFilterBox_8u_C4R(const oclMat &src, oclMat &dst,
(src.rows == dst.rows)); (src.rows == dst.rows));
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "boxFilter_C4_D0"; String kernelName = "boxFilter_C4_D0";
char btype[30]; char btype[30];
@ -886,7 +886,7 @@ static void GPUFilterBox_32F_C1R(const oclMat &src, oclMat &dst,
(src.rows == dst.rows)); (src.rows == dst.rows));
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "boxFilter_C1_D5"; String kernelName = "boxFilter_C1_D5";
char btype[30]; char btype[30];
@ -949,7 +949,7 @@ static void GPUFilterBox_32F_C4R(const oclMat &src, oclMat &dst,
(src.rows == dst.rows)); (src.rows == dst.rows));
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "boxFilter_C4_D5"; String kernelName = "boxFilter_C4_D5";
char btype[30]; char btype[30];
@ -1095,7 +1095,7 @@ void linearRowFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_kernel
int channels = src.oclchannels(); int channels = src.oclchannels();
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
cv::String kernelName = "row_filter"; String kernelName = "row_filter";
char btype[30]; char btype[30];
@ -1227,7 +1227,7 @@ void linearColumnFilter_gpu(const oclMat &src, const oclMat &dst, oclMat mat_ker
int channels = src.oclchannels(); int channels = src.oclchannels();
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
cv::String kernelName = "col_filter"; String kernelName = "col_filter";
char btype[30]; char btype[30];

@ -1575,7 +1575,7 @@ void cv::ocl::device::hog::compute_hists(int nbins, int block_stride_x, int bloc
const cv::ocl::oclMat &qangle, float sigma, cv::ocl::oclMat &block_hists) const cv::ocl::oclMat &qangle, float sigma, cv::ocl::oclMat &block_hists)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "compute_hists_kernel"; String kernelName = "compute_hists_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / block_stride_x; int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / block_stride_x;
@ -1615,7 +1615,7 @@ void cv::ocl::device::hog::normalize_hists(int nbins, int block_stride_x, int bl
int height, int width, cv::ocl::oclMat &block_hists, float threshold) int height, int width, cv::ocl::oclMat &block_hists, float threshold)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "normalize_hists_kernel"; String kernelName = "normalize_hists_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int block_hist_size = nbins * CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y; int block_hist_size = nbins * CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y;
@ -1645,7 +1645,7 @@ void cv::ocl::device::hog::classify_hists(int win_height, int win_width, int blo
float threshold, cv::ocl::oclMat &labels) float threshold, cv::ocl::oclMat &labels)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "classify_hists_kernel"; String kernelName = "classify_hists_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int win_block_stride_x = win_stride_x / block_stride_x; int win_block_stride_x = win_stride_x / block_stride_x;
@ -1678,7 +1678,7 @@ void cv::ocl::device::hog::extract_descrs_by_rows(int win_height, int win_width,
const cv::ocl::oclMat &block_hists, cv::ocl::oclMat &descriptors) const cv::ocl::oclMat &block_hists, cv::ocl::oclMat &descriptors)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "extract_descrs_by_rows_kernel"; String kernelName = "extract_descrs_by_rows_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int win_block_stride_x = win_stride_x / block_stride_x; int win_block_stride_x = win_stride_x / block_stride_x;
@ -1709,7 +1709,7 @@ void cv::ocl::device::hog::extract_descrs_by_cols(int win_height, int win_width,
const cv::ocl::oclMat &block_hists, cv::ocl::oclMat &descriptors) const cv::ocl::oclMat &block_hists, cv::ocl::oclMat &descriptors)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "extract_descrs_by_cols_kernel"; String kernelName = "extract_descrs_by_cols_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int win_block_stride_x = win_stride_x / block_stride_x; int win_block_stride_x = win_stride_x / block_stride_x;
@ -1745,7 +1745,7 @@ void cv::ocl::device::hog::compute_gradients_8UC1(int height, int width, const c
float angle_scale, cv::ocl::oclMat &grad, cv::ocl::oclMat &qangle, bool correct_gamma) float angle_scale, cv::ocl::oclMat &grad, cv::ocl::oclMat &qangle, bool correct_gamma)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "compute_gradients_8UC1_kernel"; String kernelName = "compute_gradients_8UC1_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = { NTHREADS, 1, 1 }; size_t localThreads[3] = { NTHREADS, 1, 1 };
@ -1774,7 +1774,7 @@ void cv::ocl::device::hog::compute_gradients_8UC4(int height, int width, const c
float angle_scale, cv::ocl::oclMat &grad, cv::ocl::oclMat &qangle, bool correct_gamma) float angle_scale, cv::ocl::oclMat &grad, cv::ocl::oclMat &qangle, bool correct_gamma)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "compute_gradients_8UC4_kernel"; String kernelName = "compute_gradients_8UC4_kernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = { NTHREADS, 1, 1 }; size_t localThreads[3] = { NTHREADS, 1, 1 };
@ -1805,7 +1805,7 @@ void cv::ocl::device::hog::resize( const oclMat &src, oclMat &dst, const Size sz
CV_Assert( (src.channels() == dst.channels()) ); CV_Assert( (src.channels() == dst.channels()) );
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = (src.type() == CV_8UC1) ? "resize_8UC1_kernel" : "resize_8UC4_kernel"; String kernelName = (src.type() == CV_8UC1) ? "resize_8UC1_kernel" : "resize_8UC4_kernel";
size_t blkSizeX = 16, blkSizeY = 16; size_t blkSizeX = 16, blkSizeY = 16;
size_t glbSizeX = sz.width % blkSizeX == 0 ? sz.width : (sz.width / blkSizeX + 1) * blkSizeX; size_t glbSizeX = sz.width % blkSizeX == 0 ? sz.width : (sz.width / blkSizeX + 1) * blkSizeX;
size_t glbSizeY = sz.height % blkSizeY == 0 ? sz.height : (sz.height / blkSizeY + 1) * blkSizeY; size_t glbSizeY = sz.height % blkSizeY == 0 ? sz.height : (sz.height / blkSizeY + 1) * blkSizeY;

@ -123,7 +123,7 @@ namespace cv
uchar thresh_uchar = cvFloor(thresh); uchar thresh_uchar = cvFloor(thresh);
uchar max_val = cvRound(maxVal); uchar max_val = cvRound(maxVal);
cv::String kernelName = "threshold"; String kernelName = "threshold";
size_t cols = (dst.cols + (dst.offset % 16) + 15) / 16; size_t cols = (dst.cols + (dst.offset % 16) + 15) / 16;
size_t bSizeX = 16, bSizeY = 16; size_t bSizeX = 16, bSizeY = 16;
@ -159,7 +159,7 @@ namespace cv
int src_offset = (src.offset >> 2); int src_offset = (src.offset >> 2);
int src_step = (src.step >> 2); int src_step = (src.step >> 2);
cv::String kernelName = "threshold"; String kernelName = "threshold";
size_t cols = (dst.cols + (dst_offset & 3) + 3) / 4; size_t cols = (dst.cols + (dst_offset & 3) + 3) / 4;
//size_t cols = dst.cols; //size_t cols = dst.cols;
@ -216,7 +216,7 @@ namespace cv
dst.create(map1.size(), src.type()); dst.create(map1.size(), src.type());
cv::String kernelName; String kernelName;
if( map1.type() == CV_32FC2 && !map2.data ) if( map1.type() == CV_32FC2 && !map2.data )
{ {
@ -347,7 +347,7 @@ namespace cv
int dstStep_in_pixel = dst.step1() / dst.oclchannels(); int dstStep_in_pixel = dst.step1() / dst.oclchannels();
int dstoffset_in_pixel = dst.offset / dst.elemSize(); int dstoffset_in_pixel = dst.offset / dst.elemSize();
//printf("%d %d\n",src.step1() , dst.elemSize()); //printf("%d %d\n",src.step1() , dst.elemSize());
cv::String kernelName; String kernelName;
if(interpolation == INTER_LINEAR) if(interpolation == INTER_LINEAR)
kernelName = "resizeLN"; kernelName = "resizeLN";
else if(interpolation == INTER_NEAREST) else if(interpolation == INTER_NEAREST)
@ -471,7 +471,7 @@ namespace cv
int dstOffset = dst.offset / dst.oclchannels() / dst.elemSize1(); int dstOffset = dst.offset / dst.oclchannels() / dst.elemSize1();
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "medianFilter"; String kernelName = "medianFilter";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
@ -489,18 +489,18 @@ namespace cv
if(m == 3) if(m == 3)
{ {
cv::String kernelName = "medianFilter3"; String kernelName = "medianFilter3";
openCLExecuteKernel(clCxt, &imgproc_median, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth()); openCLExecuteKernel(clCxt, &imgproc_median, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth());
} }
else if(m == 5) else if(m == 5)
{ {
cv::String kernelName = "medianFilter5"; String kernelName = "medianFilter5";
openCLExecuteKernel(clCxt, &imgproc_median, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth()); openCLExecuteKernel(clCxt, &imgproc_median, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth());
} }
else else
{ {
CV_Error(CV_StsUnsupportedFormat, "Non-supported filter length"); CV_Error(CV_StsUnsupportedFormat, "Non-supported filter length");
//cv::String kernelName = "medianFilter"; //String kernelName = "medianFilter";
//args.push_back( std::make_pair( sizeof(cl_int),(void*)&m)); //args.push_back( std::make_pair( sizeof(cl_int),(void*)&m));
//openCLExecuteKernel(clCxt,&imgproc_median,kernelName,globalThreads,localThreads,args,src.oclchannels(),-1); //openCLExecuteKernel(clCxt,&imgproc_median,kernelName,globalThreads,localThreads,args,src.oclchannels(),-1);
@ -549,7 +549,7 @@ namespace cv
{ {
CV_Error(CV_StsBadArg, "unsupported border type"); CV_Error(CV_StsBadArg, "unsupported border type");
} }
cv::String kernelName = "copymakeborder"; String kernelName = "copymakeborder";
size_t localThreads[3] = {16, 16, 1}; size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3] = {(dst.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0], size_t globalThreads[3] = {(dst.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0],
(dst.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1 (dst.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1
@ -819,8 +819,8 @@ namespace cv
cl_mem coeffs_cm; cl_mem coeffs_cm;
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String s[3] = {"NN", "Linear", "Cubic"}; String s[3] = {"NN", "Linear", "Cubic"};
cv::String kernelName = "warpAffine" + s[interpolation]; String kernelName = "warpAffine" + s[interpolation];
if(src.clCxt->supportsFeature(Context::CL_DOUBLE)) if(src.clCxt->supportsFeature(Context::CL_DOUBLE))
@ -890,8 +890,8 @@ namespace cv
cl_mem coeffs_cm; cl_mem coeffs_cm;
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String s[3] = {"NN", "Linear", "Cubic"}; String s[3] = {"NN", "Linear", "Cubic"};
cv::String kernelName = "warpPerspective" + s[interpolation]; String kernelName = "warpPerspective" + s[interpolation];
if(src.clCxt->supportsFeature(Context::CL_DOUBLE)) if(src.clCxt->supportsFeature(Context::CL_DOUBLE))
{ {
@ -1133,7 +1133,7 @@ namespace cv
CV_Assert(Dx.offset == 0 && Dy.offset == 0); CV_Assert(Dx.offset == 0 && Dy.offset == 0);
} }
static void corner_ocl(const char *src_str, cv::String kernelName, int block_size, float k, oclMat &Dx, oclMat &Dy, static void corner_ocl(const char *src_str, String kernelName, int block_size, float k, oclMat &Dx, oclMat &Dy,
oclMat &dst, int border_type) oclMat &dst, int border_type)
{ {
char borderType[30]; char borderType[30];
@ -1364,7 +1364,7 @@ namespace cv
Context *clCxt = mat_src.clCxt; Context *clCxt = mat_src.clCxt;
int depth = mat_src.depth(); int depth = mat_src.depth();
cv::String kernelName = "calc_sub_hist"; String kernelName = "calc_sub_hist";
size_t localThreads[3] = { HISTOGRAM256_BIN_COUNT, 1, 1 }; size_t localThreads[3] = { HISTOGRAM256_BIN_COUNT, 1, 1 };
size_t globalThreads[3] = { PARTIAL_HISTOGRAM256_COUNT *localThreads[0], 1, 1}; size_t globalThreads[3] = { PARTIAL_HISTOGRAM256_COUNT *localThreads[0], 1, 1};
@ -1441,7 +1441,7 @@ namespace cv
using namespace histograms; using namespace histograms;
Context *clCxt = sub_hist.clCxt; Context *clCxt = sub_hist.clCxt;
cv::String kernelName = "merge_hist"; String kernelName = "merge_hist";
size_t localThreads[3] = { 256, 1, 1 }; size_t localThreads[3] = { 256, 1, 1 };
size_t globalThreads[3] = { HISTOGRAM256_BIN_COUNT *localThreads[0], 1, 1}; size_t globalThreads[3] = { HISTOGRAM256_BIN_COUNT *localThreads[0], 1, 1};
@ -1474,7 +1474,7 @@ namespace cv
calcHist(mat_src, mat_hist); calcHist(mat_src, mat_hist);
Context *clCxt = mat_src.clCxt; Context *clCxt = mat_src.clCxt;
cv::String kernelName = "calLUT"; String kernelName = "calLUT";
size_t localThreads[3] = { 256, 1, 1}; size_t localThreads[3] = { 256, 1, 1};
size_t globalThreads[3] = { 256, 1, 1}; size_t globalThreads[3] = { 256, 1, 1};
oclMat lut(1, 256, CV_8UC1); oclMat lut(1, 256, CV_8UC1);
@ -1544,7 +1544,7 @@ namespace cv
oclMat oclspace_weight(1, d * d, CV_32FC1, space_weight); oclMat oclspace_weight(1, d * d, CV_32FC1, space_weight);
oclMat oclspace_ofs(1, d * d, CV_32SC1, space_ofs); oclMat oclspace_ofs(1, d * d, CV_32SC1, space_ofs);
cv::String kernelName = "bilateral"; String kernelName = "bilateral";
size_t localThreads[3] = { 16, 16, 1 }; size_t localThreads[3] = { 16, 16, 1 };
size_t globalThreads[3] = { (dst.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0], size_t globalThreads[3] = { (dst.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0],
(dst.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], (dst.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1],
@ -1590,7 +1590,7 @@ inline int divUp(int total, int grain)
{ {
return (total + grain - 1) / grain; return (total + grain - 1) / grain;
} }
static void convolve_run(const oclMat &src, const oclMat &temp1, oclMat &dst, cv::String kernelName, const char **kernelString) static void convolve_run(const oclMat &src, const oclMat &temp1, oclMat &dst, String kernelName, const char **kernelString)
{ {
CV_Assert(src.depth() == CV_32FC1); CV_Assert(src.depth() == CV_32FC1);
CV_Assert(temp1.depth() == CV_32F); CV_Assert(temp1.depth() == CV_32F);
@ -1636,7 +1636,7 @@ void cv::ocl::convolve(const oclMat &x, const oclMat &t, oclMat &y)
CV_Assert(t.depth() == CV_32F); CV_Assert(t.depth() == CV_32F);
CV_Assert(x.type() == y.type() && x.size() == y.size()); CV_Assert(x.type() == y.type() && x.size() == y.size());
y.create(x.size(), x.type()); y.create(x.size(), x.type());
cv::String kernelName = "convolve"; String kernelName = "convolve";
convolve_run(x, t, y, kernelName, &imgproc_convolve); convolve_run(x, t, y, kernelName, &imgproc_convolve);
} }

@ -92,9 +92,9 @@ namespace cv
releaseProgram(); releaseProgram();
} }
cl_program ProgramCache::progLookup(cv::String srcsign) cl_program ProgramCache::progLookup(String srcsign)
{ {
std::map<cv::String, cl_program>::iterator iter; std::map<String, cl_program>::iterator iter;
iter = codeCache.find(srcsign); iter = codeCache.find(srcsign);
if(iter != codeCache.end()) if(iter != codeCache.end())
return iter->second; return iter->second;
@ -102,17 +102,17 @@ namespace cv
return NULL; return NULL;
} }
void ProgramCache::addProgram(cv::String srcsign , cl_program program) void ProgramCache::addProgram(String srcsign , cl_program program)
{ {
if(!progLookup(srcsign)) if(!progLookup(srcsign))
{ {
codeCache.insert(std::map<cv::String, cl_program>::value_type(srcsign, program)); codeCache.insert(std::map<String, cl_program>::value_type(srcsign, program));
} }
} }
void ProgramCache::releaseProgram() void ProgramCache::releaseProgram()
{ {
std::map<cv::String, cl_program>::iterator iter; std::map<String, cl_program>::iterator iter;
for(iter = codeCache.begin(); iter != codeCache.end(); iter++) for(iter = codeCache.begin(); iter != codeCache.end(); iter++)
{ {
openCLSafeCall(clReleaseProgram(iter->second)); openCLSafeCall(clReleaseProgram(iter->second));
@ -126,7 +126,7 @@ namespace cv
{ {
cl_platform_id oclplatform; cl_platform_id oclplatform;
std::vector<cl_device_id> devices; std::vector<cl_device_id> devices;
std::vector<cv::String> devName; std::vector<String> devName;
cl_context oclcontext; cl_context oclcontext;
cl_command_queue clCmdQueue; cl_command_queue clCmdQueue;
@ -138,7 +138,7 @@ namespace cv
char extra_options[512]; char extra_options[512];
int double_support; int double_support;
int unified_memory; //1 means integrated GPU, otherwise this value is 0 int unified_memory; //1 means integrated GPU, otherwise this value is 0
cv::String binpath; String binpath;
int refcounter; int refcounter;
Impl() Impl()
@ -236,9 +236,9 @@ namespace cv
size_t extends_size; size_t extends_size;
openCLSafeCall(clGetDeviceInfo(devices[devnum], CL_DEVICE_EXTENSIONS, EXT_LEN, (void *)extends_set, &extends_size)); openCLSafeCall(clGetDeviceInfo(devices[devnum], CL_DEVICE_EXTENSIONS, EXT_LEN, (void *)extends_set, &extends_size));
extends_set[EXT_LEN - 1] = 0; extends_set[EXT_LEN - 1] = 0;
size_t fp64_khr = cv::String(extends_set).find("cl_khr_fp64"); size_t fp64_khr = String(extends_set).find("cl_khr_fp64");
if(fp64_khr != cv::String::npos) if(fp64_khr != String::npos)
{ {
sprintf(extra_options, "-D DOUBLE_SUPPORT"); sprintf(extra_options, "-D DOUBLE_SUPPORT");
double_support = 1; double_support = 1;
@ -433,7 +433,7 @@ namespace cv
{ {
openCLSafeCall(clReleaseMemObject((cl_mem)devPtr)); openCLSafeCall(clReleaseMemObject((cl_mem)devPtr));
} }
cl_kernel openCLGetKernelFromSource(const Context *clCxt, const char **source, cv::String kernelName) cl_kernel openCLGetKernelFromSource(const Context *clCxt, const char **source, String kernelName)
{ {
return openCLGetKernelFromSource(clCxt, source, kernelName, NULL); return openCLGetKernelFromSource(clCxt, source, kernelName, NULL);
} }
@ -473,15 +473,15 @@ namespace cv
return 1; return 1;
} }
cl_kernel openCLGetKernelFromSource(const Context *clCxt, const char **source, cv::String kernelName, cl_kernel openCLGetKernelFromSource(const Context *clCxt, const char **source, String kernelName,
const char *build_options) const char *build_options)
{ {
cl_kernel kernel; cl_kernel kernel;
cl_program program ; cl_program program ;
cl_int status = 0; cl_int status = 0;
std::stringstream src_sign; std::stringstream src_sign;
cv::String srcsign; String srcsign;
cv::String filename; String filename;
CV_Assert(programCache != NULL); CV_Assert(programCache != NULL);
if(NULL != build_options) if(NULL != build_options)
@ -601,7 +601,7 @@ namespace cv
static double total_execute_time = 0; static double total_execute_time = 0;
static double total_kernel_time = 0; static double total_kernel_time = 0;
#endif #endif
void openCLExecuteKernel_(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3], void openCLExecuteKernel_(Context *clCxt , const char **source, String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels, size_t localThreads[3], std::vector< std::pair<size_t, const void *> > &args, int channels,
int depth, const char *build_options) int depth, const char *build_options)
{ {
@ -668,14 +668,14 @@ namespace cv
openCLSafeCall(clReleaseKernel(kernel)); openCLSafeCall(clReleaseKernel(kernel));
} }
void openCLExecuteKernel(Context *clCxt , const char **source, cv::String kernelName, void openCLExecuteKernel(Context *clCxt , const char **source, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth) std::vector< std::pair<size_t, const void *> > &args, int channels, int depth)
{ {
openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args, openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args,
channels, depth, NULL); channels, depth, NULL);
} }
void openCLExecuteKernel(Context *clCxt , const char **source, cv::String kernelName, void openCLExecuteKernel(Context *clCxt , const char **source, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options) std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options)
@ -684,7 +684,7 @@ namespace cv
openCLExecuteKernel_(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth, openCLExecuteKernel_(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth,
build_options); build_options);
#else #else
cv::String data_type[] = { "uchar", "char", "ushort", "short", "int", "float", "double"}; String data_type[] = { "uchar", "char", "ushort", "short", "int", "float", "double"};
std::cout << std::endl; std::cout << std::endl;
std::cout << "Function Name: " << kernelName; std::cout << "Function Name: " << kernelName;
if(depth >= 0) if(depth >= 0)
@ -709,7 +709,7 @@ namespace cv
#endif #endif
} }
double openCLExecuteKernelInterop(Context *clCxt , const char **source, cv::String kernelName, double openCLExecuteKernelInterop(Context *clCxt , const char **source, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options, std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options,
bool finish, bool measureKernelTime, bool cleanUp) bool finish, bool measureKernelTime, bool cleanUp)
@ -785,7 +785,7 @@ namespace cv
} }
// Converts the contents of a file into a string // Converts the contents of a file into a string
static int convertToString(const char *filename, cv::String& s) static int convertToString(const char *filename, String& s)
{ {
size_t size; size_t size;
char* str; char* str;
@ -817,16 +817,16 @@ namespace cv
return -1; return -1;
} }
double openCLExecuteKernelInterop(Context *clCxt , const char **fileName, const int numFiles, cv::String kernelName, double openCLExecuteKernelInterop(Context *clCxt , const char **fileName, const int numFiles, String kernelName,
size_t globalThreads[3], size_t localThreads[3], size_t globalThreads[3], size_t localThreads[3],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options, std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options,
bool finish, bool measureKernelTime, bool cleanUp) bool finish, bool measureKernelTime, bool cleanUp)
{ {
std::vector<cv::String> fsource; std::vector<String> fsource;
for (int i = 0 ; i < numFiles ; i++) for (int i = 0 ; i < numFiles ; i++)
{ {
cv::String str; String str;
if (convertToString(fileName[i], str) >= 0) if (convertToString(fileName[i], str) >= 0)
fsource.push_back(str); fsource.push_back(str);
} }

@ -131,7 +131,7 @@ void cv::ocl::interpolateFrames(const oclMat &frame0, const oclMat &frame1,
void interpolate::memsetKernel(float val, oclMat &img, int height, int offset) void interpolate::memsetKernel(float val, oclMat &img, int height, int offset)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "memsetKernel"; String kernelName = "memsetKernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int step = img.step / sizeof(float); int step = img.step / sizeof(float);
offset = step * height * offset; offset = step * height * offset;
@ -150,7 +150,7 @@ void interpolate::memsetKernel(float val, oclMat &img, int height, int offset)
void interpolate::normalizeKernel(oclMat &buffer, int height, int factor_offset, int dst_offset) void interpolate::normalizeKernel(oclMat &buffer, int height, int factor_offset, int dst_offset)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "normalizeKernel"; String kernelName = "normalizeKernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int step = buffer.step / sizeof(float); int step = buffer.step / sizeof(float);
factor_offset = step * height * factor_offset; factor_offset = step * height * factor_offset;
@ -172,7 +172,7 @@ void interpolate::forwardWarpKernel(const oclMat &src, oclMat &buffer, const ocl
int b_offset, int d_offset) int b_offset, int d_offset)
{ {
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "forwardWarpKernel"; String kernelName = "forwardWarpKernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
int f_step = u.step / sizeof(float); // flow step int f_step = u.step / sizeof(float); // flow step
int b_step = buffer.step / sizeof(float); int b_step = buffer.step / sizeof(float);
@ -210,7 +210,7 @@ void interpolate::blendFrames(const oclMat &frame0, const oclMat &/*frame1*/, co
int step = buffer.step / sizeof(float); int step = buffer.step / sizeof(float);
Context *clCxt = Context::getContext(); Context *clCxt = Context::getContext();
cv::String kernelName = "blendFramesKernel"; String kernelName = "blendFramesKernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&tex_src0)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&tex_src0));

@ -139,7 +139,7 @@ namespace cv
unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0]; unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0];
Context *clCxt = image.clCxt; Context *clCxt = image.clCxt;
cv::String kernelName = "matchTemplate_Prepared_SQDIFF_NORMED"; String kernelName = "matchTemplate_Prepared_SQDIFF_NORMED";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sums[0].data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sums[0].data));
@ -169,7 +169,7 @@ namespace cv
CV_Assert(result.rows == image.rows - templ.rows + 1 && result.cols == image.cols - templ.cols + 1); CV_Assert(result.rows == image.rows - templ.rows + 1 && result.cols == image.cols - templ.cols + 1);
Context *clCxt = image.clCxt; Context *clCxt = image.clCxt;
cv::String kernelName = "matchTemplate_Naive_SQDIFF"; String kernelName = "matchTemplate_Naive_SQDIFF";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
@ -232,7 +232,7 @@ namespace cv
unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0]; unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0];
Context *clCxt = image.clCxt; Context *clCxt = image.clCxt;
cv::String kernelName = "normalizeKernel"; String kernelName = "normalizeKernel";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sqsums[0].data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sqsums[0].data));
@ -262,7 +262,7 @@ namespace cv
CV_Assert(result.rows == image.rows - templ.rows + 1 && result.cols == image.cols - templ.cols + 1); CV_Assert(result.rows == image.rows - templ.rows + 1 && result.cols == image.cols - templ.cols + 1);
Context *clCxt = image.clCxt; Context *clCxt = image.clCxt;
cv::String kernelName = "matchTemplate_Naive_CCORR"; String kernelName = "matchTemplate_Naive_CCORR";
std::vector< std::pair<size_t, const void *> > args; std::vector< std::pair<size_t, const void *> > args;
@ -296,7 +296,7 @@ namespace cv
matchTemplate_CCORR(image, templ, result, buf); matchTemplate_CCORR(image, templ, result, buf);
Context *clCxt = image.clCxt; Context *clCxt = image.clCxt;
cv::String kernelName; String kernelName;
kernelName = "matchTemplate_Prepared_CCOFF"; kernelName = "matchTemplate_Prepared_CCOFF";
size_t globalThreads[3] = {result.cols, result.rows, 1}; size_t globalThreads[3] = {result.cols, result.rows, 1};
@ -369,7 +369,7 @@ namespace cv
float scale = 1.f / templ.size().area(); float scale = 1.f / templ.size().area();
Context *clCxt = image.clCxt; Context *clCxt = image.clCxt;
cv::String kernelName; String kernelName;
kernelName = "matchTemplate_Prepared_CCOFF_NORMED"; kernelName = "matchTemplate_Prepared_CCOFF_NORMED";
size_t globalThreads[3] = {result.cols, result.rows, 1}; size_t globalThreads[3] = {result.cols, result.rows, 1};

@ -80,7 +80,7 @@ static void convert_C3C4(const cl_mem &src, oclMat &dst)
int dstStep_in_pixel = dst.step1() / dst.oclchannels(); int dstStep_in_pixel = dst.step1() / dst.oclchannels();
int pixel_end = dst.wholecols * dst.wholerows - 1; int pixel_end = dst.wholecols * dst.wholerows - 1;
Context *clCxt = dst.clCxt; Context *clCxt = dst.clCxt;
cv::String kernelName = "convertC3C4"; String kernelName = "convertC3C4";
char compile_option[32]; char compile_option[32];
switch(dst.depth()) switch(dst.depth())
{ {
@ -128,7 +128,7 @@ static void convert_C4C3(const oclMat &src, cl_mem &dst)
int srcStep_in_pixel = src.step1() / src.oclchannels(); int srcStep_in_pixel = src.step1() / src.oclchannels();
int pixel_end = src.wholecols * src.wholerows - 1; int pixel_end = src.wholecols * src.wholerows - 1;
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
cv::String kernelName = "convertC4C3"; String kernelName = "convertC4C3";
char compile_option[32]; char compile_option[32];
switch(src.depth()) switch(src.depth())
{ {
@ -285,7 +285,7 @@ inline int divUp(int total, int grain)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
////////////////////////////////// CopyTo ///////////////////////////////// ////////////////////////////////// CopyTo /////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
static void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask, cv::String kernelName) static void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask, String kernelName)
{ {
CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols && CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols &&
src.rows == dst.rows && src.cols == dst.cols src.rows == dst.rows && src.cols == dst.cols
@ -293,7 +293,7 @@ static void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;
cv::String string_types[4][7] = {{"uchar", "char", "ushort", "short", "int", "float", "double"}, String string_types[4][7] = {{"uchar", "char", "ushort", "short", "int", "float", "double"},
{"uchar2", "char2", "ushort2", "short2", "int2", "float2", "double2"}, {"uchar2", "char2", "ushort2", "short2", "int2", "float2", "double2"},
{"uchar3", "char3", "ushort3", "short3", "int3", "float3", "double3"}, {"uchar3", "char3", "ushort3", "short3", "int3", "float3", "double3"},
{"uchar4", "char4", "ushort4", "short4", "int4", "float4", "double4"} {"uchar4", "char4", "ushort4", "short4", "int4", "float4", "double4"}
@ -352,8 +352,8 @@ void cv::ocl::oclMat::copyTo( oclMat &mat, const oclMat &mask) const
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
static void convert_run(const oclMat &src, oclMat &dst, double alpha, double beta) static void convert_run(const oclMat &src, oclMat &dst, double alpha, double beta)
{ {
cv::String kernelName = "convert_to_S"; String kernelName = "convert_to_S";
cv::Stringstream idxStr; Stringstream idxStr;
idxStr << src.depth(); idxStr << src.depth();
kernelName += idxStr.str(); kernelName += idxStr.str();
float alpha_f = alpha, beta_f = beta; float alpha_f = alpha, beta_f = beta;
@ -421,7 +421,7 @@ oclMat &cv::ocl::oclMat::operator = (const Scalar &s)
setTo(s); setTo(s);
return *this; return *this;
} }
static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, cv::String kernelName) static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, String kernelName)
{ {
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;
@ -617,7 +617,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, cv::
#endif #endif
} }
static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const oclMat &mask, cv::String kernelName) static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const oclMat &mask, String kernelName)
{ {
CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols); CV_DbgAssert( dst.rows == mask.rows && dst.cols == mask.cols);
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save