All modules (except ocl and gpu) compiles and pass tests

pull/695/head
Andrey Kamaev 12 years ago
parent 762aefd71b
commit 2ad7b97f1c
  1. 4
      modules/calib3d/test/test_chesscorners.cpp
  2. 20
      modules/calib3d/test/test_stereomatching.cpp
  3. 2
      modules/contrib/doc/facerec/facerec_api.rst
  4. 14
      modules/contrib/doc/retina/index.rst
  5. 16
      modules/contrib/include/opencv2/contrib.hpp
  6. 6
      modules/contrib/include/opencv2/contrib/retina.hpp
  7. 50
      modules/contrib/src/facerec.cpp
  8. 34
      modules/contrib/src/inputoutput.cpp
  9. 24
      modules/contrib/src/lda.cpp
  10. 41
      modules/contrib/src/retina.cpp
  11. 2
      modules/contrib/src/spinimages.cpp
  12. 24
      modules/gpu/doc/video.rst
  13. 22
      modules/gpu/include/opencv2/gpu.hpp
  14. 28
      modules/gpu/src/cascadeclassifier.cpp
  15. 8
      modules/gpu/src/cu_safe_call.cpp
  16. 2
      modules/gpu/src/cu_safe_call.h
  17. 2
      modules/gpu/src/cuvid_video_source.cpp
  18. 2
      modules/gpu/src/cuvid_video_source.h
  19. 14
      modules/gpu/src/error.cpp
  20. 2
      modules/gpu/src/ffmpeg_video_source.cpp
  21. 2
      modules/gpu/src/ffmpeg_video_source.h
  22. 14
      modules/gpu/src/nvidia/NCVHaarObjectDetection.cu
  23. 6
      modules/gpu/src/nvidia/NCVHaarObjectDetection.hpp
  24. 4
      modules/gpu/src/nvidia/core/NCV.cu
  25. 4
      modules/gpu/src/nvidia/core/NCV.hpp
  26. 2
      modules/gpu/src/optical_flow.cpp
  27. 8
      modules/gpu/src/video_reader.cpp
  28. 32
      modules/gpu/src/video_writer.cpp
  29. 44
      modules/legacy/include/opencv2/legacy.hpp
  30. 10
      modules/legacy/src/calonder.cpp
  31. 22
      modules/legacy/src/oneway.cpp
  32. 8
      modules/legacy/src/planardetect.cpp
  33. 12
      modules/legacy/test/test_stereomatching.cpp
  34. 4
      modules/ml/doc/mldata.rst
  35. 8
      modules/ml/include/opencv2/ml.hpp
  36. 2
      modules/ml/src/data.cpp
  37. 2
      modules/ml/src/ertrees.cpp
  38. 4
      modules/ml/src/gbt.cpp
  39. 1
      modules/ml/src/precomp.hpp
  40. 4
      modules/ml/src/rtrees.cpp
  41. 4
      modules/ml/src/svm.cpp
  42. 16
      modules/ml/test/test_mltests2.cpp
  43. 14
      modules/nonfree/src/surf.ocl.cpp
  44. 66
      modules/objdetect/include/opencv2/objdetect.hpp
  45. 8
      modules/objdetect/src/cascadedetect.cpp
  46. 6
      modules/objdetect/src/datamatrix.cpp
  47. 32
      modules/objdetect/src/hog.cpp
  48. 14
      modules/objdetect/src/latentsvmdetector.cpp
  49. 52
      modules/objdetect/src/linemod.cpp
  50. 8
      modules/objdetect/test/test_cascadeandhog.cpp
  51. 4
      modules/objdetect/test/test_latentsvmdetector.cpp
  52. 6
      modules/ocl/include/opencv2/ocl.hpp
  53. 16
      modules/ocl/include/opencv2/ocl/private/util.hpp
  54. 96
      modules/ocl/src/arithm.cpp
  55. 6
      modules/ocl/src/binarycaching.hpp
  56. 2
      modules/ocl/src/blend.cpp
  57. 18
      modules/ocl/src/brute_force_matcher.cpp
  58. 10
      modules/ocl/src/build_warps.cpp
  59. 14
      modules/ocl/src/canny.cpp
  60. 2
      modules/ocl/src/columnsum.cpp
  61. 18
      modules/ocl/src/filtering.cpp
  62. 16
      modules/ocl/src/hog.cpp
  63. 40
      modules/ocl/src/imgproc.cpp
  64. 44
      modules/ocl/src/initialization.cpp
  65. 8
      modules/ocl/src/interpolate_frames.cpp
  66. 12
      modules/ocl/src/match_template.cpp
  67. 16
      modules/ocl/src/matrix_operations.cpp
  68. 8
      modules/ocl/src/mcwutil.cpp
  69. 2
      modules/ocl/src/pyrdown.cpp
  70. 18
      modules/ocl/src/pyrlk.cpp
  71. 2
      modules/ocl/src/pyrup.cpp
  72. 8
      modules/ocl/src/split_merge.cpp
  73. 6
      modules/ocl/src/stereobm.cpp
  74. 8
      modules/softcascade/include/opencv2/softcascade.hpp
  75. 10
      modules/softcascade/src/detector.cpp
  76. 6
      modules/softcascade/src/detector_cuda.cpp
  77. 4
      modules/softcascade/src/integral_channel_builder.cpp
  78. 4
      modules/softcascade/src/octave.cpp
  79. 2
      modules/softcascade/test/test_training.cpp
  80. 2
      modules/stitching/include/opencv2/stitching/detail/motion_estimators.hpp
  81. 2
      modules/stitching/include/opencv2/stitching/detail/util.hpp
  82. 20
      modules/stitching/src/motion_estimators.cpp
  83. 4
      modules/superres/include/opencv2/superres.hpp
  84. 16
      modules/superres/src/frame_source.cpp
  85. 4
      modules/video/src/bgfg_gaussmix.cpp
  86. 4
      modules/video/src/bgfg_gaussmix2.cpp
  87. 4
      modules/video/src/bgfg_gmg.cpp
  88. 2
      modules/videostab/include/opencv2/videostab/frame_source.hpp
  89. 4
      modules/videostab/include/opencv2/videostab/global_motion.hpp
  90. 8
      modules/videostab/src/frame_source.cpp
  91. 4
      modules/videostab/src/global_motion.cpp

@ -217,7 +217,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
ts->update_context( this, idx, true ); ts->update_context( this, idx, true );
/* read the image */ /* read the image */
string img_file = board_list[idx * 2]; String img_file = board_list[idx * 2];
Mat gray = imread( folder + img_file, 0); Mat gray = imread( folder + img_file, 0);
if( gray.empty() ) if( gray.empty() )
@ -227,7 +227,7 @@ void CV_ChessboardDetectorTest::run_batch( const string& filename )
return; return;
} }
string _filename = folder + (string)board_list[idx * 2 + 1]; String _filename = folder + (String)board_list[idx * 2 + 1];
bool doesContatinChessboard; bool doesContatinChessboard;
Mat expected; Mat expected;
{ {

@ -593,10 +593,10 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs )
assert(fn.isSeq()); assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 ) for( int i = 0; i < (int)fn.size(); i+=3 )
{ {
string _name = fn[i]; String _name = fn[i];
DatasetParams params; DatasetParams params;
string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); String sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); String uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
datasetsParams[_name] = params; datasetsParams[_name] = params;
} }
return cvtest::TS::OK; return cvtest::TS::OK;
@ -680,10 +680,10 @@ protected:
assert(fn.isSeq()); assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=4 ) for( int i = 0; i < (int)fn.size(); i+=4 )
{ {
string caseName = fn[i], datasetName = fn[i+1]; String caseName = fn[i], datasetName = fn[i+1];
RunParams params; RunParams params;
string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str()); String winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
caseNames.push_back( caseName ); caseNames.push_back( caseName );
caseDatasets.push_back( datasetName ); caseDatasets.push_back( datasetName );
caseRunParams.push_back( params ); caseRunParams.push_back( params );
@ -734,11 +734,11 @@ protected:
assert(fn.isSeq()); assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=5 ) for( int i = 0; i < (int)fn.size(); i+=5 )
{ {
string caseName = fn[i], datasetName = fn[i+1]; String caseName = fn[i], datasetName = fn[i+1];
RunParams params; RunParams params;
string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str()); String winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
string fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true; String fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true;
caseNames.push_back( caseName ); caseNames.push_back( caseName );
caseDatasets.push_back( datasetName ); caseDatasets.push_back( datasetName );
caseRunParams.push_back( params ); caseRunParams.push_back( params );

@ -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:
std::string name = model->name(); cv::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(std::string fs)* method which will write a proper XML file with all default parameters. Then, tweak it on your own and reload them at any time using method *setup(std::string fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. :: The retina can be settled up with various parameters, by default, the retina cancels mean luminance and enforces all details of the visual scene. In order to use your own parameters, you can use at least one time the *write(cv::String fs)* method which will write a proper XML file with all default parameters. Then, tweak it on your own and reload them at any time using method *setup(cv::String fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. ::
class Retina 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 (std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); void setup (cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true); void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
void setup (RetinaParameters newParameters); void setup (RetinaParameters newParameters);
struct Retina::RetinaParameters getParameters (); struct Retina::RetinaParameters getParameters ();
const std::string printSetup (); const cv::String printSetup ();
virtual void write (std::string fs) const; virtual void write (cv::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 std::string Retina::printSetup() .. ocv:function:: const cv::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(std::string retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true ) .. ocv:function:: void Retina::setup(cv::String retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true )
.. ocv:function:: void Retina::setup(FileStorage & fs, const bool applyDefaultSetupOnFailure = true ) .. ocv:function:: void Retina::setup(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( std::string fs ) const .. ocv:function:: void Retina::write( cv::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 std::string& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const; void writeAsVrml(const cv::String& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const;
std::vector<Point3f> vtx; std::vector<Point3f> 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<std::string> GetListFiles ( const std::string& path, const std::string & exten = "*", bool addPath = true ); static std::vector<cv::String> GetListFiles ( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
static std::vector<std::string> GetListFilesR ( const std::string& path, const std::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<std::string> GetListFolders( const std::string& path, const std::string & exten = "*", bool addPath = true ); static std::vector<cv::String> GetListFolders( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
}; };
/* /*
@ -869,10 +869,10 @@ namespace cv
} }
// Serializes this object to a given filename. // Serializes this object to a given filename.
void save(const std::string& filename) const; void save(const cv::String& filename) const;
// Deserializes this object from a given filename. // Deserializes this object from a given filename.
void load(const std::string& filename); void load(const cv::String& filename);
// Serializes this object to a given cv::FileStorage. // 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 std::string& filename) const; CV_WRAP virtual void save(const cv::String& filename) const;
// Deserializes this object from a given filename. // Deserializes this object from a given filename.
CV_WRAP virtual void load(const std::string& filename); CV_WRAP virtual void load(const cv::String& filename);
// Serializes this object to a given cv::FileStorage. // 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(std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true); void setup(cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
/** /**
@ -212,13 +212,13 @@ public:
* parameters setup display method * parameters setup display method
* @return a string which contains formatted parameters information * @return a string which contains formatted parameters information
*/ */
const std::string printSetup(); const cv::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( std::string fs ) const; virtual void write( cv::String fs ) const;
/** /**

@ -35,7 +35,7 @@ inline void readFileNodeList(const FileNode& fn, std::vector<_Tp>& result) {
// Writes the a list of given items to a cv::FileStorage. // Writes the a list of given items to a cv::FileStorage.
template<typename _Tp> template<typename _Tp>
inline void writeFileNodeList(FileStorage& fs, const std::string& name, inline void writeFileNodeList(FileStorage& fs, const cv::String& name,
const std::vector<_Tp>& items) { 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 std::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) {
std::string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >)."; cv::String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message); 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) {
std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total()); cv::String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message); 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;
} }
std::string error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str()); cv::String error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
CV_Error(CV_StsNotImplemented, error_msg); CV_Error(CV_StsNotImplemented, error_msg);
} }
void FaceRecognizer::save(const std::string& filename) const { void FaceRecognizer::save(const cv::String& filename) const {
FileStorage fs(filename, FileStorage::WRITE); 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 std::string& filename) const {
fs.release(); fs.release();
} }
void FaceRecognizer::load(const std::string& filename) { void FaceRecognizer::load(const cv::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 std::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) {
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model."); cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} else if(_local_labels.getMat().type() != CV_32SC1) { } else if(_local_labels.getMat().type() != CV_32SC1) {
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type()); cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
CV_Error(CV_StsBadArg, error_message); 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()) {
std::string error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total()); cv::String error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
CV_Error(CV_StsUnsupportedFormat, error_message); 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) {
std::string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total()); cv::String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
CV_Error(CV_StsBadArg, error_message); 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?)
std::string error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?"; cv::String error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
CV_Error(CV_StsError, error_message); 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
std::string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total()); cv::String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
CV_Error(CV_StsBadArg, error_message); 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) {
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model."); cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} else if(_lbls.getMat().type() != CV_32SC1) { } else if(_lbls.getMat().type() != CV_32SC1) {
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type()); cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
CV_Error(CV_StsBadArg, error_message); 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()) {
std::string error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total()); cv::String error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
CV_Error(CV_StsUnsupportedFormat, error_message); 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) {
std::string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total()); cv::String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} else if(labels.rows != 1 && labels.cols != 1) { } else if(labels.rows != 1 && labels.cols != 1) {
std::string error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols); cv::String error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
CV_Error(CV_StsBadArg, error_message); 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?)
std::string error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?"; cv::String error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} else if(src.total() != (size_t) _eigenvectors.rows) { } else if(src.total() != (size_t) _eigenvectors.rows) {
std::string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total()); cv::String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
CV_Error(CV_StsBadArg, error_message); 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:
std::string error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type); cv::String error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
CV_Error(CV_StsNotImplemented, error_msg); 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) {
std::string error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >)."; cv::String error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} }
if(_in_src.total() == 0) { if(_in_src.total() == 0) {
std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model."); cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsUnsupportedFormat, error_message); CV_Error(CV_StsUnsupportedFormat, error_message);
} else if(_in_labels.getMat().type() != CV_32SC1) { } else if(_in_labels.getMat().type() != CV_32SC1) {
std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type()); cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
CV_Error(CV_StsUnsupportedFormat, error_message); 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()) {
std::string error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total()); cv::String error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
CV_Error(CV_StsBadArg, error_message); 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?)
std::string error_message = "This LBPH model is not computed yet. Did you call the train method?"; cv::String error_message = "This LBPH model is not computed yet. Did you call the train method?";
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
} }
Mat src = _src.getMat(); Mat src = _src.getMat();

@ -10,11 +10,11 @@
namespace cv namespace cv
{ {
std::vector<std::string> Directory::GetListFiles( const std::string& path, const std::string & exten, bool addPath ) std::vector<cv::String> Directory::GetListFiles( const cv::String& path, const cv::String & exten, bool addPath )
{ {
std::vector<std::string> list; std::vector<cv::String> list;
list.clear(); list.clear();
std::string path_f = path + "/" + exten; cv::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<std::string>(dirp->d_name)); list.push_back(static_cast<cv::String>(dirp->d_name));
else else
if (std::string(dirp->d_name).find(exten) != std::string::npos) if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<cv::String>(dirp->d_name));
} }
} }
closedir(dp); closedir(dp);
@ -69,10 +69,10 @@ namespace cv
return list; return list;
} }
std::vector<std::string> Directory::GetListFolders( const std::string& path, const std::string & exten, bool addPath ) std::vector<cv::String> Directory::GetListFolders( const cv::String& path, const cv::String & exten, bool addPath )
{ {
std::vector<std::string> list; std::vector<cv::String> list;
std::string path_f = path + "/" + exten; cv::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<std::string>(dirp->d_name)); list.push_back(static_cast<cv::String>(dirp->d_name));
else else
if (std::string(dirp->d_name).find(exten) != std::string::npos) if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<cv::String>(dirp->d_name));
} }
} }
closedir(dp); closedir(dp);
@ -129,16 +129,16 @@ namespace cv
return list; return list;
} }
std::vector<std::string> Directory::GetListFilesR ( const std::string& path, const std::string & exten, bool addPath ) std::vector<cv::String> Directory::GetListFilesR ( const cv::String& path, const cv::String & exten, bool addPath )
{ {
std::vector<std::string> list = Directory::GetListFiles(path, exten, addPath); std::vector<cv::String> list = Directory::GetListFiles(path, exten, addPath);
std::vector<std::string> dirs = Directory::GetListFolders(path, exten, addPath); std::vector<cv::String> dirs = Directory::GetListFolders(path, exten, addPath);
std::vector<std::string>::const_iterator it; std::vector<cv::String>::const_iterator it;
for (it = dirs.begin(); it != dirs.end(); ++it) for (it = dirs.begin(); it != dirs.end(); ++it)
{ {
std::vector<std::string> cl = Directory::GetListFiles(*it, exten, addPath); std::vector<cv::String> cl = Directory::GetListFiles(*it, exten, addPath);
list.insert(list.end(), cl.begin(), cl.end()); 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) {
std::string error_message = "Wrong shape of input matrix! Expected a matrix with one row or column."; cv::String error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
CV_Error(CV_StsBadArg, error_message); 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) {
std::string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >)."; cv::String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message); 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) {
std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total()); cv::String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message); 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) {
std::string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols); cv::String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
CV_Error(CV_StsBadArg, error_message); 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)) {
std::string error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total()); cv::String error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
CV_Error(CV_StsBadArg, error_message); 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) {
std::string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols); cv::String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
CV_Error(CV_StsBadArg, error_message); 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)) {
std::string error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total()); cv::String error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
CV_Error(CV_StsBadArg, error_message); 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 std::string& filename) const { void LDA::save(const cv::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 std::string& filename) const {
} }
// Deserializes this object from a given filename. // Deserializes this object from a given filename.
void LDA::load(const std::string& filename) { void LDA::load(const cv::String& filename) {
FileStorage fs(filename, FileStorage::READ); 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) {
std::string error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!"; cv::String error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
CV_Error(CV_StsBadArg, error_message); 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)) {
std::string error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N); cv::String error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
CV_Error(CV_StsBadArg, error_message); 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:
std::string error_message= format("InputArray Datatype %d is not supported.", _src.kind()); cv::String error_message= format("InputArray Datatype %d is not supported.", _src.kind());
CV_Error(CV_StsBadArg, error_message); CV_Error(CV_StsBadArg, error_message);
break; break;
} }

@ -70,7 +70,7 @@
*/ */
#include "precomp.hpp" #include "precomp.hpp"
#include "retinafilter.hpp" #include "retinafilter.hpp"
#include <iostream> #include <cstdio>
namespace cv namespace cv
{ {
@ -112,25 +112,26 @@ 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(std::string retinaParameterFile, const bool applyDefaultSetupOnFailure) void Retina::setup(cv::String retinaParameterFile, const bool applyDefaultSetupOnFailure)
{ {
try try
{ {
// opening retinaParameterFile in read mode // opening retinaParameterFile in read mode
cv::FileStorage fs(retinaParameterFile, cv::FileStorage::READ); cv::FileStorage fs(retinaParameterFile, cv::FileStorage::READ);
setup(fs, applyDefaultSetupOnFailure); setup(fs, applyDefaultSetupOnFailure);
}catch(Exception &e)
{
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
if (applyDefaultSetupOnFailure)
{
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
} }
catch(Exception &e)
{
printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
if (applyDefaultSetupOnFailure)
{
printf("Retina::setup: resetting retina with default parameters\n");
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
}
else else
{ {
std::cout<<"=> keeping current parameters"<<std::endl; printf("=> keeping current parameters\n");
} }
} }
} }
@ -142,7 +143,7 @@ void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
// read parameters file if it exists or apply default setup if asked for // read parameters file if it exists or apply default setup if asked for
if (!fs.isOpened()) if (!fs.isOpened())
{ {
std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl; printf("Retina::setup: provided parameters file could not be open... skeeping configuration\n");
return; return;
// implicit else case : retinaParameterFile could be open (it exists at least) // implicit else case : retinaParameterFile could be open (it exists at least)
} }
@ -174,18 +175,18 @@ void Retina::setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure)
}catch(Exception &e) }catch(Exception &e)
{ {
std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl; printf("Retina::setup: resetting retina with default parameters\n");
if (applyDefaultSetupOnFailure) if (applyDefaultSetupOnFailure)
{ {
setupOPLandIPLParvoChannel(); setupOPLandIPLParvoChannel();
setupIPLMagnoChannel(); setupIPLMagnoChannel();
} }
std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl; printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
std::cout<<"=> keeping current parameters"<<std::endl; printf("=> keeping current parameters\n");
} }
// report current configuration // report current configuration
std::cout<<printSetup()<<std::endl; printf("%s\n", printSetup().c_str());
} }
void Retina::setup(cv::Retina::RetinaParameters newConfiguration) void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
@ -199,7 +200,7 @@ void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
} }
const std::string Retina::printSetup() const cv::String Retina::printSetup()
{ {
std::stringstream outmessage; std::stringstream outmessage;
@ -229,10 +230,10 @@ const std::string Retina::printSetup()
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau << "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k << "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
<<"}"; <<"}";
return outmessage.str(); return outmessage.str().c_str();
} }
void Retina::write( std::string fs ) const void Retina::write( cv::String fs ) const
{ {
FileStorage parametersSaveFile(fs, cv::FileStorage::WRITE ); FileStorage parametersSaveFile(fs, cv::FileStorage::WRITE );
write(parametersSaveFile); write(parametersSaveFile);
@ -364,7 +365,7 @@ void Retina::_init(const cv::Size inputSz, const bool colorMode, RETINA_COLORSAM
_retinaFilter->clearAllBuffers(); _retinaFilter->clearAllBuffers();
// report current configuration // report current configuration
std::cout<<printSetup()<<std::endl; printf("%s\n", printSetup().c_str());
} }
void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer) void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)

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

@ -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 std::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, SurfaceFormat format = SF_BGR)
.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) .. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, 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 std::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, SurfaceFormat format = SF_BGR)
.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR) .. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, 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 std::string& configFile); explicit EncoderParams(const cv::String& configFile);
void load(const std::string& configFile); void load(const cv::String& configFile);
void save(const std::string& configFile) const; void save(const cv::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 std::string& configFile) .. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::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 std::string& configFile) .. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::load(const cv::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 std::string& configFile) const .. ocv:function:: void gpu::VideoWriter_GPU::EncoderParams::save(const cv::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 std::string& filename) .. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::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 std::string& filename) .. ocv:function:: void gpu::VideoReader_GPU::open(const cv::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 std::string& filename); CascadeClassifier_GPU(const cv::String& filename);
~CascadeClassifier_GPU(); ~CascadeClassifier_GPU();
bool empty() const; bool empty() const;
bool load(const std::string& filename); bool load(const cv::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 std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, 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 std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR); void open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
void open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR); void open(const cv::String& fileName, cv::Size frameSize, double fps, 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 std::string& configFile); explicit EncoderParams(const cv::String& configFile);
void load(const std::string& configFile); void load(const cv::String& configFile);
void save(const std::string& configFile) const; void save(const cv::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 std::string& filename); explicit VideoReader_GPU(const cv::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 std::string& filename); void open(const cv::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 std::string&) { throw_nogpu(); } cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::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 std::string&) { throw_nogpu(); return true; } bool cv::gpu::CascadeClassifier_GPU::load(const cv::String&) { throw_nogpu(); return true; }
Size cv::gpu::CascadeClassifier_GPU::getClassifierSize() const { throw_nogpu(); return Size();} 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 std::string& classifierAsXml) = 0; virtual bool read(const cv::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 std::string& filename) bool read(const cv::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 std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } static void NCVDebugOutputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
NCVStatus load(const std::string& classifierFile) NCVStatus load(const cv::String& classifierFile)
{ {
int devId = cv::gpu::getDevice(); 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 std::string& classifierAsXml) bool read(const cv::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";
std::string stageTypeStr = (std::string)root[GPU_CC_STAGE_TYPE]; cv::String stageTypeStr = (cv::String)root[GPU_CC_STAGE_TYPE];
CV_Assert(stageTypeStr == GPU_CC_BOOST); CV_Assert(stageTypeStr == GPU_CC_BOOST);
std::string featureTypeStr = (std::string)root[GPU_CC_FEATURE_TYPE]; cv::String featureTypeStr = (cv::String)root[GPU_CC_FEATURE_TYPE];
CV_Assert(featureTypeStr == GPU_CC_LBP); 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 std::string& filename) cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::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 std::string& filename) bool cv::gpu::CascadeClassifier_GPU::load(const cv::String& filename)
{ {
release(); release();
std::string fext = filename.substr(filename.find_last_of(".") + 1); cv::String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); 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 std::string& filename)
} }
const char *GPU_CC_LBP = "LBP"; const char *GPU_CC_LBP = "LBP";
std::string featureTypeStr = (std::string)fs.getFirstTopLevelNode()["featureType"]; cv::String featureTypeStr = (cv::String)fs.getFirstTopLevelNode()["featureType"];
if (featureTypeStr == GPU_CC_LBP) 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 std::string &filename, NCVStatus loadFromXML(const cv::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;
std::string str; cv::String str;
}; };
class ErrorEntryComparer class ErrorEntryComparer
@ -65,11 +65,11 @@ namespace
int code_; int code_;
}; };
std::string getErrorString(int code, const ErrorEntry* errors, size_t n) cv::String getErrorString(int code, const ErrorEntry* errors, size_t n)
{ {
size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors; size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors;
const std::string& msg = (idx != n) ? errors[idx].str : std::string("Unknown error code"); const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code");
std::ostringstream ostr; 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]);
} }
std::string cv::gpu::detail::cuGetErrString(CUresult res) cv::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
{ {
std::string cuGetErrString(CUresult res); cv::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 std::string& fname) cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const cv::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 std::string& fname); explicit CuvidVideoSource(const cv::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;
std::string str; cv::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; }
}; };
std::string getErrorString(int code, const ErrorEntry* errors, size_t n) cv::String getErrorString(int code, const ErrorEntry* errors, size_t n)
{ {
size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors; size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors;
const std::string& msg = (idx != n) ? errors[idx].str : std::string("Unknown error code"); const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code");
std::ostringstream ostr; 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)
{ {
std::string msg = getErrorString(code, npp_errors, npp_error_num); cv::String msg = getErrorString(code, npp_errors, npp_error_num);
cv::gpu::error(msg.c_str(), file, line, func); 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)
{ {
std::string msg = getErrorString(code, ncv_errors, ncv_error_num); cv::String msg = getErrorString(code, ncv_errors, ncv_error_num);
cv::gpu::error(msg.c_str(), file, line, func); 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)
{ {
std::string msg = getErrorString(code, cufft_errors, cufft_error_num); cv::String msg = getErrorString(code, cufft_errors, cufft_error_num);
cv::gpu::error(msg.c_str(), file, line, func); 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)
{ {
std::string msg = getErrorString(code, cublas_errors, cublas_error_num); cv::String msg = getErrorString(code, cublas_errors, cublas_error_num);
cv::gpu::error(msg.c_str(), file, line, func); cv::gpu::error(msg.c_str(), file, line, func);
} }
} }

@ -96,7 +96,7 @@ namespace
} }
} }
cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const std::string& fname) : cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const cv::String& fname) :
stream_(0) 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 std::string& fname); FFmpegVideoSource(const cv::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 std::string &filename, NCVStatus loadFromXML(const cv::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 std::string &filename,
#define NVBIN_HAAR_VERSION 0x1 #define NVBIN_HAAR_VERSION 0x1
static NCVStatus loadFromNVBIN(const std::string &filename, static NCVStatus loadFromNVBIN(const cv::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 std::string &filename,
} }
NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStages, NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages,
Ncv32u &numNodes, Ncv32u &numFeatures) Ncv32u &numNodes, Ncv32u &numFeatures)
{ {
size_t readCount; size_t readCount;
NCVStatus ncvStat; NCVStatus ncvStat;
std::string fext = filename.substr(filename.find_last_of(".") + 1); cv::String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
if (fext == "nvbin") if (fext == "nvbin")
@ -2226,7 +2226,7 @@ NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStage
} }
NCVStatus ncvHaarLoadFromFile_host(const std::string &filename, NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename,
HaarClassifierCascadeDescriptor &haar, 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 std::string &filename,
NCVStatus ncvStat; NCVStatus ncvStat;
std::string fext = filename.substr(filename.find_last_of(".") + 1); cv::String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower); std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
std::vector<HaarStage64> haarStages; std::vector<HaarStage64> haarStages;
@ -2272,7 +2272,7 @@ NCVStatus ncvHaarLoadFromFile_host(const std::string &filename,
} }
NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename, NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename,
HaarClassifierCascadeDescriptor haar, HaarClassifierCascadeDescriptor haar,
NCVVector<HaarStage64> &h_HaarStages, NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes, NCVVector<HaarClassifierNode128> &h_HaarNodes,

@ -439,18 +439,18 @@ NCV_EXPORTS NCVStatus ncvGrowDetectionsVector_host(NCVVector<Ncv32u> &pixelMask,
Ncv32f curScale); Ncv32f curScale);
NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStages, NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages,
Ncv32u &numNodes, Ncv32u &numFeatures); Ncv32u &numNodes, Ncv32u &numFeatures);
NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const std::string &filename, NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const cv::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 std::string &filename, NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename,
HaarClassifierCascadeDescriptor haar, HaarClassifierCascadeDescriptor haar,
NCVVector<HaarStage64> &h_HaarStages, NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes, NCVVector<HaarClassifierNode128> &h_HaarNodes,

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

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

@ -68,7 +68,7 @@ namespace
namespace namespace
{ {
static void outputHandler(const std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); } static void outputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
} }
void cv::gpu::BroxOpticalFlow::operator ()(const GpuMat& frame0, const GpuMat& frame1, GpuMat& u, GpuMat& v, Stream& s) 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 std::string&) { throw_nogpu(); } cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::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 std::string&) { throw_nogpu(); } void cv::gpu::VideoReader_GPU::open(const cv::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 std::string& filename) cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::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 std::string& filename) void cv::gpu::VideoReader_GPU::open(const cv::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 std::string&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<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 std::string&, cv::Size, double, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::open(const std::string&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::open(const cv::Ptr<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 std::string&) { throw_nogpu(); } cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String&) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string&) { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String&) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string&) const { throw_nogpu(); } void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::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 std::string& fileName, cv::Size frameSize, double fps); EncoderCallBackFFMPEG(const cv::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 std::string& fileName, cv::Size frameSize, double fps) : EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const cv::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 std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format) cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
{ {
open(fileName, frameSize, fps, format); open(fileName, frameSize, fps, format);
} }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{ {
open(fileName, frameSize, fps, params, format); 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 std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format) void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
{ {
close(); 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 std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format) void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{ {
close(); 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 std::string& configFile) cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile)
{ {
load(configFile); load(configFile);
} }
void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string& configFile) void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile)
{ {
cv::FileStorage fs(configFile, cv::FileStorage::READ); cv::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 std::string& configFile
cv::read(fs["DisableSPSPPS" ], DisableSPSPPS, 0); cv::read(fs["DisableSPSPPS" ], DisableSPSPPS, 0);
} }
void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string& configFile) const void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String& configFile) const
{ {
cv::FileStorage fs(configFile, cv::FileStorage::WRITE); cv::FileStorage fs(configFile, cv::FileStorage::WRITE);
CV_Assert( fs.isOpened() ); CV_Assert( fs.isOpened() );

@ -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 std::string& name=std::string()) const; void write(FileStorage& fs, const cv::String& name=cv::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 std::string& name=std::string()) const; virtual void write(FileStorage& fs, const cv::String& name=cv::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(std::string url, bool append=false); void savePosteriors(cv::String url, bool append=false);
void savePosteriors2(std::string url, bool append=false); void savePosteriors2(cv::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(std::string file_url); void saveAllFloatPosteriors(cv::String file_url);
void saveAllBytePosteriors(std::string file_url); void saveAllBytePosteriors(cv::String file_url);
void setFloatPosteriorsFromTextfile_176(std::string url); void setFloatPosteriorsFromTextfile_176(cv::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
std::string m_feature_name; // the name of the feature associated with the descriptor cv::String m_feature_name; // the name of the feature associated with the descriptor
CvPoint m_center; // the coordinates of the feature (the center of the input image ROI) 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 std::string &pca_filename, const std::string &train_path = std::string(), const std::string &images_list = std::string(), OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename, const cv::String &train_path = cv::String(), const cv::String &images_list = cv::String(),
float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1, 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 std::string GetPCAFilename () { return "pca.yml"; } static cv::String GetPCAFilename () { return "pca.yml"; }
virtual bool empty() const { return m_train_feature_count <= 0 ? true : false; } 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 std::string &pca_filename, OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename,
const std::string &train_path = std::string (), const std::string &images_list = std::string (), const cv::String &train_path = cv::String (), const cv::String &images_list = cv::String (),
float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1); 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),
std::string pcaFilename = std::string(), cv::String pcaFilename = cv::String(),
std::string trainPath = std::string(), std::string trainImagesList = std::string(), cv::String trainPath = cv::String(), cv::String trainImagesList = cv::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;
std::string pcaFilename; cv::String pcaFilename;
std::string trainPath; cv::String trainPath;
std::string trainImagesList; cv::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 std::string& filename ); Params( const cv::String& filename );
int nclasses; int nclasses;
int patchSize; int patchSize;
@ -2717,7 +2717,7 @@ public:
int compressionMethod; int compressionMethod;
PatchGenerator patchGenerator; PatchGenerator patchGenerator;
std::string filename; cv::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 std::string& classifierFile ); CalonderDescriptorExtractor( const cv::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 std::string& classifier_file) CalonderDescriptorExtractor<T>::CalonderDescriptorExtractor(const cv::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 std::string& name=std::string()) const; void write(FileStorage& fs, const cv::String& name=cv::String()) const;
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT std::vector<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(std::string url, bool append) void RandomizedTree::savePosteriors(cv::String url, bool append)
{ {
std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out)); 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(std::string url, bool append)
file.close(); file.close();
} }
void RandomizedTree::savePosteriors2(std::string url, bool append) void RandomizedTree::savePosteriors2(cv::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(std::string url) void RTreeClassifier::saveAllFloatPosteriors(cv::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(std::string url)
printf("[DEBUG] done\n"); printf("[DEBUG] done\n");
} }
void RTreeClassifier::saveAllBytePosteriors(std::string url) void RTreeClassifier::saveAllBytePosteriors(cv::String url)
{ {
printf("[DEBUG] writing all byte posteriors to %s...\n", url.c_str()); 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(std::string url)
} }
void RTreeClassifier::setFloatPosteriorsFromTextfile_176(std::string url) void RTreeClassifier::setFloatPosteriorsFromTextfile_176(cv::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 = std::string(feature_name); m_feature_name = cv::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 = std::string(feature_name); m_feature_name = cv::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 std::string &pca_filename, OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename,
const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max, const cv::String &train_path, const cv::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 std::string &pca_filename, OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename,
const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) : const cv::String &train_path, const cv::String &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) :
OneWayDescriptorBase(patch_size, pose_count, pca_filename, train_path, images_list, _scale_min, _scale_max, _scale_step, pyr_levels) 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)
{ {
std::string str = std::string ("avg") + postfix; cv::String str = cv::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 = std::string ("eigenvectors") + postfix; str = cv::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, std::string _pcaFilename, OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, cv::String _pcaFilename,
std::string _trainPath, std::string _trainImagesList, cv::String _trainPath, cv::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, std::string (), std::string (), std::string (), base = new OneWayDescriptorObject( params.patchSize, params.poseCount, cv::String (), cv::String (), cv::String (),
params.minScale, params.maxScale, params.stepScale ); 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 std::string& name) const void LDetector::write(FileStorage& fs, const cv::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 std::string& objname) const void FernClassifier::write(FileStorage& fs, const cv::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 std::string& _filename ) FernDescriptorMatcher::Params::Params( const cv::String& _filename )
{ {
filename = _filename; filename = _filename;
} }
@ -1476,7 +1476,7 @@ void PlanarObjectDetector::read(const FileNode& node)
} }
void PlanarObjectDetector::write(FileStorage& fs, const std::string& objname) const void PlanarObjectDetector::write(FileStorage& fs, const cv::String& objname) const
{ {
WriteStructContext ws(fs, objname, CV_NODE_MAP); WriteStructContext ws(fs, objname, CV_NODE_MAP);

@ -593,10 +593,10 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs )
assert(fn.isSeq()); assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 ) for( int i = 0; i < (int)fn.size(); i+=3 )
{ {
string nm = fn[i]; String nm = fn[i];
DatasetParams params; DatasetParams params;
string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str()); String sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str()); String uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
datasetsParams[nm] = params; datasetsParams[nm] = params;
} }
return cvtest::TS::OK; return cvtest::TS::OK;
@ -684,10 +684,10 @@ protected:
assert(fn.isSeq()); assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=4 ) for( int i = 0; i < (int)fn.size(); i+=4 )
{ {
string caseName = fn[i], datasetName = fn[i+1]; String caseName = fn[i], datasetName = fn[i+1];
RunParams params; RunParams params;
string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str()); String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
string iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str()); String iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str());
caseNames.push_back( caseName ); caseNames.push_back( caseName );
caseDatasets.push_back( datasetName ); caseDatasets.push_back( datasetName );
caseRunParams.push_back( params ); caseRunParams.push_back( params );

@ -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<std::string, int>& get_class_labels_map() const; const std::map<cv::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<std::string, int>& CvMLData::get_class_labels_map() const .. ocv:function:: const std::map<cv::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.

@ -1043,7 +1043,7 @@ public:
CvForestTree* get_tree(int i) const; CvForestTree* get_tree(int i) const;
protected: protected:
virtual std::string getName() const; virtual cv::String getName() const;
virtual bool grow_forest( const CvTermCriteria term_crit ); virtual bool grow_forest( const CvTermCriteria term_crit );
@ -1115,7 +1115,7 @@ public:
CvRTParams params=CvRTParams()); CvRTParams params=CvRTParams());
virtual bool train( CvMLData* data, CvRTParams params=CvRTParams() ); virtual bool train( CvMLData* data, CvRTParams params=CvRTParams() );
protected: protected:
virtual std::string getName() const; virtual cv::String getName() const;
virtual bool grow_forest( const CvTermCriteria term_crit ); virtual bool grow_forest( const CvTermCriteria term_crit );
}; };
@ -2072,7 +2072,7 @@ public:
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<std::string, int>& get_class_labels_map() const; const std::map<cv::String, int>& get_class_labels_map() const;
protected: protected:
virtual void clear(); virtual void clear();
@ -2101,7 +2101,7 @@ protected:
bool mix; bool mix;
int total_class_count; int total_class_count;
std::map<std::string, int> class_map; std::map<cv::String, int> class_map;
CvMat* train_sample_idx; CvMat* train_sample_idx;
CvMat* test_sample_idx; CvMat* test_sample_idx;

@ -285,7 +285,7 @@ const CvMat* CvMLData::get_missing() const
return missing; return missing;
} }
const std::map<std::string, int>& CvMLData::get_class_labels_map() const const std::map<cv::String, int>& CvMLData::get_class_labels_map() const
{ {
return class_map; return class_map;
} }

@ -1537,7 +1537,7 @@ CvERTrees::~CvERTrees()
{ {
} }
std::string CvERTrees::getName() const cv::String CvERTrees::getName() const
{ {
return CV_TYPE_NAME_ML_ERTREES; return CV_TYPE_NAME_ML_ERTREES;
} }

@ -1117,7 +1117,7 @@ void CvGBTrees::write( CvFileStorage* fs, const char* name ) const
CvSeqReader reader; CvSeqReader reader;
int i; int i;
std::string s; cv::String s;
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT ); cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT );
@ -1167,7 +1167,7 @@ void CvGBTrees::read( CvFileStorage* fs, CvFileNode* node )
CvFileNode* trees_fnode; CvFileNode* trees_fnode;
CvMemStorage* storage; CvMemStorage* storage;
int i, ntrees; int i, ntrees;
std::string s; cv::String s;
clear(); clear();
read_params( fs, node ); read_params( fs, node );

@ -45,6 +45,7 @@
#include "cvconfig.h" #include "cvconfig.h"
#endif #endif
#include "opencv2/core.hpp"
#include "opencv2/ml.hpp" #include "opencv2/ml.hpp"
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/core/utility.hpp" #include "opencv2/core/utility.hpp"

@ -246,7 +246,7 @@ CvRTrees::~CvRTrees()
clear(); clear();
} }
std::string CvRTrees::getName() const cv::String CvRTrees::getName() const
{ {
return CV_TYPE_NAME_ML_RTREES; return CV_TYPE_NAME_ML_RTREES;
} }
@ -730,7 +730,7 @@ void CvRTrees::write( CvFileStorage* fs, const char* name ) const
if( ntrees < 1 || !trees || nsamples < 1 ) if( ntrees < 1 || !trees || nsamples < 1 )
CV_Error( CV_StsBadArg, "Invalid CvRTrees object" ); CV_Error( CV_StsBadArg, "Invalid CvRTrees object" );
std::string modelNodeName = this->getName(); cv::String modelNodeName = this->getName();
cvStartWriteStruct( fs, name, CV_NODE_MAP, modelNodeName.c_str() ); cvStartWriteStruct( fs, name, CV_NODE_MAP, modelNodeName.c_str() );
cvWriteInt( fs, "nclasses", nclasses ); cvWriteInt( fs, "nclasses", nclasses );

@ -1924,7 +1924,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses,
qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio); qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio);
double old_dist = 0.0; double old_dist = 0.0;
for (int k=0; k<k_fold; ++k) for (int k=0; k<k_fold; ++k)
old_dist += abs(ratios[k].val-class_ratio); old_dist += cv::abs(ratios[k].val-class_ratio);
double new_dist = 1.0; double new_dist = 1.0;
// iterate to make the folds more balanced // iterate to make the folds more balanced
while (new_dist > 0.0) while (new_dist > 0.0)
@ -1941,7 +1941,7 @@ bool CvSVM::train_auto( const CvMat* _train_data, const CvMat* _responses,
qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio); qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio);
new_dist = 0.0; new_dist = 0.0;
for (int k=0; k<k_fold; ++k) for (int k=0; k<k_fold; ++k)
new_dist += abs(ratios[k].val-class_ratio); new_dist += cv::abs(ratios[k].val-class_ratio);
if (new_dist < old_dist) if (new_dist < old_dist)
{ {
// swapping really improves, so swap the samples // swapping really improves, so swap the samples

@ -179,7 +179,7 @@ float knearest_calc_error( CvKNearest* knearest, CvMLData* _data, int k, int typ
} }
// 3. svm // 3. svm
int str_to_svm_type(string& str) int str_to_svm_type(String& str)
{ {
if( !str.compare("C_SVC") ) if( !str.compare("C_SVC") )
return CvSVM::C_SVC; return CvSVM::C_SVC;
@ -194,7 +194,7 @@ int str_to_svm_type(string& str)
CV_Error( CV_StsBadArg, "incorrect svm type string" ); CV_Error( CV_StsBadArg, "incorrect svm type string" );
return -1; return -1;
} }
int str_to_svm_kernel_type( string& str ) int str_to_svm_kernel_type( String& str )
{ {
if( !str.compare("LINEAR") ) if( !str.compare("LINEAR") )
return CvSVM::LINEAR; return CvSVM::LINEAR;
@ -297,7 +297,7 @@ float svm_calc_error( CvSVM* svm, CvMLData* _data, int type, vector<float> *resp
// 4. em // 4. em
// 5. ann // 5. ann
int str_to_ann_train_method( string& str ) int str_to_ann_train_method( String& str )
{ {
if( !str.compare("BACKPROP") ) if( !str.compare("BACKPROP") )
return CvANN_MLP_TrainParams::BACKPROP; return CvANN_MLP_TrainParams::BACKPROP;
@ -412,7 +412,7 @@ float ann_calc_error( CvANN_MLP* ann, CvMLData* _data, map<int, int>& cls_map, i
// 6. dtree // 6. dtree
// 7. boost // 7. boost
int str_to_boost_type( string& str ) int str_to_boost_type( String& str )
{ {
if ( !str.compare("DISCRETE") ) if ( !str.compare("DISCRETE") )
return CvBoost::DISCRETE; return CvBoost::DISCRETE;
@ -546,7 +546,7 @@ void CV_MLBaseTest::run( int )
int CV_MLBaseTest::prepare_test_case( int test_case_idx ) int CV_MLBaseTest::prepare_test_case( int test_case_idx )
{ {
int trainSampleCount, respIdx; int trainSampleCount, respIdx;
string varTypes; String varTypes;
clear(); clear();
string dataPath = ts->get_data_path(); string dataPath = ts->get_data_path();
@ -605,7 +605,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
} }
else if( !modelName.compare(CV_SVM) ) else if( !modelName.compare(CV_SVM) )
{ {
string svm_type_str, kernel_type_str; String svm_type_str, kernel_type_str;
modelParamsNode["svm_type"] >> svm_type_str; modelParamsNode["svm_type"] >> svm_type_str;
modelParamsNode["kernel_type"] >> kernel_type_str; modelParamsNode["kernel_type"] >> kernel_type_str;
CvSVMParams params; CvSVMParams params;
@ -625,7 +625,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
} }
else if( !modelName.compare(CV_ANN) ) else if( !modelName.compare(CV_ANN) )
{ {
string train_method_str; String train_method_str;
double param1, param2; double param1, param2;
modelParamsNode["train_method"] >> train_method_str; modelParamsNode["train_method"] >> train_method_str;
modelParamsNode["param1"] >> param1; modelParamsNode["param1"] >> param1;
@ -659,7 +659,7 @@ int CV_MLBaseTest::train( int testCaseIdx )
int BOOST_TYPE, WEAK_COUNT, MAX_DEPTH; int BOOST_TYPE, WEAK_COUNT, MAX_DEPTH;
float WEIGHT_TRIM_RATE; float WEIGHT_TRIM_RATE;
bool USE_SURROGATE; bool USE_SURROGATE;
string typeStr; String typeStr;
modelParamsNode["type"] >> typeStr; modelParamsNode["type"] >> typeStr;
BOOST_TYPE = str_to_boost_type( typeStr ); BOOST_TYPE = str_to_boost_type( typeStr );
modelParamsNode["weak_count"] >> WEAK_COUNT; modelParamsNode["weak_count"] >> WEAK_COUNT;

@ -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, std::string kernelName, size_t globalThreads[3], static void openCLExecuteKernelSURF(Context *clCxt , const char **source, cv::String kernelName, size_t globalThreads[3],
size_t localThreads[3], std::vector< std::pair<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;
std::string kernelName = "icvCalcLayerDetAndTrace"; cv::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;
std::string kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer"; cv::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;
std::string kernelName = "icvInterpolateKeypoint"; cv::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;
std::string kernelName = "icvCalcOrientation"; cv::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;
std::string kernelName = "icvSetUpright"; cv::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;
std::string kernelName; cv::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<std::string>& filenames, const std::vector<std::string>& classNames=std::vector<std::string>() ); LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::String>& classNames=std::vector<cv::String>() );
virtual ~LatentSvmDetector(); virtual ~LatentSvmDetector();
virtual void clear(); virtual void clear();
virtual bool empty() const; virtual bool empty() const;
bool load( const std::vector<std::string>& filenames, const std::vector<std::string>& classNames=std::vector<std::string>() ); bool load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& classNames=std::vector<cv::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<std::string>& getClassNames() const; const std::vector<cv::String>& getClassNames() const;
size_t getClassCount() const; size_t getClassCount() const;
private: private:
std::vector<CvLatentSvmDetector*> detectors; std::vector<CvLatentSvmDetector*> detectors;
std::vector<std::string> classNames; std::vector<cv::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 std::string& filename ); CV_WRAP CascadeClassifier( const cv::String& filename );
virtual ~CascadeClassifier(); virtual ~CascadeClassifier();
CV_WRAP virtual bool empty() const; CV_WRAP virtual bool empty() const;
CV_WRAP bool load( const std::string& filename ); CV_WRAP bool load( const cv::String& filename );
virtual bool read( const FileNode& node ); 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 std::string& filename) CV_WRAP HOGDescriptor(const cv::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 std::string& objname) const; virtual void write(FileStorage& fs, const cv::String& objname) const;
CV_WRAP virtual bool load(const std::string& filename, const std::string& objname=std::string()); CV_WRAP virtual bool load(const cv::String& filename, const cv::String& objname=cv::String());
CV_WRAP virtual void save(const std::string& filename, const std::string& objname=std::string()) const; CV_WRAP virtual void save(const cv::String& filename, const cv::String& objname=cv::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(std::string modelfile); void readALTModel(cv::String modelfile);
}; };
CV_EXPORTS_W void findDataMatrix(InputArray image, CV_EXPORTS_W void findDataMatrix(InputArray image,
CV_OUT std::vector<std::string>& codes, CV_OUT std::vector<cv::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<std::string>& codes, const std::vector<cv::String>& codes,
InputArray corners); InputArray corners);
} }
@ -758,7 +758,7 @@ public:
return processImpl(src, mask); return processImpl(src, mask);
} }
virtual std::string name() const =0; virtual cv::String name() const =0;
virtual void read(const FileNode& fn) =0; virtual void 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 std::string& modality_type); static Ptr<Modality> create(const cv::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 std::string name() const; virtual cv::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 std::string name() const; virtual cv::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 std::string& class_id, int template_id); Match(int x, int y, float similarity, const cv::String& class_id, int template_id);
/// Sort matches with high similarity to the front /// 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;
std::string class_id; cv::String class_id;
int template_id; int template_id;
}; };
inline Match::Match(int _x, int _y, float _similarity, const std::string& _class_id, int _template_id) inline Match::Match(int _x, int _y, float _similarity, const cv::String& _class_id, int _template_id)
: x(_x), y(_y), similarity(_similarity), class_id(_class_id), template_id(_template_id) : 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<std::string>& class_ids = std::vector<std::string>(), const std::vector<cv::String>& class_ids = std::vector<cv::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 std::string& class_id, int addTemplate(const std::vector<Mat>& sources, const cv::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 std::string& class_id); int addSyntheticTemplate(const std::vector<Template>& templates, const cv::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 std::string& class_id, int template_id) const; const std::vector<Template>& getTemplates(const cv::String& class_id, int template_id) const;
int numTemplates() const; int numTemplates() const;
int numTemplates(const std::string& class_id) const; int numTemplates(const cv::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<std::string> classIds() const; std::vector<cv::String> classIds() const;
void read(const FileNode& fn); void read(const FileNode& fn);
void write(FileStorage& fs) const; void write(FileStorage& fs) const;
std::string readClass(const FileNode& fn, const std::string &class_id_override = ""); cv::String readClass(const FileNode& fn, const cv::String &class_id_override = "");
void writeClass(const std::string& class_id, FileStorage& fs) const; void writeClass(const cv::String& class_id, FileStorage& fs) const;
void readClasses(const std::vector<std::string>& class_ids, void readClasses(const std::vector<cv::String>& class_ids,
const std::string& format = "templates_%s.yml.gz"); const cv::String& format = "templates_%s.yml.gz");
void writeClasses(const std::string& format = "templates_%s.yml.gz") const; void writeClasses(const cv::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<std::string, std::vector<TemplatePyramid> > TemplatesMap; typedef std::map<cv::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 std::string& class_id, const cv::String& class_id,
const std::vector<TemplatePyramid>& template_pyramids) const; const std::vector<TemplatePyramid>& template_pyramids) const;
}; };

@ -854,7 +854,7 @@ CascadeClassifier::CascadeClassifier()
{ {
} }
CascadeClassifier::CascadeClassifier(const std::string& filename) CascadeClassifier::CascadeClassifier(const cv::String& filename)
{ {
load(filename); load(filename);
} }
@ -868,7 +868,7 @@ bool CascadeClassifier::empty() const
return oldCascade.empty() && data.stages.empty(); return oldCascade.empty() && data.stages.empty();
} }
bool CascadeClassifier::load(const std::string& filename) bool CascadeClassifier::load(const cv::String& filename)
{ {
oldCascade.release(); oldCascade.release();
data = Data(); data = Data();
@ -1209,13 +1209,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
std::string stageTypeStr = (std::string)root[CC_STAGE_TYPE]; cv::String stageTypeStr = (cv::String)root[CC_STAGE_TYPE];
if( stageTypeStr == CC_BOOST ) if( stageTypeStr == CC_BOOST )
stageType = BOOST; stageType = BOOST;
else else
return false; return false;
std::string featureTypeStr = (std::string)root[CC_FEATURE_TYPE]; cv::String featureTypeStr = (cv::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<std::string>& codes, std::vector<cv::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] = std::string(rc_i.msg); codes[i] = cv::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<std::string>& codes, const std::vector<cv::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 std::string& objName) const void HOGDescriptor::write(FileStorage& fs, const cv::String& objName) const
{ {
if( !objName.empty() ) if( !objName.empty() )
fs << objName; fs << objName;
@ -143,14 +143,14 @@ void HOGDescriptor::write(FileStorage& fs, const std::string& objName) const
fs << "}"; fs << "}";
} }
bool HOGDescriptor::load(const std::string& filename, const std::string& objname) bool HOGDescriptor::load(const cv::String& filename, const cv::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 std::string& filename, const std::string& objName) const void HOGDescriptor::save(const cv::String& filename, const cv::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(std::string modelfile) void HOGDescriptor::readALTModel(cv::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)
{ {
std::string eerr("file not exist"); cv::String eerr("file not exist");
std::string efile(__FILE__); cv::String efile(__FILE__);
std::string efunc(__FUNCTION__); cv::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))
{ {
std::string eerr("version?"); cv::String eerr("version?");
std::string efile(__FILE__); cv::String efile(__FILE__);
std::string efunc(__FUNCTION__); cv::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")) {
std::string eerr("version doesnot match"); cv::String eerr("version doesnot match");
std::string efile(__FILE__); cv::String efile(__FILE__);
std::string efunc(__FUNCTION__); cv::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(std::string modelfile)
{ throw Exception(); } { throw Exception(); }
if (version < 200) if (version < 200)
{ {
std::string eerr("version doesnot match"); cv::String eerr("version doesnot match");
std::string efile(__FILE__); cv::String efile(__FILE__);
std::string efunc(__FUNCTION__); cv::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<std::string>& filenames, const std::vector<std::string>& _classNames ) LatentSvmDetector::LatentSvmDetector( const std::vector<cv::String>& filenames, const std::vector<cv::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<std::string>& LatentSvmDetector::getClassNames() const const std::vector<cv::String>& LatentSvmDetector::getClassNames() const
{ {
return classNames; return classNames;
} }
@ -192,13 +192,13 @@ size_t LatentSvmDetector::getClassCount() const
return classNames.size(); return classNames.size();
} }
static std::string extractModelName( const std::string& filename ) static cv::String extractModelName( const cv::String& filename )
{ {
size_t startPos = filename.rfind('/'); size_t startPos = filename.rfind('/');
if( startPos == std::string::npos ) if( startPos == cv::String::npos )
startPos = filename.rfind('\\'); startPos = filename.rfind('\\');
if( startPos == std::string::npos ) if( startPos == cv::String::npos )
startPos = 0; startPos = 0;
else else
startPos++; startPos++;
@ -210,7 +210,7 @@ static std::string extractModelName( const std::string& filename )
return filename.substr(startPos, substrLength); return filename.substr(startPos, substrLength);
} }
bool LatentSvmDetector::load( const std::vector<std::string>& filenames, const std::vector<std::string>& _classNames ) bool LatentSvmDetector::load( const std::vector<cv::String>& filenames, const std::vector<cv::String>& _classNames )
{ {
clear(); clear();
@ -218,7 +218,7 @@ bool LatentSvmDetector::load( const std::vector<std::string>& filenames, const s
for( size_t i = 0; i < filenames.size(); i++ ) for( size_t i = 0; i < filenames.size(); i++ )
{ {
const std::string filename = filenames[i]; const cv::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 std::string& modality_type) Ptr<Modality> Modality::create(const cv::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 std::string& modality_type)
Ptr<Modality> Modality::create(const FileNode& fn) Ptr<Modality> Modality::create(const FileNode& fn)
{ {
std::string type = fn["type"]; cv::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";
std::string ColorGradient::name() const cv::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)
{ {
std::string type = fn["type"]; cv::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";
std::string DepthNormal::name() const cv::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)
{ {
std::string type = fn["type"]; cv::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<std::string>& class_ids, OutputArrayOfArrays quantized_images, const std::vector<cv::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 std::string& class_id, const cv::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 std::string& class_id, int Detector::addTemplate(const std::vector<Mat>& sources, const cv::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 std::string& cl
return template_id; return template_id;
} }
int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const std::string& class_id) int Detector::addSyntheticTemplate(const std::vector<Template>& templates, const cv::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 std::string& class_id, int template_id) const const std::vector<Template>& Detector::getTemplates(const cv::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 std::string& class_id) const int Detector::numTemplates(const cv::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 std::string& class_id) const
return static_cast<int>(i->second.size()); return static_cast<int>(i->second.size());
} }
std::vector<std::string> Detector::classIds() const std::vector<cv::String> Detector::classIds() const
{ {
std::vector<std::string> ids; std::vector<cv::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
} }
std::string Detector::readClass(const FileNode& fn, const std::string &class_id_override) cv::String Detector::readClass(const FileNode& fn, const cv::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() == (std::string)(*mod_it)); CV_Assert(modalities[i]->name() == (cv::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
std::string class_id; cv::String class_id;
if (class_id_override.empty()) if (class_id_override.empty())
{ {
std::string class_id_tmp = fn["class_id"]; cv::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 std::string& class_id, FileStorage& fs) const void Detector::writeClass(const cv::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 std::string& class_id, FileStorage& fs) const
fs << "]"; // pyramids fs << "]"; // pyramids
} }
void Detector::readClasses(const std::vector<std::string>& class_ids, void Detector::readClasses(const std::vector<cv::String>& class_ids,
const std::string& format) const cv::String& format)
{ {
for (size_t i = 0; i < class_ids.size(); ++i) for (size_t i = 0; i < class_ids.size(); ++i)
{ {
const std::string& class_id = class_ids[i]; const cv::String& class_id = class_ids[i];
std::string filename = cv::format(format.c_str(), class_id.c_str()); cv::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 std::string& format) const void Detector::writeClasses(const cv::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 std::string& class_id = it->first; const cv::String& class_id = it->first;
std::string filename = cv::format(format.c_str(), class_id.c_str()); cv::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);
} }

@ -122,7 +122,7 @@ int CV_DetectorTest::prepareData( FileStorage& _fs )
FileNodeIterator it = fn[DETECTOR_NAMES].begin(); FileNodeIterator it = fn[DETECTOR_NAMES].begin();
for( ; it != fn[DETECTOR_NAMES].end(); ) for( ; it != fn[DETECTOR_NAMES].end(); )
{ {
string _name; String _name;
it >> _name; it >> _name;
detectorNames.push_back(_name); detectorNames.push_back(_name);
readDetector(fn[DETECTORS][_name]); readDetector(fn[DETECTORS][_name]);
@ -136,7 +136,7 @@ int CV_DetectorTest::prepareData( FileStorage& _fs )
{ {
for( FileNodeIterator it = fn[IMAGE_FILENAMES].begin(); it != fn[IMAGE_FILENAMES].end(); ) for( FileNodeIterator it = fn[IMAGE_FILENAMES].begin(); it != fn[IMAGE_FILENAMES].end(); )
{ {
string filename; String filename;
it >> filename; it >> filename;
imageFilenames.push_back(filename); imageFilenames.push_back(filename);
Mat img = imread( dataPath+filename, 1 ); Mat img = imread( dataPath+filename, 1 );
@ -402,7 +402,7 @@ CV_CascadeDetectorTest::CV_CascadeDetectorTest()
void CV_CascadeDetectorTest::readDetector( const FileNode& fn ) void CV_CascadeDetectorTest::readDetector( const FileNode& fn )
{ {
string filename; String filename;
int flag; int flag;
fn[FILENAME] >> filename; fn[FILENAME] >> filename;
detectorFilenames.push_back(filename); detectorFilenames.push_back(filename);
@ -493,7 +493,7 @@ CV_HOGDetectorTest::CV_HOGDetectorTest()
void CV_HOGDetectorTest::readDetector( const FileNode& fn ) void CV_HOGDetectorTest::readDetector( const FileNode& fn )
{ {
string filename; String filename;
if( fn[FILENAME].node->data.seq != 0 ) if( fn[FILENAME].node->data.seq != 0 )
fn[FILENAME] >> filename; fn[FILENAME] >> filename;
detectorFilenames.push_back( filename); detectorFilenames.push_back( filename);

@ -232,9 +232,9 @@ void LatentSVMDetectorTest::run( int /* start_from */)
// detector12 - to test case of two (several) classes 'cat' and car // detector12 - to test case of two (several) classes 'cat' and car
// Load detectors // Load detectors
LatentSvmDetector detector1( vector<string>(1,model_path_cat) ); LatentSvmDetector detector1( vector<String>(1,model_path_cat) );
vector<string> models_pathes(2); vector<String> models_pathes(2);
models_pathes[0] = model_path_cat; models_pathes[0] = model_path_cat;
models_pathes[1] = model_path_car; models_pathes[1] = model_path_car;
LatentSvmDetector detector12( models_pathes ); LatentSvmDetector detector12( models_pathes );

@ -103,7 +103,7 @@ namespace cv
~Info(); ~Info();
void release(); void release();
Info &operator = (const Info &m); Info &operator = (const Info &m);
std::vector<std::string> DeviceName; std::vector<cv::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, std::string kernelName, const char **source, cv::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, std::string kernelName, const char **fileName, const int numFiles, cv::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, std::string kernelName); const char **source, cv::String kernelName);
cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt, cl_kernel CV_EXPORTS openCLGetKernelFromSource(const Context *clCxt,
const char **source, std::string kernelName, const char *build_options); const char **source, cv::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, std::string kernelName, std::vector< std::pair<size_t, const void *> > &args, void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, cv::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, std::string kernelName, void CV_EXPORTS openCLExecuteKernel_(Context *clCxt , const char **source, cv::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, std::string kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, cv::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, std::string kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel(Context *clCxt , const char **source, cv::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, std::string kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel2(Context *clCxt , const char **source, cv::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, std::string kernelName, size_t globalThreads[3], void CV_EXPORTS openCLExecuteKernel2(Context *clCxt , const char **source, cv::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, std::string kernelName, const char **kernelString, void *_scalar) void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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, std::st
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, std::string kernelName, const char **kernelString) static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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, std::string kernelName, const char **kernelString) static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, cv::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, std::string kernelName, typedef void (*MulDivFunc)(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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, std::string kernelName, const char **kernelString, int isMatSubScalar) void arithmetic_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::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, std::string kernelName, const char **kernelString, double scalar) static void arithmetic_scalar_run(const oclMat &src, oclMat &dst, cv::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, std::string ke
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, std::string kernelName, const char **kernelString, int isMatSubScalar); typedef void (*ArithmeticFuncS)(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, std::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 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, std::string kernelName, const char **kernelString) static void arithmetic_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::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)
{ {
std::string kernelName = mask.data ? "arithm_s_add_with_mask" : "arithm_s_add"; cv::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)
{ {
std::string kernelName = mask.data ? "arithm_s_sub_with_mask" : "arithm_s_sub"; cv::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)
{ {
std::string kernelName = mask.data ? "arithm_s_sub_with_mask" : "arithm_s_sub"; cv::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;
} }
std::string kernelName = "arithm_s_div"; cv::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)
{ {
std::string kernelName = "arithm_s_absdiff"; cv::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, std::string kernelName, const char **kernelString) static void compare_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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;
} }
std::string kernelName; cv::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, std::string kernelName) static void arithmetic_minMax_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen , int groupnum, cv::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, std::string kernelName) static void arithmetic_minMax_mask_run(const oclMat &src, const oclMat &mask, cl_mem &dst, int vlen, int groupnum, cv::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, std::string kernelName) static void arithmetic_flip_rows_run(const oclMat &src, oclMat &dst, cv::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, std::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, std::string kernelName, bool isVertical) static void arithmetic_flip_cols_run(const oclMat &src, oclMat &dst, cv::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, std::string kernelName) static void arithmetic_lut_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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);
std::string kernelName = "LUT"; cv::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, std::string kernelName, const char **kernelString) static void arithmetic_exp_log_run(const oclMat &src, oclMat &dst, cv::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, std::string kernelName) static void arithmetic_magnitude_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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, std::string kernelName, const char **kernelString) static void arithmetic_phase_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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());
std::string kernelName = angleInDegrees ? "arithm_phase_indegrees" : "arithm_phase_inradians"; cv::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,
std::string kernelName, bool angleInDegrees) cv::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,
std::string kernelName) cv::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, std::string kernelName) static void arithmetic_countNonZero_run(const oclMat &src, cl_mem &dst, int vlen , int groupnum, cv::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;
std::string kernelName = "arithm_op_nonzero"; cv::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, std::string kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, oclMat &dst, cv::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, std::string kernelName,
template<typename T> template<typename T>
void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, std::string kernelName, const char **kernelString, void *_scalar) void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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, std::strin
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, std::string kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, cv::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, std::string kernelName, const char **kernelString) static void bitwise_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, cv::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, std::string kernelName, const char **kernelString, int isMatSubScalar) void bitwise_scalar_run(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::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, std::string kernelName, const char **kernelString, int isMatSubScalar); typedef void (*BitwiseFuncS)(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, std::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 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, std::string kernelName, const char **kernelString) static void bitwise_scalar(const oclMat &src1, const Scalar &src2, oclMat &dst, const oclMat &mask, cv::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());
std::string kernelName = "arithm_bitwise_not"; cv::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;
std::string kernelName = mask.empty() ? "arithm_bitwise_or" : "arithm_bitwise_or_with_mask"; cv::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;
} }
std::string kernelName = mask.data ? "arithm_s_bitwise_or_with_mask" : "arithm_s_bitwise_or"; cv::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;
std::string kernelName = mask.empty() ? "arithm_bitwise_and" : "arithm_bitwise_and_with_mask"; cv::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;
} }
std::string kernelName = mask.data ? "arithm_s_bitwise_and_with_mask" : "arithm_s_bitwise_and"; cv::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;
std::string kernelName = mask.empty() ? "arithm_bitwise_xor" : "arithm_bitwise_xor_with_mask"; cv::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;
} }
std::string kernelName = mask.data ? "arithm_s_bitwise_xor_with_mask" : "arithm_s_bitwise_xor"; cv::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, std::string kernelName) static void transpose_run(const oclMat &src, oclMat &dst, cv::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, std::string kernelName, const char **kernelString) static void arithmetic_pow_run(const oclMat &src1, double p, oclMat &dst, cv::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());
std::string kernelName = "arithm_pow"; cv::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(std::string srcsign); cl_program progLookup(cv::String srcsign);
//add program to the cache //add program to the cache
void addProgram(std::string srcsign, cl_program program); void addProgram(cv::String srcsign, cl_program program);
void releaseProgram(); void releaseProgram();
std::map <std::string, cl_program> codeCache; std::map <cv::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 ));
std::string kernelName = "BlendLinear"; cv::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 ));
std::string kernelName = "BruteForceMatch_UnrollMatch"; cv::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 ));
std::string kernelName = "BruteForceMatch_Match"; cv::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 ));
std::string kernelName = "BruteForceMatch_RadiusUnrollMatch"; cv::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 ));
std::string kernelName = "BruteForceMatch_RadiusMatch"; cv::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 ));
std::string kernelName = "BruteForceMatch_knnUnrollMatch"; cv::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 ));
std::string kernelName = "BruteForceMatch_knnMatch"; cv::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 ));
std::string kernelName = "BruteForceMatch_calcDistanceUnrolled"; cv::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 ));
std::string kernelName = "BruteForceMatch_calcDistance"; cv::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;
std::string kernelName = "BruteForceMatch_findBestMatch"; cv::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();
std::string kernelName = "buildWarpPlaneMaps"; cv::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();
std::string kernelName = "buildWarpCylindricalMaps"; cv::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();
std::string kernelName = "buildWarpSphericalMaps"; cv::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();
std::string kernelName = "buildWarpAffineMaps"; cv::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();
std::string kernelName = "buildWarpPerspectiveMaps"; cv::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;
std::string kernelName = "calcSobelRowPass"; cv::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;
std::string kernelName = "calcMagnitude_buf"; cv::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;
std::string kernelName = "calcMagnitude"; cv::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};
std::string kernelName = "calcMap"; cv::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;
std::string kernelName = "edgesHysteresisLocal"; cv::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;
std::string kernelName = "edgesHysteresisGlobal"; cv::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;
std::string kernelName = "getEdges"; cv::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 std::string kernelName = "columnSum"; const cv::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;
std::string kernelName; cv::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;
std::string kernelName; cv::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();
std::string kernelName = "filter2D"; cv::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;
std::string kernelName = "boxFilter_C1_D0"; cv::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;
std::string kernelName = "boxFilter_C4_D0"; cv::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;
std::string kernelName = "boxFilter_C1_D5"; cv::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;
std::string kernelName = "boxFilter_C4_D5"; cv::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};
std::string kernelName = "row_filter"; cv::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};
std::string kernelName = "col_filter"; cv::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();
std::string kernelName = "compute_hists_kernel"; cv::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();
std::string kernelName = "normalize_hists_kernel"; cv::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();
std::string kernelName = "classify_hists_kernel"; cv::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();
std::string kernelName = "extract_descrs_by_rows_kernel"; cv::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();
std::string kernelName = "extract_descrs_by_cols_kernel"; cv::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();
std::string kernelName = "compute_gradients_8UC1_kernel"; cv::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();
std::string kernelName = "compute_gradients_8UC4_kernel"; cv::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();
std::string kernelName = (src.type() == CV_8UC1) ? "resize_8UC1_kernel" : "resize_8UC4_kernel"; cv::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);
std::string kernelName = "threshold"; cv::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);
std::string kernelName = "threshold"; cv::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());
std::string kernelName; cv::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());
std::string kernelName; cv::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;
std::string kernelName = "medianFilter"; cv::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)
{ {
std::string kernelName = "medianFilter3"; cv::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)
{ {
std::string kernelName = "medianFilter5"; cv::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");
//std::string kernelName = "medianFilter"; //cv::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");
} }
std::string kernelName = "copymakeborder"; cv::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;
std::string s[3] = {"NN", "Linear", "Cubic"}; cv::String s[3] = {"NN", "Linear", "Cubic"};
std::string kernelName = "warpAffine" + s[interpolation]; cv::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;
std::string s[3] = {"NN", "Linear", "Cubic"}; cv::String s[3] = {"NN", "Linear", "Cubic"};
std::string kernelName = "warpPerspective" + s[interpolation]; cv::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, std::string kernelName, int block_size, float k, oclMat &Dx, oclMat &Dy, static void corner_ocl(const char *src_str, cv::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();
std::string kernelName = "calc_sub_hist"; cv::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;
std::string kernelName = "merge_hist"; cv::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;
std::string kernelName = "calLUT"; cv::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);
std::string kernelName = "bilateral"; cv::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, std::string kernelName, const char **kernelString) static void convolve_run(const oclMat &src, const oclMat &temp1, oclMat &dst, cv::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());
std::string kernelName = "convolve"; cv::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(std::string srcsign) cl_program ProgramCache::progLookup(cv::String srcsign)
{ {
std::map<std::string, cl_program>::iterator iter; std::map<cv::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(std::string srcsign , cl_program program) void ProgramCache::addProgram(cv::String srcsign , cl_program program)
{ {
if(!progLookup(srcsign)) if(!progLookup(srcsign))
{ {
codeCache.insert(std::map<std::string, cl_program>::value_type(srcsign, program)); codeCache.insert(std::map<cv::String, cl_program>::value_type(srcsign, program));
} }
} }
void ProgramCache::releaseProgram() void ProgramCache::releaseProgram()
{ {
std::map<std::string, cl_program>::iterator iter; std::map<cv::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<std::string> devName; std::vector<cv::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
std::string binpath; cv::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 = std::string(extends_set).find("cl_khr_fp64"); size_t fp64_khr = cv::String(extends_set).find("cl_khr_fp64");
if(fp64_khr != std::string::npos) if(fp64_khr != cv::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, std::string kernelName) cl_kernel openCLGetKernelFromSource(const Context *clCxt, const char **source, cv::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, std::string kernelName, cl_kernel openCLGetKernelFromSource(const Context *clCxt, const char **source, cv::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;
std::string srcsign; cv::String srcsign;
std::string filename; cv::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, std::string kernelName, size_t globalThreads[3], void openCLExecuteKernel_(Context *clCxt , const char **source, cv::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, std::string kernelName, void openCLExecuteKernel(Context *clCxt , const char **source, cv::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, std::string kernelName, void openCLExecuteKernel(Context *clCxt , const char **source, cv::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
std::string data_type[] = { "uchar", "char", "ushort", "short", "int", "float", "double"}; cv::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, std::string kernelName, double openCLExecuteKernelInterop(Context *clCxt , const char **source, cv::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, std::string& s) static int convertToString(const char *filename, cv::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, std::string kernelName, double openCLExecuteKernelInterop(Context *clCxt , const char **fileName, const int numFiles, cv::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<std::string> fsource; std::vector<cv::String> fsource;
for (int i = 0 ; i < numFiles ; i++) for (int i = 0 ; i < numFiles ; i++)
{ {
std::string str; cv::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();
std::string kernelName = "memsetKernel"; cv::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();
std::string kernelName = "normalizeKernel"; cv::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();
std::string kernelName = "forwardWarpKernel"; cv::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();
std::string kernelName = "blendFramesKernel"; cv::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;
std::string kernelName = "matchTemplate_Prepared_SQDIFF_NORMED"; cv::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;
std::string kernelName = "matchTemplate_Naive_SQDIFF"; cv::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;
std::string kernelName = "normalizeKernel"; cv::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;
std::string kernelName = "matchTemplate_Naive_CCORR"; cv::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;
std::string kernelName; cv::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;
std::string kernelName; cv::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;
std::string kernelName = "convertC3C4"; cv::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;
std::string kernelName = "convertC4C3"; cv::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, std::string kernelName) static void copy_to_with_mask(const oclMat &src, oclMat &dst, const oclMat &mask, cv::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;
std::string string_types[4][7] = {{"uchar", "char", "ushort", "short", "int", "float", "double"}, cv::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)
{ {
std::string kernelName = "convert_to_S"; cv::String kernelName = "convert_to_S";
std::stringstream idxStr; cv::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, std::string kernelName) static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, cv::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, std:
#endif #endif
} }
static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const oclMat &mask, std::string kernelName) static void set_to_withmask_run(const oclMat &dst, const Scalar &scalar, const oclMat &mask, cv::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;

@ -60,14 +60,14 @@ namespace cv
} }
// provide additional methods for the user to interact with the command queue after a task is fired // provide additional methods for the user to interact with the command queue after a task is fired
static void openCLExecuteKernel_2(Context *clCxt , const char **source, std::string kernelName, size_t globalThreads[3], static void openCLExecuteKernel_2(Context *clCxt , const char **source, cv::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) int depth, char *build_options, FLUSH_MODE finish_mode)
{ {
//construct kernel name //construct kernel name
//The rule is functionName_Cn_Dn, C represent Channels, D Represent DataType Depth, n represent an integer number //The rule is functionName_Cn_Dn, C represent Channels, D Represent DataType Depth, n represent an integer number
//for exmaple split_C2_D2, represent the split kernel with channels =2 and dataType Depth = 2(Data type is char) //for exmaple split_C2_D2, represent the split kernel with channels =2 and dataType Depth = 2(Data type is char)
std::stringstream idxStr; cv::Stringstream idxStr;
if(channels != -1) if(channels != -1)
idxStr << "_C" << channels; idxStr << "_C" << channels;
if(depth != -1) if(depth != -1)
@ -106,14 +106,14 @@ namespace cv
openCLSafeCall(clReleaseKernel(kernel)); openCLSafeCall(clReleaseKernel(kernel));
} }
void openCLExecuteKernel2(Context *clCxt , const char **source, std::string kernelName, void openCLExecuteKernel2(Context *clCxt , const char **source, cv::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, FLUSH_MODE finish_mode) std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, FLUSH_MODE finish_mode)
{ {
openCLExecuteKernel2(clCxt, source, kernelName, globalThreads, localThreads, args, openCLExecuteKernel2(clCxt, source, kernelName, globalThreads, localThreads, args,
channels, depth, NULL, finish_mode); channels, depth, NULL, finish_mode);
} }
void openCLExecuteKernel2(Context *clCxt , const char **source, std::string kernelName, void openCLExecuteKernel2(Context *clCxt , const char **source, cv::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, char *build_options, FLUSH_MODE finish_mode) std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, char *build_options, FLUSH_MODE finish_mode)

@ -72,7 +72,7 @@ static void pyrdown_run(const oclMat &src, const oclMat &dst)
//int channels = dst.channels(); //int channels = dst.channels();
//int depth = dst.depth(); //int depth = dst.depth();
std::string kernelName = "pyrDown"; cv::String kernelName = "pyrDown";
//int vector_lengths[4][7] = {{4, 0, 4, 4, 1, 1, 1}, //int vector_lengths[4][7] = {{4, 0, 4, 4, 1, 1, 1},
// {4, 0, 4, 4, 1, 1, 1}, // {4, 0, 4, 4, 1, 1, 1},

@ -114,8 +114,8 @@ inline int divUp(int total, int grain)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
static void convert_run_cus(const oclMat &src, oclMat &dst, double alpha, double beta) static void convert_run_cus(const oclMat &src, oclMat &dst, double alpha, double beta)
{ {
std::string kernelName = "convert_to_S"; cv::String kernelName = "convert_to_S";
std::stringstream idxStr; cv::Stringstream idxStr;
idxStr << src.depth(); idxStr << src.depth();
kernelName += idxStr.str(); kernelName += idxStr.str();
float alpha_f = (float)alpha, beta_f = (float)beta; float alpha_f = (float)alpha, beta_f = (float)beta;
@ -183,7 +183,7 @@ void convertTo( const oclMat &src, oclMat &dst, int rtype, double alpha, double
// setTo(s); // setTo(s);
// return *this; // return *this;
//} //}
static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar, std::string kernelName) static void set_to_withoutmask_run_cus(const oclMat &dst, const Scalar &scalar, cv::String kernelName)
{ {
std::vector<std::pair<size_t , const void *> > args; std::vector<std::pair<size_t , const void *> > args;
@ -399,7 +399,7 @@ static oclMat &setTo(oclMat &src, const Scalar &scalar)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
////////////////////////////////// CopyTo ///////////////////////////////// ////////////////////////////////// CopyTo /////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// static void copy_to_with_mask_cus(const oclMat &src, oclMat &dst, const oclMat &mask, std::string kernelName) // static void copy_to_with_mask_cus(const oclMat &src, oclMat &dst, const oclMat &mask, cv::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
@ -407,7 +407,7 @@ static oclMat &setTo(oclMat &src, const Scalar &scalar)
// std::vector<std::pair<size_t , const void *> > args; // std::vector<std::pair<size_t , const void *> > args;
// std::string string_types[4][7] = {{"uchar", "char", "ushort", "short", "int", "float", "double"}, // cv::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"}
@ -461,7 +461,7 @@ static void copyTo(const oclMat &src, oclMat &m )
// } // }
// } // }
static void arithmetic_run(const oclMat &src1, oclMat &dst, std::string kernelName, const char **kernelString, void *_scalar) static void arithmetic_run(const oclMat &src1, oclMat &dst, cv::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)
{ {
@ -539,7 +539,7 @@ static void pyrdown_run_cus(const oclMat &src, const oclMat &dst)
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
std::string kernelName = "pyrDown"; cv::String kernelName = "pyrDown";
size_t localThreads[3] = { 256, 1, 1 }; size_t localThreads[3] = { 256, 1, 1 };
size_t globalThreads[3] = { src.cols, dst.rows, 1}; size_t globalThreads[3] = { src.cols, dst.rows, 1};
@ -571,7 +571,7 @@ static void lkSparse_run(oclMat &I, oclMat &J,
{ {
Context *clCxt = I.clCxt; Context *clCxt = I.clCxt;
int elemCntPerRow = I.step / I.elemSize(); int elemCntPerRow = I.step / I.elemSize();
std::string kernelName = "lkSparse"; cv::String kernelName = "lkSparse";
bool isImageSupported = support_image2d(); bool isImageSupported = support_image2d();
size_t localThreads[3] = { 8, isImageSupported ? 8 : 32, 1 }; size_t localThreads[3] = { 8, isImageSupported ? 8 : 32, 1 };
size_t globalThreads[3] = { 8 * ptcount, isImageSupported ? 8 : 32, 1}; size_t globalThreads[3] = { 8 * ptcount, isImageSupported ? 8 : 32, 1};
@ -724,7 +724,7 @@ static void lkDense_run(oclMat &I, oclMat &J, oclMat &u, oclMat &v,
bool isImageSupported = support_image2d(); bool isImageSupported = support_image2d();
int elemCntPerRow = I.step / I.elemSize(); int elemCntPerRow = I.step / I.elemSize();
std::string kernelName = "lkDense"; cv::String kernelName = "lkDense";
size_t localThreads[3] = { 16, 16, 1 }; size_t localThreads[3] = { 16, 16, 1 };
size_t globalThreads[3] = { I.cols, I.rows, 1}; size_t globalThreads[3] = { I.cols, I.rows, 1};

@ -64,7 +64,7 @@ namespace cv
Context *clCxt = src.clCxt; Context *clCxt = src.clCxt;
const std::string kernelName = "pyrUp"; const cv::String kernelName = "pyrUp";
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));

@ -84,7 +84,7 @@ namespace cv
// int channels = mat_dst.oclchannels(); // int channels = mat_dst.oclchannels();
// int depth = mat_dst.depth(); // int depth = mat_dst.depth();
// std::string kernelName = "merge_vector"; // cv::String kernelName = "merge_vector";
// int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0}, // int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0},
// {4, 4, 2, 2, 1, 1, 1}, // {4, 4, 2, 2, 1, 1, 1},
@ -135,7 +135,7 @@ namespace cv
int channels = mat_dst.oclchannels(); int channels = mat_dst.oclchannels();
int depth = mat_dst.depth(); int depth = mat_dst.depth();
std::string kernelName = "merge_vector"; cv::String kernelName = "merge_vector";
int vector_lengths[4][7] = {{0, 0, 0, 0, 0, 0, 0}, int vector_lengths[4][7] = {{0, 0, 0, 0, 0, 0, 0},
{2, 2, 1, 1, 1, 1, 1}, {2, 2, 1, 1, 1, 1, 1},
@ -233,7 +233,7 @@ namespace cv
// int channels = mat_src.oclchannels(); // int channels = mat_src.oclchannels();
// int depth = mat_src.depth(); // int depth = mat_src.depth();
// std::string kernelName = "split_vector"; // cv::String kernelName = "split_vector";
// int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0}, // int indexes[4][7] = {{0, 0, 0, 0, 0, 0, 0},
// {8, 8, 8, 8, 4, 4, 2}, // {8, 8, 8, 8, 4, 4, 2},
@ -284,7 +284,7 @@ namespace cv
int channels = mat_src.oclchannels(); int channels = mat_src.oclchannels();
int depth = mat_src.depth(); int depth = mat_src.depth();
std::string kernelName = "split_vector"; cv::String kernelName = "split_vector";
int vector_lengths[4][7] = {{0, 0, 0, 0, 0, 0, 0}, int vector_lengths[4][7] = {{0, 0, 0, 0, 0, 0, 0},
{4, 4, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 1, 1, 1},

@ -74,7 +74,7 @@ static void prefilter_xsobel(const oclMat &input, oclMat &output, int prefilterC
{ {
Context *clCxt = input.clCxt; Context *clCxt = input.clCxt;
std::string kernelName = "prefilter_xsobel"; cv::String kernelName = "prefilter_xsobel";
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName); cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName);
size_t blockSize = 1; size_t blockSize = 1;
@ -118,7 +118,7 @@ static void stereo_bm(const oclMat &left, const oclMat &right, oclMat &disp,
Context *clCxt = left.clCxt; Context *clCxt = left.clCxt;
std::string kernelName = "stereoKernel"; cv::String kernelName = "stereoKernel";
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName); cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName);
disp.setTo(Scalar_<unsigned char>::all(0)); disp.setTo(Scalar_<unsigned char>::all(0));
@ -163,7 +163,7 @@ static void postfilter_textureness(oclMat &left, int winSize,
{ {
Context *clCxt = left.clCxt; Context *clCxt = left.clCxt;
std::string kernelName = "textureness_kernel"; cv::String kernelName = "textureness_kernel";
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName); cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName);
size_t blockSize = 1; size_t blockSize = 1;

@ -109,7 +109,7 @@ public:
float operator() (const cv::Mat& integrals, const cv::Size& model) const; float operator() (const cv::Mat& integrals, const cv::Size& model) const;
friend void write(cv::FileStorage& fs, const std::string&, const ChannelFeature& f); friend void write(cv::FileStorage& fs, const cv::String&, const ChannelFeature& f);
friend std::ostream& operator<<(std::ostream& out, const ChannelFeature& f); friend std::ostream& operator<<(std::ostream& out, const ChannelFeature& f);
private: private:
@ -117,7 +117,7 @@ private:
int channel; int channel;
}; };
void write(cv::FileStorage& fs, const std::string&, const ChannelFeature& f); void write(cv::FileStorage& fs, const cv::String&, const ChannelFeature& f);
std::ostream& operator<<(std::ostream& out, const ChannelFeature& m); std::ostream& operator<<(std::ostream& out, const ChannelFeature& m);
// ========================================================================== // // ========================================================================== //
@ -135,7 +135,7 @@ public:
CV_WRAP virtual int totalChannels() const = 0; CV_WRAP virtual int totalChannels() const = 0;
virtual cv::AlgorithmInfo* info() const = 0; virtual cv::AlgorithmInfo* info() const = 0;
CV_WRAP static cv::Ptr<ChannelFeatureBuilder> create(const std::string& featureType); CV_WRAP static cv::Ptr<ChannelFeatureBuilder> create(const cv::String& featureType);
}; };
// ========================================================================== // // ========================================================================== //
@ -211,7 +211,7 @@ public:
virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth) = 0; virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth) = 0;
virtual void setRejectThresholds(OutputArray thresholds) = 0; virtual void setRejectThresholds(OutputArray thresholds) = 0;
virtual void write( cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const = 0; virtual void write( cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const = 0;
virtual void write( CvFileStorage* fs, std::string name) const = 0; virtual void write( CvFileStorage* fs, cv::String name) const = 0;
}; };
CV_EXPORTS bool initModule_softcascade(void); CV_EXPORTS bool initModule_softcascade(void);

@ -190,7 +190,7 @@ struct ChannelStorage
enum {HOG_BINS = 6, HOG_LUV_BINS = 10}; enum {HOG_BINS = 6, HOG_LUV_BINS = 10};
ChannelStorage(const cv::Mat& colored, int shr, std::string featureTypeStr) : shrinkage(shr) ChannelStorage(const cv::Mat& colored, int shr, cv::String featureTypeStr) : shrinkage(shr)
{ {
model_height = cvRound(colored.rows / (float)shrinkage); model_height = cvRound(colored.rows / (float)shrinkage);
if (featureTypeStr == "ICF") featureTypeStr = "HOG6MagLuv"; if (featureTypeStr == "ICF") featureTypeStr = "HOG6MagLuv";
@ -240,7 +240,7 @@ struct cv::softcascade::Detector::Fields
typedef std::vector<SOctave>::iterator octIt_t; typedef std::vector<SOctave>::iterator octIt_t;
typedef std::vector<Detection> dvector; typedef std::vector<Detection> dvector;
std::string featureTypeStr; cv::String featureTypeStr;
void detectAt(const int dx, const int dy, const Level& level, const ChannelStorage& storage, dvector& detections) const void detectAt(const int dx, const int dy, const Level& level, const ChannelStorage& storage, dvector& detections) const
{ {
@ -364,14 +364,14 @@ struct cv::softcascade::Detector::Fields
static const char *const FEATURE_FORMAT = "featureFormat"; static const char *const FEATURE_FORMAT = "featureFormat";
// only Ada Boost supported // only Ada Boost supported
std::string stageTypeStr = (std::string)root[SC_STAGE_TYPE]; cv::String stageTypeStr = (cv::String)root[SC_STAGE_TYPE];
CV_Assert(stageTypeStr == SC_BOOST); CV_Assert(stageTypeStr == SC_BOOST);
std::string fformat = (std::string)root[FEATURE_FORMAT]; cv::String fformat = (cv::String)root[FEATURE_FORMAT];
bool useBoxes = (fformat == "BOX"); bool useBoxes = (fformat == "BOX");
// only HOG-like integral channel features supported // only HOG-like integral channel features supported
featureTypeStr = (std::string)root[SC_FEATURE_TYPE]; featureTypeStr = (cv::String)root[SC_FEATURE_TYPE];
CV_Assert(featureTypeStr == SC_ICF || featureTypeStr == SC_HOG6_MAG_LUV); CV_Assert(featureTypeStr == SC_ICF || featureTypeStr == SC_HOG6_MAG_LUV);
origObjWidth = (int)root[SC_ORIG_W]; origObjWidth = (int)root[SC_ORIG_W];

@ -136,17 +136,17 @@ struct cv::softcascade::SCascade::Fields
static const char *const SC_F_RECT = "rect"; static const char *const SC_F_RECT = "rect";
// only Ada Boost supported // only Ada Boost supported
std::string stageTypeStr = (std::string)root[SC_STAGE_TYPE]; cv::String stageTypeStr = (cv::String)root[SC_STAGE_TYPE];
CV_Assert(stageTypeStr == SC_BOOST); CV_Assert(stageTypeStr == SC_BOOST);
// only HOG-like integral channel features supported // only HOG-like integral channel features supported
std::string featureTypeStr = (std::string)root[SC_FEATURE_TYPE]; cv::String featureTypeStr = (cv::String)root[SC_FEATURE_TYPE];
CV_Assert(featureTypeStr == SC_ICF); CV_Assert(featureTypeStr == SC_ICF);
int origWidth = (int)root[SC_ORIG_W]; int origWidth = (int)root[SC_ORIG_W];
int origHeight = (int)root[SC_ORIG_H]; int origHeight = (int)root[SC_ORIG_H];
std::string fformat = (std::string)root[SC_FEATURE_FORMAT]; cv::String fformat = (cv::String)root[SC_FEATURE_FORMAT];
bool useBoxes = (fformat == "BOX"); bool useBoxes = (fformat == "BOX");
ushort shrinkage = cv::saturate_cast<ushort>((int)root[SC_SHRINKAGE]); ushort shrinkage = cv::saturate_cast<ushort>((int)root[SC_SHRINKAGE]);

@ -122,7 +122,7 @@ CV_INIT_ALGORITHM(HOG6MagLuv, "ChannelFeatureBuilder.HOG6MagLuv", );
ChannelFeatureBuilder::~ChannelFeatureBuilder() {} ChannelFeatureBuilder::~ChannelFeatureBuilder() {}
cv::Ptr<ChannelFeatureBuilder> ChannelFeatureBuilder::create(const std::string& featureType) cv::Ptr<ChannelFeatureBuilder> ChannelFeatureBuilder::create(const cv::String& featureType)
{ {
return Algorithm::create<ChannelFeatureBuilder>("ChannelFeatureBuilder." + featureType); return Algorithm::create<ChannelFeatureBuilder>("ChannelFeatureBuilder." + featureType);
} }
@ -158,7 +158,7 @@ float ChannelFeature::operator() (const cv::Mat& integrals, const cv::Size& mode
return (float)(a - b + c - d); return (float)(a - b + c - d);
} }
void cv::softcascade::write(cv::FileStorage& fs, const std::string&, const ChannelFeature& f) void cv::softcascade::write(cv::FileStorage& fs, const cv::String&, const ChannelFeature& f)
{ {
fs << "{" << "channel" << f.channel << "rect" << f.bb << "}"; fs << "{" << "channel" << f.channel << "rect" << f.bb << "}";
} }

@ -69,7 +69,7 @@ public:
virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth); virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth);
virtual void setRejectThresholds(OutputArray thresholds); virtual void setRejectThresholds(OutputArray thresholds);
virtual void write( cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const; virtual void write( cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const;
virtual void write( CvFileStorage* fs, std::string name) const; virtual void write( CvFileStorage* fs, cv::String name) const;
protected: protected:
virtual float predict( InputArray _sample, InputArray _votes, bool raw_mode, bool return_sum ) const; virtual float predict( InputArray _sample, InputArray _votes, bool raw_mode, bool return_sum ) const;
virtual bool train( const cv::Mat& trainData, const cv::Mat& responses, const cv::Mat& varIdx=cv::Mat(), virtual bool train( const cv::Mat& trainData, const cv::Mat& responses, const cv::Mat& varIdx=cv::Mat(),
@ -436,7 +436,7 @@ float BoostedSoftCascadeOctave::predict( const Mat& _sample, const cv::Range ran
return CvBoost::predict(&sample, 0, 0, range, false, true); return CvBoost::predict(&sample, 0, 0, range, false, true);
} }
void BoostedSoftCascadeOctave::write( CvFileStorage* fs, std::string _name) const void BoostedSoftCascadeOctave::write( CvFileStorage* fs, cv::String _name) const
{ {
CvBoost::write(fs, _name.c_str()); CvBoost::write(fs, _name.c_str());
} }

@ -53,7 +53,7 @@ namespace {
using namespace cv::softcascade; using namespace cv::softcascade;
typedef vector<string> svector; typedef vector<cv::String> svector;
class ScaledDataset : public Dataset class ScaledDataset : public Dataset
{ {
public: public:

@ -190,7 +190,7 @@ void CV_EXPORTS waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind);
// Auxiliary functions // Auxiliary functions
// Returns matches graph representation in DOT language // Returns matches graph representation in DOT language
std::string CV_EXPORTS matchesGraphAsString(std::vector<std::string> &pathes, std::vector<MatchesInfo> &pairwise_matches, cv::String CV_EXPORTS matchesGraphAsString(std::vector<cv::String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
float conf_threshold); float conf_threshold);
std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches, std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,

@ -56,7 +56,7 @@
#include <android/log.h> #include <android/log.h>
#define LOG_STITCHING_MSG(msg) \ #define LOG_STITCHING_MSG(msg) \
do { \ do { \
std::stringstream _os; \ cv::Stringstream _os; \
_os << msg; \ _os << msg; \
__android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \ __android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \
} while(0); } while(0);

@ -653,7 +653,7 @@ void waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
std::string matchesGraphAsString(std::vector<std::string> &pathes, std::vector<MatchesInfo> &pairwise_matches, cv::String matchesGraphAsString(std::vector<cv::String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
float conf_threshold) float conf_threshold)
{ {
std::stringstream str; std::stringstream str;
@ -685,18 +685,18 @@ std::string matchesGraphAsString(std::vector<std::string> &pathes, std::vector<M
std::pair<int,int> edge = *itr; std::pair<int,int> edge = *itr;
if (span_tree_edges.find(edge) != span_tree_edges.end()) if (span_tree_edges.find(edge) != span_tree_edges.end())
{ {
std::string name_src = pathes[edge.first]; cv::String name_src = pathes[edge.first];
size_t prefix_len = name_src.find_last_of("/\\"); size_t prefix_len = name_src.find_last_of("/\\");
if (prefix_len != std::string::npos) prefix_len++; else prefix_len = 0; if (prefix_len != cv::String::npos) prefix_len++; else prefix_len = 0;
name_src = name_src.substr(prefix_len, name_src.size() - prefix_len); name_src = name_src.substr(prefix_len, name_src.size() - prefix_len);
std::string name_dst = pathes[edge.second]; cv::String name_dst = pathes[edge.second];
prefix_len = name_dst.find_last_of("/\\"); prefix_len = name_dst.find_last_of("/\\");
if (prefix_len != std::string::npos) prefix_len++; else prefix_len = 0; if (prefix_len != cv::String::npos) prefix_len++; else prefix_len = 0;
name_dst = name_dst.substr(prefix_len, name_dst.size() - prefix_len); name_dst = name_dst.substr(prefix_len, name_dst.size() - prefix_len);
int pos = edge.first*num_images + edge.second; int pos = edge.first*num_images + edge.second;
str << "\"" << name_src << "\" -- \"" << name_dst << "\"" str << "\"" << name_src.c_str() << "\" -- \"" << name_dst.c_str() << "\""
<< "[label=\"Nm=" << pairwise_matches[pos].matches.size() << "[label=\"Nm=" << pairwise_matches[pos].matches.size()
<< ", Ni=" << pairwise_matches[pos].num_inliers << ", Ni=" << pairwise_matches[pos].num_inliers
<< ", C=" << pairwise_matches[pos].confidence << "\"];\n"; << ", C=" << pairwise_matches[pos].confidence << "\"];\n";
@ -707,16 +707,16 @@ std::string matchesGraphAsString(std::vector<std::string> &pathes, std::vector<M
{ {
if (comps.size[comps.findSetByElem((int)i)] == 1) if (comps.size[comps.findSetByElem((int)i)] == 1)
{ {
std::string name = pathes[i]; cv::String name = pathes[i];
size_t prefix_len = name.find_last_of("/\\"); size_t prefix_len = name.find_last_of("/\\");
if (prefix_len != std::string::npos) prefix_len++; else prefix_len = 0; if (prefix_len != cv::String::npos) prefix_len++; else prefix_len = 0;
name = name.substr(prefix_len, name.size() - prefix_len); name = name.substr(prefix_len, name.size() - prefix_len);
str << "\"" << name << "\";\n"; str << "\"" << name.c_str() << "\";\n";
} }
} }
str << "}"; str << "}";
return str.str(); return str.str().c_str();
} }
std::vector<int> leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches, std::vector<int> leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,

@ -62,8 +62,8 @@ namespace cv
CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty(); CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty();
CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const std::string& fileName); CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const cv::String& fileName);
CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_GPU(const std::string& fileName); CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_GPU(const cv::String& fileName);
CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0); CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0);

@ -129,15 +129,15 @@ namespace
class VideoFrameSource : public CaptureFrameSource class VideoFrameSource : public CaptureFrameSource
{ {
public: public:
VideoFrameSource(const std::string& fileName); VideoFrameSource(const cv::String& fileName);
void reset(); void reset();
private: private:
std::string fileName_; cv::String fileName_;
}; };
VideoFrameSource::VideoFrameSource(const std::string& fileName) : fileName_(fileName) VideoFrameSource::VideoFrameSource(const cv::String& fileName) : fileName_(fileName)
{ {
reset(); reset();
} }
@ -173,7 +173,7 @@ namespace
} }
} }
Ptr<FrameSource> cv::superres::createFrameSource_Video(const std::string& fileName) Ptr<FrameSource> cv::superres::createFrameSource_Video(const cv::String& fileName)
{ {
return new VideoFrameSource(fileName); return new VideoFrameSource(fileName);
} }
@ -204,18 +204,18 @@ namespace
class VideoFrameSource_GPU : public FrameSource class VideoFrameSource_GPU : public FrameSource
{ {
public: public:
VideoFrameSource_GPU(const std::string& fileName); VideoFrameSource_GPU(const cv::String& fileName);
void nextFrame(OutputArray frame); void nextFrame(OutputArray frame);
void reset(); void reset();
private: private:
std::string fileName_; cv::String fileName_;
VideoReader_GPU reader_; VideoReader_GPU reader_;
GpuMat frame_; GpuMat frame_;
}; };
VideoFrameSource_GPU::VideoFrameSource_GPU(const std::string& fileName) : fileName_(fileName) VideoFrameSource_GPU::VideoFrameSource_GPU(const cv::String& fileName) : fileName_(fileName)
{ {
reset(); reset();
} }
@ -246,7 +246,7 @@ namespace
} }
} }
Ptr<FrameSource> cv::superres::createFrameSource_Video_GPU(const std::string& fileName) Ptr<FrameSource> cv::superres::createFrameSource_Video_GPU(const cv::String& fileName)
{ {
return new VideoFrameSource(fileName); return new VideoFrameSource(fileName);
} }

@ -150,7 +150,7 @@ public:
virtual void read(const FileNode& fn) virtual void read(const FileNode& fn)
{ {
CV_Assert( (std::string)fn["name"] == name_ ); CV_Assert( (cv::String)fn["name"] == name_ );
history = (int)fn["history"]; history = (int)fn["history"];
nmixtures = (int)fn["nmixtures"]; nmixtures = (int)fn["nmixtures"];
backgroundRatio = (double)fn["backgroundRatio"]; backgroundRatio = (double)fn["backgroundRatio"];
@ -167,7 +167,7 @@ protected:
double varThreshold; double varThreshold;
double backgroundRatio; double backgroundRatio;
double noiseSigma; double noiseSigma;
std::string name_; cv::String name_;
}; };

@ -251,7 +251,7 @@ public:
virtual void read(const FileNode& fn) virtual void read(const FileNode& fn)
{ {
CV_Assert( (std::string)fn["name"] == name_ ); CV_Assert( (cv::String)fn["name"] == name_ );
history = (int)fn["history"]; history = (int)fn["history"];
nmixtures = (int)fn["nmixtures"]; nmixtures = (int)fn["nmixtures"];
backgroundRatio = (float)fn["backgroundRatio"]; backgroundRatio = (float)fn["backgroundRatio"];
@ -320,7 +320,7 @@ protected:
//Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow //Tau= 0.5 means that if pixel is more than 2 times darker then it is not shadow
//See: Prati,Mikic,Trivedi,Cucchiarra,"Detecting Moving Shadows...",IEEE PAMI,2003. //See: Prati,Mikic,Trivedi,Cucchiarra,"Detecting Moving Shadows...",IEEE PAMI,2003.
std::string name_; cv::String name_;
}; };
struct GaussBGStatModel2Params struct GaussBGStatModel2Params

@ -152,7 +152,7 @@ public:
virtual void read(const FileNode& fn) virtual void read(const FileNode& fn)
{ {
CV_Assert( (std::string)fn["name"] == name_ ); CV_Assert( (cv::String)fn["name"] == name_ );
maxFeatures = (int)fn["maxFeatures"]; maxFeatures = (int)fn["maxFeatures"];
learningRate = (double)fn["defaultLearningRate"]; learningRate = (double)fn["defaultLearningRate"];
numInitializationFrames = (int)fn["numFrames"]; numInitializationFrames = (int)fn["numFrames"];
@ -189,7 +189,7 @@ private:
Size frameSize_; Size frameSize_;
int frameNum_; int frameNum_;
std::string name_; cv::String name_;
Mat_<int> nfeatures_; Mat_<int> nfeatures_;
Mat_<unsigned int> colors_; Mat_<unsigned int> colors_;

@ -70,7 +70,7 @@ public:
class CV_EXPORTS VideoFileSource : public IFrameSource class CV_EXPORTS VideoFileSource : public IFrameSource
{ {
public: public:
VideoFileSource(const std::string &path, bool volatileFrame = false); VideoFileSource(const cv::String &path, bool volatileFrame = false);
virtual void reset(); virtual void reset();
virtual Mat nextFrame(); virtual Mat nextFrame();

@ -146,7 +146,7 @@ private:
class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase
{ {
public: public:
FromFileMotionReader(const std::string &path); FromFileMotionReader(const cv::String &path);
virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0); virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
@ -157,7 +157,7 @@ private:
class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase
{ {
public: public:
ToFileMotionWriter(const std::string &path, Ptr<ImageMotionEstimatorBase> estimator); ToFileMotionWriter(const cv::String &path, Ptr<ImageMotionEstimatorBase> estimator);
virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); } virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); } virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }

@ -59,7 +59,7 @@ namespace {
class VideoFileSourceImpl : public IFrameSource class VideoFileSourceImpl : public IFrameSource
{ {
public: public:
VideoFileSourceImpl(const std::string &path, bool volatileFrame) VideoFileSourceImpl(const cv::String &path, bool volatileFrame)
: path_(path), volatileFrame_(volatileFrame) { reset(); } : path_(path), volatileFrame_(volatileFrame) { reset(); }
virtual void reset() virtual void reset()
@ -68,7 +68,7 @@ public:
vc.release(); vc.release();
vc.open(path_); vc.open(path_);
if (!vc.isOpened()) if (!vc.isOpened())
throw std::runtime_error("can't open file: " + path_); CV_Error(0, "can't open file: " + path_);
#else #else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support"); CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support");
#endif #endif
@ -96,7 +96,7 @@ public:
#endif #endif
private: private:
std::string path_; cv::String path_;
bool volatileFrame_; bool volatileFrame_;
#ifdef HAVE_OPENCV_HIGHGUI #ifdef HAVE_OPENCV_HIGHGUI
VideoCapture vc; VideoCapture vc;
@ -105,7 +105,7 @@ private:
}//namespace }//namespace
VideoFileSource::VideoFileSource(const std::string &path, bool volatileFrame) VideoFileSource::VideoFileSource(const cv::String &path, bool volatileFrame)
: impl(new VideoFileSourceImpl(path, volatileFrame)) {} : impl(new VideoFileSourceImpl(path, volatileFrame)) {}
void VideoFileSource::reset() { impl->reset(); } void VideoFileSource::reset() { impl->reset(); }

@ -621,7 +621,7 @@ Mat MotionEstimatorL1::estimate(InputArray points0, InputArray points1, bool *ok
} }
FromFileMotionReader::FromFileMotionReader(const std::string &path) FromFileMotionReader::FromFileMotionReader(const cv::String &path)
: ImageMotionEstimatorBase(MM_UNKNOWN) : ImageMotionEstimatorBase(MM_UNKNOWN)
{ {
file_.open(path.c_str()); file_.open(path.c_str());
@ -641,7 +641,7 @@ Mat FromFileMotionReader::estimate(const Mat &/*frame0*/, const Mat &/*frame1*/,
} }
ToFileMotionWriter::ToFileMotionWriter(const std::string &path, Ptr<ImageMotionEstimatorBase> estimator) ToFileMotionWriter::ToFileMotionWriter(const cv::String &path, Ptr<ImageMotionEstimatorBase> estimator)
: ImageMotionEstimatorBase(estimator->motionModel()), motionEstimator_(estimator) : ImageMotionEstimatorBase(estimator->motionModel()), motionEstimator_(estimator)
{ {
file_.open(path.c_str()); file_.open(path.c_str());

Loading…
Cancel
Save