ts->update_context( this, idx, true );
/* read the image */
- string img_file = board_list[idx * 2];
+ String img_file = board_list[idx * 2];
Mat gray = imread( folder + img_file, 0);
if( gray.empty() )
return;
}
- string _filename = folder + (string)board_list[idx * 2 + 1];
+ String _filename = folder + (String)board_list[idx * 2 + 1];
bool doesContatinChessboard;
Mat expected;
{
assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 )
{
- string _name = fn[i];
+ String _name = fn[i];
DatasetParams params;
- string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
- string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
+ String sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
+ String uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
datasetsParams[_name] = params;
}
return cvtest::TS::OK;
assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=4 )
{
- string caseName = fn[i], datasetName = fn[i+1];
+ String caseName = fn[i], datasetName = fn[i+1];
RunParams params;
- string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
- string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
+ String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
+ String winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
caseNames.push_back( caseName );
caseDatasets.push_back( datasetName );
caseRunParams.push_back( params );
assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=5 )
{
- string caseName = fn[i], datasetName = fn[i+1];
+ String caseName = fn[i], datasetName = fn[i+1];
RunParams params;
- string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
- string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
- string fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true;
+ String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
+ String winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
+ String fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true;
caseNames.push_back( caseName );
caseDatasets.push_back( datasetName );
caseRunParams.push_back( params );
// Create a FaceRecognizer:
Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
// And here's how to get its name:
- std::string name = model->name();
+ cv::String name = model->name();
FaceRecognizer::train
**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
{
Size outputSize ();
// setup methods with specific parameters specification of global xml config file loading/write
- void setup (std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
+ void setup (cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
void setup (RetinaParameters newParameters);
struct Retina::RetinaParameters getParameters ();
- const std::string printSetup ();
- virtual void write (std::string fs) const;
+ const cv::String printSetup ();
+ virtual void write (cv::String fs) const;
virtual void write (FileStorage &fs) const;
void setupOPLandIPLParvoChannel (const bool colorMode=true, const bool normaliseOutput=true, const float photoreceptorsLocalAdaptationSensitivity=0.7, const float photoreceptorsTemporalConstant=0.5, const float photoreceptorsSpatialConstant=0.53, const float horizontalCellsGain=0, const float HcellsTemporalConstant=1, const float HcellsSpatialConstant=7, const float ganglionCellsSensitivity=0.7);
void setupIPLMagnoChannel (const bool normaliseOutput=true, const float parasolCells_beta=0, const float parasolCells_tau=0, const float parasolCells_k=7, const float amacrinCellsTemporalCutFrequency=1.2, const float V0CompressionParameter=0.95, const float localAdaptintegration_tau=0, const float localAdaptintegration_k=7);
Retina::printSetup
++++++++++++++++++
-.. ocv:function:: const std::string Retina::printSetup()
+.. ocv:function:: const cv::String Retina::printSetup()
Outputs a string showing the used parameters 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(RetinaParameters newParameters)
Retina::write
+++++++++++++
-.. ocv:function:: void Retina::write( std::string fs ) const
+.. ocv:function:: void Retina::write( cv::String fs ) const
.. ocv:function:: void Retina::write( FileStorage& fs ) const
Write xml/yml formated parameters information
void computeNormals(float normalRadius, int minNeighbors = 20);
void computeNormals(const std::vector<int>& subset, float normalRadius, int minNeighbors = 20);
- void writeAsVrml(const std::string& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const;
+ void writeAsVrml(const cv::String& file, const std::vector<Scalar>& colors = std::vector<Scalar>()) const;
std::vector<Point3f> vtx;
std::vector<Point3f> normals;
class CV_EXPORTS Directory
{
public:
- static std::vector<std::string> GetListFiles ( const std::string& path, const std::string & exten = "*", bool addPath = true );
- static std::vector<std::string> GetListFilesR ( const std::string& path, const std::string & exten = "*", bool addPath = true );
- static std::vector<std::string> GetListFolders( const std::string& path, const std::string & exten = "*", bool addPath = true );
+ static std::vector<cv::String> GetListFiles ( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
+ static std::vector<cv::String> GetListFilesR ( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
+ static std::vector<cv::String> GetListFolders( const cv::String& path, const cv::String & exten = "*", bool addPath = true );
};
/*
}
// Serializes this object to a given filename.
- void save(const std::string& filename) const;
+ void save(const cv::String& filename) const;
// Deserializes this object from a given filename.
- void load(const std::string& filename);
+ void load(const cv::String& filename);
// Serializes this object to a given cv::FileStorage.
void save(FileStorage& fs) const;
CV_WRAP virtual void predict(InputArray src, CV_OUT int &label, CV_OUT double &confidence) const = 0;
// Serializes this object to a given filename.
- CV_WRAP virtual void save(const std::string& filename) const;
+ CV_WRAP virtual void save(const cv::String& filename) const;
// Deserializes this object from a given filename.
- CV_WRAP virtual void load(const std::string& filename);
+ CV_WRAP virtual void load(const cv::String& filename);
// Serializes this object to a given cv::FileStorage.
virtual void save(FileStorage& fs) const = 0;
* @param retinaParameterFile : the parameters filename
* @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error
*/
- void setup(std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
+ void setup(cv::String retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
/**
* parameters setup display method
* @return a string which contains formatted parameters information
*/
- const std::string printSetup();
+ const cv::String printSetup();
/**
* write xml/yml formated parameters information
* @rparam fs : the filename of the xml file that will be open and writen with formatted parameters information
*/
- virtual void write( std::string fs ) const;
+ virtual void write( cv::String fs ) const;
/**
// Writes the a list of given items to a cv::FileStorage.
template<typename _Tp>
-inline void writeFileNodeList(FileStorage& fs, const std::string& name,
+inline void writeFileNodeList(FileStorage& fs, const cv::String& name,
const std::vector<_Tp>& items) {
// typedefs
typedef typename std::vector<_Tp>::const_iterator constVecIterator;
static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double beta=0) {
// make sure the input data is a vector of matrices or vector of vector
if(src.kind() != _InputArray::STD_VECTOR_MAT && src.kind() != _InputArray::STD_VECTOR_VECTOR) {
- std::string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
+ cv::String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message);
}
// number of samples
for(unsigned int i = 0; i < n; i++) {
// make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total() != d) {
- std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
+ cv::String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, d, src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message);
}
// get a hold of the current row
return;
}
- std::string error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
+ cv::String error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
CV_Error(CV_StsNotImplemented, error_msg);
}
-void FaceRecognizer::save(const std::string& filename) const {
+void FaceRecognizer::save(const cv::String& filename) const {
FileStorage fs(filename, FileStorage::WRITE);
if (!fs.isOpened())
CV_Error(CV_StsError, "File can't be opened for writing!");
fs.release();
}
-void FaceRecognizer::load(const std::string& filename) {
+void FaceRecognizer::load(const cv::String& filename) {
FileStorage fs(filename, FileStorage::READ);
if (!fs.isOpened())
CV_Error(CV_StsError, "File can't be opened for writing!");
//------------------------------------------------------------------------------
void Eigenfaces::train(InputArrayOfArrays _src, InputArray _local_labels) {
if(_src.total() == 0) {
- std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
+ cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsBadArg, error_message);
} else if(_local_labels.getMat().type() != CV_32SC1) {
- std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
+ cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _local_labels.type());
CV_Error(CV_StsBadArg, error_message);
}
// make sure data has correct size
if(_src.total() > 1) {
for(int i = 1; i < static_cast<int>(_src.total()); i++) {
if(_src.getMat(i-1).total() != _src.getMat(i).total()) {
- std::string error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
+ cv::String error_message = format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", _src.getMat(i-1).total(), _src.getMat(i).total());
CV_Error(CV_StsUnsupportedFormat, error_message);
}
}
int n = data.rows;
// assert there are as much samples as labels
if(static_cast<int>(labels.total()) != n) {
- std::string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
+ cv::String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", n, labels.total());
CV_Error(CV_StsBadArg, error_message);
}
// clear existing model data
// make sure the user is passing correct data
if(_projections.empty()) {
// throw error if no data (or simply return -1?)
- std::string error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
+ cv::String error_message = "This Eigenfaces model is not computed yet. Did you call Eigenfaces::train?";
CV_Error(CV_StsError, error_message);
} else if(_eigenvectors.rows != static_cast<int>(src.total())) {
// check data alignment just for clearer exception messages
- std::string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
+ cv::String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
CV_Error(CV_StsBadArg, error_message);
}
// project into PCA subspace
//------------------------------------------------------------------------------
void Fisherfaces::train(InputArrayOfArrays src, InputArray _lbls) {
if(src.total() == 0) {
- std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
+ cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsBadArg, error_message);
} else if(_lbls.getMat().type() != CV_32SC1) {
- std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
+ cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _lbls.type());
CV_Error(CV_StsBadArg, error_message);
}
// make sure data has correct size
if(src.total() > 1) {
for(int i = 1; i < static_cast<int>(src.total()); i++) {
if(src.getMat(i-1).total() != src.getMat(i).total()) {
- std::string error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
+ cv::String error_message = format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.", src.getMat(i-1).total(), src.getMat(i).total());
CV_Error(CV_StsUnsupportedFormat, error_message);
}
}
int N = data.rows;
// make sure labels are passed in correct shape
if(labels.total() != (size_t) N) {
- std::string error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
+ cv::String error_message = format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.", N, labels.total());
CV_Error(CV_StsBadArg, error_message);
} else if(labels.rows != 1 && labels.cols != 1) {
- std::string error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
+ cv::String error_message = format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.", labels.rows, labels.cols);
CV_Error(CV_StsBadArg, error_message);
}
// clear existing model data
// check data alignment just for clearer exception messages
if(_projections.empty()) {
// throw error if no data (or simply return -1?)
- std::string error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
+ cv::String error_message = "This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
CV_Error(CV_StsBadArg, error_message);
} else if(src.total() != (size_t) _eigenvectors.rows) {
- std::string error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
+ cv::String error_message = format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.", _eigenvectors.rows, src.total());
CV_Error(CV_StsBadArg, error_message);
}
// project into LDA subspace
case CV_32FC1: elbp_<float>(src,dst, radius, neighbors); break;
case CV_64FC1: elbp_<double>(src,dst, radius, neighbors); break;
default:
- std::string error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
+ cv::String error_msg = format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!", type);
CV_Error(CV_StsNotImplemented, error_msg);
break;
}
void LBPH::train(InputArrayOfArrays _in_src, InputArray _in_labels, bool preserveData) {
if(_in_src.kind() != _InputArray::STD_VECTOR_MAT && _in_src.kind() != _InputArray::STD_VECTOR_VECTOR) {
- std::string error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
+ cv::String error_message = "The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message);
}
if(_in_src.total() == 0) {
- std::string error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
+ cv::String error_message = format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsUnsupportedFormat, error_message);
} else if(_in_labels.getMat().type() != CV_32SC1) {
- std::string error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
+ cv::String error_message = format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.", CV_32SC1, _in_labels.type());
CV_Error(CV_StsUnsupportedFormat, error_message);
}
// get the vector of matrices
Mat labels = _in_labels.getMat();
// check if data is well- aligned
if(labels.total() != src.size()) {
- std::string error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
+ cv::String error_message = format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.", src.size(), _labels.total());
CV_Error(CV_StsBadArg, error_message);
}
// if this model should be trained without preserving old data, delete old model data
void LBPH::predict(InputArray _src, int &minClass, double &minDist) const {
if(_histograms.empty()) {
// throw error if no data (or simply return -1?)
- std::string error_message = "This LBPH model is not computed yet. Did you call the train method?";
+ cv::String error_message = "This LBPH model is not computed yet. Did you call the train method?";
CV_Error(CV_StsBadArg, error_message);
}
Mat src = _src.getMat();
namespace cv
{
- std::vector<std::string> Directory::GetListFiles( const std::string& path, const std::string & exten, bool addPath )
+ std::vector<cv::String> Directory::GetListFiles( const cv::String& path, const cv::String & exten, bool addPath )
{
- std::vector<std::string> list;
+ std::vector<cv::String> list;
list.clear();
- std::string path_f = path + "/" + exten;
+ cv::String path_f = path + "/" + exten;
#ifdef WIN32
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
if (dirp->d_type == DT_REG)
{
if (exten.compare("*") == 0)
- list.push_back(static_cast<std::string>(dirp->d_name));
+ list.push_back(static_cast<cv::String>(dirp->d_name));
else
- if (std::string(dirp->d_name).find(exten) != std::string::npos)
- list.push_back(static_cast<std::string>(dirp->d_name));
+ if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
+ list.push_back(static_cast<cv::String>(dirp->d_name));
}
}
closedir(dp);
return list;
}
- std::vector<std::string> Directory::GetListFolders( const std::string& path, const std::string & exten, bool addPath )
+ std::vector<cv::String> Directory::GetListFolders( const cv::String& path, const cv::String & exten, bool addPath )
{
- std::vector<std::string> list;
- std::string path_f = path + "/" + exten;
+ std::vector<cv::String> list;
+ cv::String path_f = path + "/" + exten;
list.clear();
#ifdef WIN32
WIN32_FIND_DATA FindFileData;
strcmp(dirp->d_name, "..") != 0 )
{
if (exten.compare("*") == 0)
- list.push_back(static_cast<std::string>(dirp->d_name));
+ list.push_back(static_cast<cv::String>(dirp->d_name));
else
- if (std::string(dirp->d_name).find(exten) != std::string::npos)
- list.push_back(static_cast<std::string>(dirp->d_name));
+ if (cv::String(dirp->d_name).find(exten) != cv::String::npos)
+ list.push_back(static_cast<cv::String>(dirp->d_name));
}
}
closedir(dp);
return list;
}
- std::vector<std::string> Directory::GetListFilesR ( const std::string& path, const std::string & exten, bool addPath )
+ std::vector<cv::String> Directory::GetListFilesR ( const cv::String& path, const cv::String & exten, bool addPath )
{
- std::vector<std::string> list = Directory::GetListFiles(path, exten, addPath);
+ std::vector<cv::String> list = Directory::GetListFiles(path, exten, addPath);
- std::vector<std::string> dirs = Directory::GetListFolders(path, exten, addPath);
+ std::vector<cv::String> dirs = Directory::GetListFolders(path, exten, addPath);
- std::vector<std::string>::const_iterator it;
+ std::vector<cv::String>::const_iterator it;
for (it = dirs.begin(); it != dirs.end(); ++it)
{
- std::vector<std::string> cl = Directory::GetListFiles(*it, exten, addPath);
+ std::vector<cv::String> cl = Directory::GetListFiles(*it, exten, addPath);
list.insert(list.end(), cl.begin(), cl.end());
}
{
Mat src = _src.getMat();
if (src.rows != 1 && src.cols != 1) {
- std::string error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
+ cv::String error_message = "Wrong shape of input matrix! Expected a matrix with one row or column.";
CV_Error(CV_StsBadArg, error_message);
}
int flags = CV_SORT_EVERY_ROW+(ascending ? CV_SORT_ASCENDING : CV_SORT_DESCENDING);
static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double beta=0) {
// make sure the input data is a vector of matrices or vector of vector
if(src.kind() != _InputArray::STD_VECTOR_MAT && src.kind() != _InputArray::STD_VECTOR_VECTOR) {
- std::string error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
+ cv::String error_message = "The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg, error_message);
}
// number of samples
for(int i = 0; i < (int)n; i++) {
// make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total() != d) {
- std::string error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
+ cv::String error_message = format("Wrong number of elements in matrix #%d! Expected %d was %d.", i, (int)d, (int)src.getMat(i).total());
CV_Error(CV_StsBadArg, error_message);
}
// get a hold of the current row
int d = src.cols;
// make sure the data has the correct shape
if(W.rows != d) {
- std::string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
+ cv::String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
CV_Error(CV_StsBadArg, error_message);
}
// make sure mean is correct if not empty
if(!mean.empty() && (mean.total() != (size_t) d)) {
- std::string error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
+ cv::String error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
CV_Error(CV_StsBadArg, error_message);
}
// create temporary matrices
int d = src.cols;
// make sure the data has the correct shape
if(W.cols != d) {
- std::string error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
+ cv::String error_message = format("Wrong shapes for given matrices. Was size(src) = (%d,%d), size(W) = (%d,%d).", src.rows, src.cols, W.rows, W.cols);
CV_Error(CV_StsBadArg, error_message);
}
// make sure mean is correct if not empty
if(!mean.empty() && (mean.total() != (size_t) W.rows)) {
- std::string error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
+ cv::String error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
CV_Error(CV_StsBadArg, error_message);
}
// initalize temporary matrices
//------------------------------------------------------------------------------
// Linear Discriminant Analysis implementation
//------------------------------------------------------------------------------
-void LDA::save(const std::string& filename) const {
+void LDA::save(const cv::String& filename) const {
FileStorage fs(filename, FileStorage::WRITE);
if (!fs.isOpened()) {
CV_Error(CV_StsError, "File can't be opened for writing!");
}
// Deserializes this object from a given filename.
-void LDA::load(const std::string& filename) {
+void LDA::load(const cv::String& filename) {
FileStorage fs(filename, FileStorage::READ);
if (!fs.isOpened())
CV_Error(CV_StsError, "File can't be opened for writing!");
// we can't do a LDA on one class, what do you
// want to separate from each other then?
if(C == 1) {
- std::string error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
+ cv::String error_message = "At least two classes are needed to perform a LDA. Reason: Only one class was given!";
CV_Error(CV_StsBadArg, error_message);
}
// throw error if less labels, than samples
if (labels.size() != static_cast<size_t>(N)) {
- std::string error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
+ cv::String error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
CV_Error(CV_StsBadArg, error_message);
}
// warn if within-classes scatter matrix becomes singular
lda(_src.getMat(), _lbls);
break;
default:
- std::string error_message= format("InputArray Datatype %d is not supported.", _src.kind());
+ cv::String error_message= format("InputArray Datatype %d is not supported.", _src.kind());
CV_Error(CV_StsBadArg, error_message);
break;
}
*/
#include "precomp.hpp"
#include "retinafilter.hpp"
-#include <iostream>
+#include <cstdio>
namespace cv
{
struct Retina::RetinaParameters Retina::getParameters(){return _retinaParameters;}
-void Retina::setup(std::string retinaParameterFile, const bool applyDefaultSetupOnFailure)
+void Retina::setup(cv::String retinaParameterFile, const bool applyDefaultSetupOnFailure)
{
try
{
// opening retinaParameterFile in read mode
cv::FileStorage fs(retinaParameterFile, cv::FileStorage::READ);
setup(fs, applyDefaultSetupOnFailure);
- }catch(Exception &e)
- {
- std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
- if (applyDefaultSetupOnFailure)
- {
- std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
- setupOPLandIPLParvoChannel();
- setupIPLMagnoChannel();
}
+ catch(Exception &e)
+ {
+ printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
+ if (applyDefaultSetupOnFailure)
+ {
+ printf("Retina::setup: resetting retina with default parameters\n");
+ setupOPLandIPLParvoChannel();
+ setupIPLMagnoChannel();
+ }
else
{
- std::cout<<"=> keeping current parameters"<<std::endl;
+ printf("=> keeping current parameters\n");
}
}
}
// read parameters file if it exists or apply default setup if asked for
if (!fs.isOpened())
{
- std::cout<<"Retina::setup: provided parameters file could not be open... skeeping configuration"<<std::endl;
+ printf("Retina::setup: provided parameters file could not be open... skeeping configuration\n");
return;
// implicit else case : retinaParameterFile could be open (it exists at least)
}
}catch(Exception &e)
{
- std::cout<<"Retina::setup: resetting retina with default parameters"<<std::endl;
+ printf("Retina::setup: resetting retina with default parameters\n");
if (applyDefaultSetupOnFailure)
{
setupOPLandIPLParvoChannel();
setupIPLMagnoChannel();
}
- std::cout<<"Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>"<<e.what()<<std::endl;
- std::cout<<"=> keeping current parameters"<<std::endl;
+ printf("Retina::setup: wrong/unappropriate xml parameter file : error report :`n=>%s\n", e.what());
+ printf("=> keeping current parameters\n");
}
// report current configuration
- std::cout<<printSetup()<<std::endl;
+ printf("%s\n", printSetup().c_str());
}
void Retina::setup(cv::Retina::RetinaParameters newConfiguration)
}
-const std::string Retina::printSetup()
+const cv::String Retina::printSetup()
{
std::stringstream outmessage;
<< "\n==> localAdaptintegration_tau : " << _retinaParameters.IplMagno.localAdaptintegration_tau
<< "\n==> localAdaptintegration_k : " << _retinaParameters.IplMagno.localAdaptintegration_k
<<"}";
- return outmessage.str();
+ return outmessage.str().c_str();
}
-void Retina::write( std::string fs ) const
+void Retina::write( cv::String fs ) const
{
FileStorage parametersSaveFile(fs, cv::FileStorage::WRITE );
write(parametersSaveFile);
_retinaFilter->clearAllBuffers();
// report current configuration
- std::cout<<printSetup()<<std::endl;
+ printf("%s\n", printSetup().c_str());
}
void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, const bool colorMode, cv::Mat &outBuffer)
::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());
Constructors.
.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU()
-.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR)
-.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR)
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR)
+.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR)
.. ocv:function:: gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& 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)
--------------------------
Initializes or reinitializes video writer.
-.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR)
-.. ocv:function:: void gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR)
+.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR)
+.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR)
.. ocv:function:: void gpu::VideoWriter_GPU::open(const cv::Ptr<EncoderCallBack>& 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)
int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS
EncoderParams();
- explicit EncoderParams(const std::string& configFile);
+ explicit EncoderParams(const cv::String& configFile);
- void load(const std::string& configFile);
- void save(const std::string& configFile) const;
+ void load(const cv::String& configFile);
+ void save(const cv::String& configFile) const;
};
Constructors.
.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams()
-.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string& configFile)
+.. ocv:function:: gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile)
:param configFile: Config file name.
-----------------------------------------
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.
-----------------------------------------
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.
Constructors.
.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU()
-.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const std::string& filename)
+.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::String& filename)
.. ocv:function:: gpu::VideoReader_GPU::VideoReader_GPU(const cv::Ptr<VideoSource>& source)
:param filename: Name of the input video file.
--------------------------
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)
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.
{
public:
CascadeClassifier_GPU();
- CascadeClassifier_GPU(const std::string& filename);
+ CascadeClassifier_GPU(const cv::String& filename);
~CascadeClassifier_GPU();
bool empty() const;
- bool load(const std::string& filename);
+ bool load(const cv::String& filename);
void release();
/* returns number of detected objects */
};
VideoWriter_GPU();
- VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
- VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
+ VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
+ VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
VideoWriter_GPU(const cv::Ptr<EncoderCallBack>& 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();
// all methods throws cv::Exception if error occurs
- void open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
- void open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
+ void open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format = SF_BGR);
+ void open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format = SF_BGR);
void open(const cv::Ptr<EncoderCallBack>& 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);
int DisableSPSPPS; // NVVE_DISABLE_SPS_PPS
EncoderParams();
- explicit EncoderParams(const std::string& configFile);
+ explicit EncoderParams(const cv::String& configFile);
- void load(const std::string& configFile);
- void save(const std::string& configFile) const;
+ void load(const cv::String& configFile);
+ void save(const cv::String& configFile) const;
};
EncoderParams getParams() const;
class VideoSource;
VideoReader_GPU();
- explicit VideoReader_GPU(const std::string& filename);
+ explicit VideoReader_GPU(const cv::String& filename);
explicit VideoReader_GPU(const cv::Ptr<VideoSource>& source);
~VideoReader_GPU();
- void open(const std::string& filename);
+ void open(const cv::String& filename);
void open(const cv::Ptr<VideoSource>& source);
bool isOpened() const;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU() { throw_nogpu(); }
-cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const std::string&) { throw_nogpu(); }
+cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::String&) { throw_nogpu(); }
cv::gpu::CascadeClassifier_GPU::~CascadeClassifier_GPU() { throw_nogpu(); }
bool cv::gpu::CascadeClassifier_GPU::empty() const { throw_nogpu(); return true; }
-bool cv::gpu::CascadeClassifier_GPU::load(const std::string&) { throw_nogpu(); return true; }
+bool cv::gpu::CascadeClassifier_GPU::load(const cv::String&) { throw_nogpu(); return true; }
Size cv::gpu::CascadeClassifier_GPU::getClassifierSize() const { throw_nogpu(); return Size();}
void cv::gpu::CascadeClassifier_GPU::release() { throw_nogpu(); }
int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat&, GpuMat&, double, int, Size) {throw_nogpu(); return -1;}
bool findLargestObject, bool visualizeInPlace, cv::Size ncvMinSize, cv::Size maxObjectSize) = 0;
virtual cv::Size getClassifierCvSize() const = 0;
- virtual bool read(const std::string& classifierAsXml) = 0;
+ virtual bool read(const cv::String& classifierAsXml) = 0;
};
struct cv::gpu::CascadeClassifier_GPU::HaarCascade : cv::gpu::CascadeClassifier_GPU::CascadeClassifierImpl
ncvSetDebugOutputHandler(NCVDebugOutputHandler);
}
- bool read(const std::string& filename)
+ bool read(const cv::String& filename)
{
ncvSafeCall( load(filename) );
return true;
cv::Size getClassifierCvSize() const { return cv::Size(haar.ClassifierSize.width, haar.ClassifierSize.height); }
private:
- static void NCVDebugOutputHandler(const std::string &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
+ static void NCVDebugOutputHandler(const cv::String &msg) { CV_Error(CV_GpuApiCallError, msg.c_str()); }
- NCVStatus load(const std::string& classifierFile)
+ NCVStatus load(const cv::String& classifierFile)
{
int devId = cv::gpu::getDevice();
ncvAssertCUDAReturn(cudaGetDeviceProperties(&devProp, devId), NCV_CUDA_ERROR);
virtual cv::Size getClassifierCvSize() const { return NxM; }
- bool read(const std::string& classifierAsXml)
+ bool read(const cv::String& classifierAsXml)
{
FileStorage fs(classifierAsXml, FileStorage::READ);
return fs.isOpened() ? read(fs.getFirstTopLevelNode()) : false;
const char *GPU_CC_FEATURES = "features";
const char *GPU_CC_RECT = "rect";
- std::string stageTypeStr = (std::string)root[GPU_CC_STAGE_TYPE];
+ cv::String stageTypeStr = (cv::String)root[GPU_CC_STAGE_TYPE];
CV_Assert(stageTypeStr == GPU_CC_BOOST);
- std::string featureTypeStr = (std::string)root[GPU_CC_FEATURE_TYPE];
+ cv::String featureTypeStr = (cv::String)root[GPU_CC_FEATURE_TYPE];
CV_Assert(featureTypeStr == GPU_CC_LBP);
NxM.width = (int)root[GPU_CC_WIDTH];
cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU()
: findLargestObject(false), visualizeInPlace(false), impl(0) {}
-cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const std::string& filename)
+cv::gpu::CascadeClassifier_GPU::CascadeClassifier_GPU(const cv::String& filename)
: findLargestObject(false), visualizeInPlace(false), impl(0) { load(filename); }
cv::gpu::CascadeClassifier_GPU::~CascadeClassifier_GPU() { release(); }
return impl->process(image, objectsBuf, (float)scaleFactor, minNeighbors, findLargestObject, visualizeInPlace, minSize, maxObjectSize);
}
-bool cv::gpu::CascadeClassifier_GPU::load(const std::string& filename)
+bool cv::gpu::CascadeClassifier_GPU::load(const cv::String& filename)
{
release();
- std::string fext = filename.substr(filename.find_last_of(".") + 1);
+ cv::String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
if (fext == "nvbin")
}
const char *GPU_CC_LBP = "LBP";
- std::string featureTypeStr = (std::string)fs.getFirstTopLevelNode()["featureType"];
+ cv::String featureTypeStr = (cv::String)fs.getFirstTopLevelNode()["featureType"];
if (featureTypeStr == GPU_CC_LBP)
impl = new LbpCascade();
else
hypotheses.resize(rects.size());
}
-NCVStatus loadFromXML(const std::string &filename,
+NCVStatus loadFromXML(const cv::String &filename,
HaarClassifierCascadeDescriptor &haar,
std::vector<HaarStage64> &haarStages,
std::vector<HaarClassifierNode128> &haarClassifierNodes,
struct ErrorEntry
{
int code;
- std::string str;
+ cv::String str;
};
class ErrorEntryComparer
int code_;
};
- std::string getErrorString(int code, const ErrorEntry* errors, size_t n)
+ cv::String getErrorString(int code, const ErrorEntry* errors, size_t n)
{
size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors;
- const std::string& msg = (idx != n) ? errors[idx].str : std::string("Unknown error code");
+ const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code");
std::ostringstream ostr;
ostr << msg << " [Code = " << code << "]";
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);
}
namespace cv { namespace gpu {
namespace detail
{
- std::string cuGetErrString(CUresult res);
+ cv::String cuGetErrString(CUresult res);
inline void cuSafeCall_impl(CUresult res, const char* file, int line)
{
#if defined(HAVE_CUDA) && defined(HAVE_NVCUVID)
-cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const std::string& fname)
+cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const cv::String& fname)
{
CUVIDSOURCEPARAMS params;
std::memset(¶ms, 0, sizeof(CUVIDSOURCEPARAMS));
class CuvidVideoSource : public VideoReader_GPU::VideoSource
{
public:
- explicit CuvidVideoSource(const std::string& fname);
+ explicit CuvidVideoSource(const cv::String& fname);
~CuvidVideoSource() { cuvidDestroyVideoSource(videoSource_); }
VideoReader_GPU::FormatInfo format() const;
struct ErrorEntry
{
int code;
- std::string str;
+ cv::String str;
};
struct ErrorEntryComparer
bool operator()(const ErrorEntry& e) const { return e.code == code; }
};
- std::string getErrorString(int code, const ErrorEntry* errors, size_t n)
+ cv::String getErrorString(int code, const ErrorEntry* errors, size_t n)
{
size_t idx = std::find_if(errors, errors + n, ErrorEntryComparer(code)) - errors;
- const std::string& msg = (idx != n) ? errors[idx].str : std::string("Unknown error code");
+ const cv::String& msg = (idx != n) ? errors[idx].str : cv::String("Unknown error code");
std::ostringstream ostr;
ostr << msg << " [Code = " << code << "]";
{
void nppError(int code, const char *file, const int line, const char *func)
{
- std::string msg = getErrorString(code, npp_errors, npp_error_num);
+ cv::String msg = getErrorString(code, npp_errors, npp_error_num);
cv::gpu::error(msg.c_str(), file, line, func);
}
void ncvError(int code, const char *file, const int line, const char *func)
{
- std::string msg = getErrorString(code, ncv_errors, ncv_error_num);
+ cv::String msg = getErrorString(code, ncv_errors, ncv_error_num);
cv::gpu::error(msg.c_str(), file, line, func);
}
void cufftError(int code, const char *file, const int line, const char *func)
{
- std::string msg = getErrorString(code, cufft_errors, cufft_error_num);
+ cv::String msg = getErrorString(code, cufft_errors, cufft_error_num);
cv::gpu::error(msg.c_str(), file, line, func);
}
void cublasError(int code, const char *file, const int line, const char *func)
{
- std::string msg = getErrorString(code, cublas_errors, cublas_error_num);
+ cv::String msg = getErrorString(code, cublas_errors, cublas_error_num);
cv::gpu::error(msg.c_str(), file, line, func);
}
}
}
}
-cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const std::string& fname) :
+cv::gpu::detail::FFmpegVideoSource::FFmpegVideoSource(const cv::String& fname) :
stream_(0)
{
CV_Assert( init_MediaStream_FFMPEG() );
class FFmpegVideoSource : public VideoReader_GPU::VideoSource
{
public:
- FFmpegVideoSource(const std::string& fname);
+ FFmpegVideoSource(const cv::String& fname);
~FFmpegVideoSource();
VideoReader_GPU::FormatInfo format() const;
}
-NCVStatus loadFromXML(const std::string &filename,
+NCVStatus loadFromXML(const cv::String &filename,
HaarClassifierCascadeDescriptor &haar,
std::vector<HaarStage64> &haarStages,
std::vector<HaarClassifierNode128> &haarClassifierNodes,
#define NVBIN_HAAR_VERSION 0x1
-static NCVStatus loadFromNVBIN(const std::string &filename,
+static NCVStatus loadFromNVBIN(const cv::String &filename,
HaarClassifierCascadeDescriptor &haar,
std::vector<HaarStage64> &haarStages,
std::vector<HaarClassifierNode128> &haarClassifierNodes,
}
-NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStages,
+NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages,
Ncv32u &numNodes, Ncv32u &numFeatures)
{
size_t readCount;
NCVStatus ncvStat;
- std::string fext = filename.substr(filename.find_last_of(".") + 1);
+ cv::String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
if (fext == "nvbin")
}
-NCVStatus ncvHaarLoadFromFile_host(const std::string &filename,
+NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename,
HaarClassifierCascadeDescriptor &haar,
NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes,
NCVStatus ncvStat;
- std::string fext = filename.substr(filename.find_last_of(".") + 1);
+ cv::String fext = filename.substr(filename.find_last_of(".") + 1);
std::transform(fext.begin(), fext.end(), fext.begin(), ::tolower);
std::vector<HaarStage64> haarStages;
}
-NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename,
+NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename,
HaarClassifierCascadeDescriptor haar,
NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes,
Ncv32f curScale);
-NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const std::string &filename, Ncv32u &numStages,
+NCV_EXPORTS NCVStatus ncvHaarGetClassifierSize(const cv::String &filename, Ncv32u &numStages,
Ncv32u &numNodes, Ncv32u &numFeatures);
-NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const std::string &filename,
+NCV_EXPORTS NCVStatus ncvHaarLoadFromFile_host(const cv::String &filename,
HaarClassifierCascadeDescriptor &haar,
NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes,
NCVVector<HaarFeature64> &h_HaarFeatures);
-NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const std::string &filename,
+NCV_EXPORTS NCVStatus ncvHaarStoreNVBIN_host(const cv::String &filename,
HaarClassifierCascadeDescriptor haar,
NCVVector<HaarStage64> &h_HaarStages,
NCVVector<HaarClassifierNode128> &h_HaarNodes,
//==============================================================================
-static void stdDebugOutput(const std::string &msg)
+static void stdDebugOutput(const cv::String &msg)
{
std::cout << msg;
}
static NCVDebugOutputHandler *debugOutputHandler = stdDebugOutput;
-void ncvDebugOutput(const std::string &msg)
+void ncvDebugOutput(const cv::String &msg)
{
debugOutputHandler(msg);
}
//==============================================================================
-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);
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)
};
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() { }
-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(); }
bool cv::gpu::VideoReader_GPU::isOpened() const { return false; }
void cv::gpu::VideoReader_GPU::close() { }
{
}
-cv::gpu::VideoReader_GPU::VideoReader_GPU(const std::string& filename)
+cv::gpu::VideoReader_GPU::VideoReader_GPU(const cv::String& filename)
{
open(filename);
}
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::gpu::VideoWriter_GPU::VideoWriter_GPU() { throw_nogpu(); }
-cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
-cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
+cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
+cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::Ptr<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() {}
-void cv::gpu::VideoWriter_GPU::open(const std::string&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
-void cv::gpu::VideoWriter_GPU::open(const std::string&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
+void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, SurfaceFormat) { throw_nogpu(); }
+void cv::gpu::VideoWriter_GPU::open(const cv::String&, cv::Size, double, const EncoderParams&, SurfaceFormat) { throw_nogpu(); }
void cv::gpu::VideoWriter_GPU::open(const cv::Ptr<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(); }
bool cv::gpu::VideoWriter_GPU::isOpened() const { return false; }
cv::gpu::VideoWriter_GPU::EncoderParams cv::gpu::VideoWriter_GPU::getParams() const { EncoderParams params; throw_nogpu(); return params; }
cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams() { throw_nogpu(); }
-cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string&) { throw_nogpu(); }
-void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string&) { throw_nogpu(); }
-void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string&) const { throw_nogpu(); }
+cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String&) { throw_nogpu(); }
+void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String&) { throw_nogpu(); }
+void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String&) const { throw_nogpu(); }
#else // !defined HAVE_CUDA || !defined WIN32
class EncoderCallBackFFMPEG : public cv::gpu::VideoWriter_GPU::EncoderCallBack
{
public:
- EncoderCallBackFFMPEG(const std::string& fileName, cv::Size frameSize, double fps);
+ EncoderCallBackFFMPEG(const cv::String& fileName, cv::Size frameSize, double fps);
~EncoderCallBackFFMPEG();
unsigned char* acquireBitStream(int* bufferSize);
}
}
-EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const std::string& fileName, cv::Size frameSize, double fps) :
+EncoderCallBackFFMPEG::EncoderCallBackFFMPEG(const cv::String& fileName, cv::Size frameSize, double fps) :
stream_(0), isKeyFrame_(false)
{
int buf_size = std::max(frameSize.area() * 4, 1024 * 1024);
{
}
-cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
+cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
{
open(fileName, frameSize, fps, format);
}
-cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
+cv::gpu::VideoWriter_GPU::VideoWriter_GPU(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{
open(fileName, frameSize, fps, params, format);
}
close();
}
-void cv::gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
+void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, SurfaceFormat format)
{
close();
cv::Ptr<EncoderCallBack> encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps));
open(encoderCallback, frameSize, fps, format);
}
-void cv::gpu::VideoWriter_GPU::open(const std::string& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
+void cv::gpu::VideoWriter_GPU::open(const cv::String& fileName, cv::Size frameSize, double fps, const EncoderParams& params, SurfaceFormat format)
{
close();
cv::Ptr<EncoderCallBack> encoderCallback(new EncoderCallBackFFMPEG(fileName, frameSize, fps));
DisableSPSPPS = 0;
}
-cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const std::string& configFile)
+cv::gpu::VideoWriter_GPU::EncoderParams::EncoderParams(const cv::String& configFile)
{
load(configFile);
}
-void cv::gpu::VideoWriter_GPU::EncoderParams::load(const std::string& configFile)
+void cv::gpu::VideoWriter_GPU::EncoderParams::load(const cv::String& configFile)
{
cv::FileStorage fs(configFile, cv::FileStorage::READ);
CV_Assert( fs.isOpened() );
cv::read(fs["DisableSPSPPS" ], DisableSPSPPS, 0);
}
-void cv::gpu::VideoWriter_GPU::EncoderParams::save(const std::string& configFile) const
+void cv::gpu::VideoWriter_GPU::EncoderParams::save(const cv::String& configFile) const
{
cv::FileStorage fs(configFile, cv::FileStorage::WRITE);
CV_Assert( fs.isOpened() );
void setVerbose(bool verbose);
void read(const FileNode& node);
- void write(FileStorage& fs, const std::string& name=std::string()) const;
+ void write(FileStorage& fs, const cv::String& name=cv::String()) const;
int radius;
int threshold;
const PatchGenerator& patchGenerator=PatchGenerator());
virtual ~FernClassifier();
virtual void read(const FileNode& n);
- virtual void write(FileStorage& fs, const std::string& name=std::string()) const;
+ virtual void write(FileStorage& fs, const cv::String& name=cv::String()) const;
virtual void trainFromSingleView(const Mat& image,
const std::vector<KeyPoint>& keypoints,
int _patchSize=PATCH_SIZE,
inline void applyQuantization(int num_quant_bits) { makePosteriors2(num_quant_bits); }
// debug
- void savePosteriors(std::string url, bool append=false);
- void savePosteriors2(std::string url, bool append=false);
+ void savePosteriors(cv::String url, bool append=false);
+ void savePosteriors2(cv::String url, bool append=false);
private:
int classes_;
void write(std::ostream &os) const;
// experimental and debug
- void saveAllFloatPosteriors(std::string file_url);
- void saveAllBytePosteriors(std::string file_url);
- void setFloatPosteriorsFromTextfile_176(std::string url);
+ void saveAllFloatPosteriors(cv::String file_url);
+ void saveAllBytePosteriors(cv::String file_url);
+ void setFloatPosteriorsFromTextfile_176(cv::String url);
float countZeroElements();
std::vector<RandomizedTree> trees_;
CvAffinePose* m_affine_poses; // an array of poses
CvMat** m_transforms; // an array of affine transforms corresponding to poses
- std::string m_feature_name; // the name of the feature associated with the descriptor
+ cv::String m_feature_name; // the name of the feature associated with the descriptor
CvPoint m_center; // the coordinates of the feature (the center of the input image ROI)
int m_pca_dim_high; // the number of descriptor pca components to use for generating affine poses
const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1,
int pca_dim_high = 100, int pca_dim_low = 100);
- OneWayDescriptorBase(CvSize patch_size, int pose_count, const std::string &pca_filename, const std::string &train_path = std::string(), const std::string &images_list = std::string(),
+ OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename, const cv::String &train_path = cv::String(), const cv::String &images_list = cv::String(),
float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1,
int pca_dim_high = 100, int pca_dim_low = 100);
void ConvertDescriptorsArrayToTree(); // Converting pca_descriptors array to KD tree
// GetPCAFilename: get default PCA filename
- static std::string GetPCAFilename () { return "pca.yml"; }
+ static cv::String GetPCAFilename () { return "pca.yml"; }
virtual bool empty() const { return m_train_feature_count <= 0 ? true : false; }
OneWayDescriptorObject(CvSize patch_size, int pose_count, const char* train_path, const char* pca_config,
const char* pca_hr_config = 0, const char* pca_desc_config = 0, int pyr_levels = 1);
- OneWayDescriptorObject(CvSize patch_size, int pose_count, const std::string &pca_filename,
- const std::string &train_path = std::string (), const std::string &images_list = std::string (),
+ OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename,
+ const cv::String &train_path = cv::String (), const cv::String &images_list = cv::String (),
float _scale_min = 0.7f, float _scale_max=1.5f, float _scale_step=1.2f, int pyr_levels = 1);
Params( int poseCount = POSE_COUNT,
Size patchSize = Size(PATCH_WIDTH, PATCH_HEIGHT),
- std::string pcaFilename = std::string(),
- std::string trainPath = std::string(), std::string trainImagesList = std::string(),
+ cv::String pcaFilename = cv::String(),
+ cv::String trainPath = cv::String(), cv::String trainImagesList = cv::String(),
float minScale = GET_MIN_SCALE(), float maxScale = GET_MAX_SCALE(),
float stepScale = GET_STEP_SCALE() );
int poseCount;
Size patchSize;
- std::string pcaFilename;
- std::string trainPath;
- std::string trainImagesList;
+ cv::String pcaFilename;
+ cv::String trainPath;
+ cv::String trainImagesList;
float minScale, maxScale, stepScale;
};
int compressionMethod=FernClassifier::COMPRESSION_NONE,
const PatchGenerator& patchGenerator=PatchGenerator() );
- Params( const std::string& filename );
+ Params( const cv::String& filename );
int nclasses;
int patchSize;
int compressionMethod;
PatchGenerator patchGenerator;
- std::string filename;
+ cv::String filename;
};
FernDescriptorMatcher( const Params& params=Params() );
class CV_EXPORTS CalonderDescriptorExtractor : public DescriptorExtractor
{
public:
- CalonderDescriptorExtractor( const std::string& classifierFile );
+ CalonderDescriptorExtractor( const cv::String& classifierFile );
virtual void read( const FileNode &fn );
virtual void write( FileStorage &fs ) const;
};
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() );
}
void setVerbose(bool verbose);
void read(const FileNode& node);
- void write(FileStorage& fs, const std::string& name=std::string()) const;
+ void write(FileStorage& fs, const cv::String& name=cv::String()) const;
bool operator()(const Mat& image, CV_OUT Mat& H, CV_OUT std::vector<Point2f>& corners) const;
bool operator()(const std::vector<Mat>& pyr, const std::vector<KeyPoint>& keypoints,
CV_OUT Mat& H, CV_OUT std::vector<Point2f>& corners,
}
-void RandomizedTree::savePosteriors(std::string url, bool append)
+void RandomizedTree::savePosteriors(cv::String url, bool append)
{
std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out));
for (int i=0; i<num_leaves_; i++) {
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));
for (int i=0; i<num_leaves_; i++) {
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());
for (int i=0; i<(int)trees_.size(); ++i)
printf("[DEBUG] done\n");
}
-void RTreeClassifier::saveAllBytePosteriors(std::string url)
+void RTreeClassifier::saveAllBytePosteriors(cv::String url)
{
printf("[DEBUG] writing all byte posteriors to %s...\n", url.c_str());
for (int i=0; i<(int)trees_.size(); ++i)
}
-void RTreeClassifier::setFloatPosteriorsFromTextfile_176(std::string url)
+void RTreeClassifier::setFloatPosteriorsFromTextfile_176(cv::String url)
{
std::ifstream ifs(url.c_str());
void OneWayDescriptor::Initialize(int pose_count, IplImage* frontal, const char* feature_name, int norm)
{
- m_feature_name = std::string(feature_name);
+ m_feature_name = cv::String(feature_name);
CvRect roi = cvGetImageROI(frontal);
m_center = rect_center(roi);
Initialize(pose_count, frontal, feature_name, 1);
return;
}
- m_feature_name = std::string(feature_name);
+ m_feature_name = cv::String(feature_name);
CvRect roi = cvGetImageROI(frontal);
m_center = rect_center(roi);
}
- OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const std::string &pca_filename,
- const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max,
+ OneWayDescriptorBase::OneWayDescriptorBase(CvSize patch_size, int pose_count, const cv::String &pca_filename,
+ const cv::String &train_path, const cv::String &images_list, float _scale_min, float _scale_max,
float _scale_step, int pyr_levels,
int pca_dim_high, int pca_dim_low)
: m_pca_dim_high(pca_dim_high), m_pca_dim_low(pca_dim_low), scale_min(_scale_min), scale_max(_scale_max), scale_step(_scale_step)
m_part_id = 0;
}
- OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const std::string &pca_filename,
- const std::string &train_path, const std::string &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) :
+ OneWayDescriptorObject::OneWayDescriptorObject(CvSize patch_size, int pose_count, const cv::String &pca_filename,
+ const cv::String &train_path, const cv::String &images_list, float _scale_min, float _scale_max, float _scale_step, int pyr_levels) :
OneWayDescriptorBase(patch_size, pose_count, pca_filename, train_path, images_list, _scale_min, _scale_max, _scale_step, pyr_levels)
{
m_part_id = 0;
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());
if (_avg != 0)
{
cvReleaseMat(&_avg);
}
- str = std::string ("eigenvectors") + postfix;
+ str = cv::String ("eigenvectors") + postfix;
CvMat* _eigenvectors = reinterpret_cast<CvMat*> (fn[str].readObj());
if (_eigenvectors != 0)
{
* OneWayDescriptorMatcher *
\****************************************************************************************/
- OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, std::string _pcaFilename,
- std::string _trainPath, std::string _trainImagesList,
+ OneWayDescriptorMatcher::Params::Params( int _poseCount, Size _patchSize, cv::String _pcaFilename,
+ cv::String _trainPath, cv::String _trainImagesList,
float _minScale, float _maxScale, float _stepScale ) :
poseCount(_poseCount), patchSize(_patchSize), pcaFilename(_pcaFilename),
trainPath(_trainPath), trainImagesList(_trainImagesList),
void OneWayDescriptorMatcher::read( const FileNode &fn )
{
- base = new OneWayDescriptorObject( params.patchSize, params.poseCount, std::string (), std::string (), std::string (),
+ base = new OneWayDescriptorObject( params.patchSize, params.poseCount, cv::String (), cv::String (), cv::String (),
params.minScale, params.maxScale, params.stepScale );
base->Read (fn);
}
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);
}
-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);
compressionMethod(_compressionMethod), patchGenerator(_patchGenerator)
{}
-FernDescriptorMatcher::Params::Params( const std::string& _filename )
+FernDescriptorMatcher::Params::Params( const cv::String& _filename )
{
filename = _filename;
}
}
-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);
assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 )
{
- string nm = fn[i];
+ String nm = fn[i];
DatasetParams params;
- string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
- string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
+ String sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
+ String uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
datasetsParams[nm] = params;
}
return cvtest::TS::OK;
assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=4 )
{
- string caseName = fn[i], datasetName = fn[i+1];
+ String caseName = fn[i], datasetName = fn[i+1];
RunParams params;
- string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
- string iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str());
+ String ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
+ String iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str());
caseNames.push_back( caseName );
caseDatasets.push_back( datasetName );
caseRunParams.push_back( params );
void set_miss_ch( char ch );
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:
...
-------------------------------
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.
CvForestTree* get_tree(int i) const;
protected:
- virtual std::string getName() const;
+ virtual cv::String getName() const;
virtual bool grow_forest( const CvTermCriteria term_crit );
CvRTParams params=CvRTParams());
virtual bool train( CvMLData* data, CvRTParams params=CvRTParams() );
protected:
- virtual std::string getName() const;
+ virtual cv::String getName() const;
virtual bool grow_forest( const CvTermCriteria term_crit );
};
void set_miss_ch( char ch );
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:
virtual void clear();
bool mix;
int total_class_count;
- std::map<std::string, int> class_map;
+ std::map<cv::String, int> class_map;
CvMat* train_sample_idx;
CvMat* test_sample_idx;
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;
}
{
}
-std::string CvERTrees::getName() const
+cv::String CvERTrees::getName() const
{
return CV_TYPE_NAME_ML_ERTREES;
}
CvSeqReader reader;
int i;
- std::string s;
+ cv::String s;
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_GBT );
CvFileNode* trees_fnode;
CvMemStorage* storage;
int i, ntrees;
- std::string s;
+ cv::String s;
clear();
read_params( fs, node );
#include "cvconfig.h"
#endif
+#include "opencv2/core.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/core/utility.hpp"
clear();
}
-std::string CvRTrees::getName() const
+cv::String CvRTrees::getName() const
{
return CV_TYPE_NAME_ML_RTREES;
}
if( ntrees < 1 || !trees || nsamples < 1 )
CV_Error( CV_StsBadArg, "Invalid CvRTrees object" );
- std::string modelNodeName = this->getName();
+ cv::String modelNodeName = this->getName();
cvStartWriteStruct( fs, name, CV_NODE_MAP, modelNodeName.c_str() );
cvWriteInt( fs, "nclasses", nclasses );
qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio);
double old_dist = 0.0;
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;
// iterate to make the folds more balanced
while (new_dist > 0.0)
qsort(ratios, k_fold, sizeof(ratios[0]), icvCmpIndexedratio);
new_dist = 0.0;
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)
{
// swapping really improves, so swap the samples
}
// 3. svm
-int str_to_svm_type(string& str)
+int str_to_svm_type(String& str)
{
if( !str.compare("C_SVC") )
return CvSVM::C_SVC;
CV_Error( CV_StsBadArg, "incorrect svm type string" );
return -1;
}
-int str_to_svm_kernel_type( string& str )
+int str_to_svm_kernel_type( String& str )
{
if( !str.compare("LINEAR") )
return CvSVM::LINEAR;
// 4. em
// 5. ann
-int str_to_ann_train_method( string& str )
+int str_to_ann_train_method( String& str )
{
if( !str.compare("BACKPROP") )
return CvANN_MLP_TrainParams::BACKPROP;
// 6. dtree
// 7. boost
-int str_to_boost_type( string& str )
+int str_to_boost_type( String& str )
{
if ( !str.compare("DISCRETE") )
return CvBoost::DISCRETE;
int CV_MLBaseTest::prepare_test_case( int test_case_idx )
{
int trainSampleCount, respIdx;
- string varTypes;
+ String varTypes;
clear();
string dataPath = ts->get_data_path();
}
else if( !modelName.compare(CV_SVM) )
{
- string svm_type_str, kernel_type_str;
+ String svm_type_str, kernel_type_str;
modelParamsNode["svm_type"] >> svm_type_str;
modelParamsNode["kernel_type"] >> kernel_type_str;
CvSVMParams params;
}
else if( !modelName.compare(CV_ANN) )
{
- string train_method_str;
+ String train_method_str;
double param1, param2;
modelParamsNode["train_method"] >> train_method_str;
modelParamsNode["param1"] >> param1;
int BOOST_TYPE, WEAK_COUNT, MAX_DEPTH;
float WEIGHT_TRIM_RATE;
bool USE_SURROGATE;
- string typeStr;
+ String typeStr;
modelParamsNode["type"] >> typeStr;
BOOST_TYPE = str_to_boost_type( typeStr );
modelParamsNode["weak_count"] >> WEAK_COUNT;
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)
{
if(support_image2d())
const int max_samples_j = 1 + ((img_cols - min_size) >> octave);
Context *clCxt = det.clCxt;
- std::string kernelName = "icvCalcLayerDetAndTrace";
+ cv::String kernelName = "icvCalcLayerDetAndTrace";
std::vector< std::pair<size_t, const void *> > args;
if(sumTex)
const int min_margin = ((calcSize(octave, 2) >> 1) >> octave) + 1;
Context *clCxt = det.clCxt;
- std::string kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer";
+ cv::String kernelName = use_mask ? "icvFindMaximaInLayer_withmask" : "icvFindMaximaInLayer";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data));
oclMat &keypoints, oclMat &counters_, int octave, int layer_rows, int max_features)
{
Context *clCxt = det.clCxt;
- std::string kernelName = "icvInterpolateKeypoint";
+ cv::String kernelName = "icvInterpolateKeypoint";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&det.data));
void SURF_OCL_Invoker::icvCalcOrientation_gpu(const oclMat &keypoints, int nFeatures)
{
Context *clCxt = counters.clCxt;
- std::string kernelName = "icvCalcOrientation";
+ cv::String kernelName = "icvCalcOrientation";
std::vector< std::pair<size_t, const void *> > args;
void SURF_OCL_Invoker::icvSetUpright_gpu(const oclMat &keypoints, int nFeatures)
{
Context *clCxt = counters.clCxt;
- std::string kernelName = "icvSetUpright";
+ cv::String kernelName = "icvSetUpright";
std::vector< std::pair<size_t, const void *> > args;
{
// compute unnormalized descriptors, then normalize them - odd indexing since grid must be 2D
Context *clCxt = descriptors.clCxt;
- std::string kernelName;
+ cv::String kernelName;
std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = {1, 1, 1};
size_t globalThreads[3] = {1, 1, 1};
};
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 void clear();
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,
std::vector<ObjectDetection>& objectDetections,
float overlapThreshold=0.5f,
int numThreads=-1 );
- const std::vector<std::string>& getClassNames() const;
+ const std::vector<cv::String>& getClassNames() const;
size_t getClassCount() const;
private:
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);
{
public:
CV_WRAP CascadeClassifier();
- CV_WRAP CascadeClassifier( const std::string& filename );
+ CV_WRAP CascadeClassifier( const cv::String& filename );
virtual ~CascadeClassifier();
CV_WRAP virtual bool empty() const;
- CV_WRAP bool load( const std::string& filename );
+ CV_WRAP bool load( const cv::String& filename );
virtual bool read( const FileNode& node );
CV_WRAP virtual void detectMultiScale( const Mat& image,
CV_OUT std::vector<Rect>& objects,
gammaCorrection(_gammaCorrection), nlevels(_nlevels)
{}
- CV_WRAP HOGDescriptor(const std::string& filename)
+ CV_WRAP HOGDescriptor(const cv::String& filename)
{
load(filename);
}
CV_WRAP virtual void setSVMDetector(InputArray _svmdetector);
virtual bool read(FileNode& fn);
- virtual void write(FileStorage& fs, const std::string& objname) const;
+ virtual void write(FileStorage& fs, const cv::String& objname) const;
- CV_WRAP virtual bool load(const std::string& filename, const std::string& objname=std::string());
- CV_WRAP virtual void save(const std::string& filename, const std::string& objname=std::string()) const;
+ CV_WRAP virtual bool load(const cv::String& filename, const cv::String& objname=cv::String());
+ CV_WRAP virtual void save(const cv::String& filename, const cv::String& objname=cv::String()) const;
virtual void copyTo(HOGDescriptor& c) const;
CV_WRAP virtual void compute(const Mat& img,
int groupThreshold = 0) const;
// read/parse Dalal's alt model file
- void readALTModel(std::string modelfile);
+ void readALTModel(cv::String modelfile);
};
CV_EXPORTS_W void findDataMatrix(InputArray image,
- CV_OUT std::vector<std::string>& codes,
+ CV_OUT std::vector<cv::String>& codes,
OutputArray corners=noArray(),
OutputArrayOfArrays dmtx=noArray());
CV_EXPORTS_W void drawDataMatrixCodes(InputOutputArray image,
- const std::vector<std::string>& codes,
+ const std::vector<cv::String>& codes,
InputArray corners);
}
return processImpl(src, mask);
}
- virtual std::string name() const =0;
+ virtual cv::String name() const =0;
virtual void read(const FileNode& fn) =0;
virtual void write(FileStorage& fs) const =0;
* - "ColorGradient"
* - "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.
*/
ColorGradient(float weak_threshold, size_t num_features, float strong_threshold);
- virtual std::string name() const;
+ virtual cv::String name() const;
virtual void read(const FileNode& fn);
virtual void write(FileStorage& fs) const;
DepthNormal(int distance_threshold, int difference_threshold, size_t num_features,
int extract_threshold);
- virtual std::string name() const;
+ virtual cv::String name() const;
virtual void read(const FileNode& fn);
virtual void write(FileStorage& fs) const;
{
}
- Match(int x, int y, float similarity, const std::string& class_id, int template_id);
+ Match(int x, int y, float similarity, const cv::String& class_id, int template_id);
/// Sort matches with high similarity to the front
bool operator<(const Match& rhs) const
int x;
int y;
float similarity;
- std::string class_id;
+ cv::String class_id;
int template_id;
};
-inline Match::Match(int _x, int _y, float _similarity, const std::string& _class_id, int _template_id)
+inline Match::Match(int _x, int _y, float _similarity, const cv::String& _class_id, int _template_id)
: x(_x), y(_y), similarity(_similarity), class_id(_class_id), template_id(_template_id)
{
}
* empty or the same size as its corresponding source.
*/
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(),
const std::vector<Mat>& masks = std::vector<Mat>()) const;
*
* \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);
/**
* \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.
* For example, with 2 modalities (Gradient, Normal) and two pyramid levels
* (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 std::string& class_id) const;
+ int numTemplates(const cv::String& class_id) const;
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 write(FileStorage& fs) const;
- std::string readClass(const FileNode& fn, const std::string &class_id_override = "");
- void writeClass(const std::string& class_id, FileStorage& fs) const;
+ cv::String readClass(const FileNode& fn, const cv::String &class_id_override = "");
+ void writeClass(const cv::String& class_id, FileStorage& fs) const;
- void readClasses(const std::vector<std::string>& class_ids,
- const std::string& format = "templates_%s.yml.gz");
- void writeClasses(const std::string& format = "templates_%s.yml.gz") const;
+ void readClasses(const std::vector<cv::String>& class_ids,
+ const cv::String& format = "templates_%s.yml.gz");
+ void writeClasses(const cv::String& format = "templates_%s.yml.gz") const;
protected:
std::vector< Ptr<Modality> > modalities;
std::vector<int> T_at_level;
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;
typedef std::vector<Mat> LinearMemories;
void matchClass(const LinearMemoryPyramid& lm_pyramid,
const std::vector<Size>& sizes,
float threshold, std::vector<Match>& matches,
- const std::string& class_id,
+ const cv::String& class_id,
const std::vector<TemplatePyramid>& template_pyramids) const;
};
{
}
-CascadeClassifier::CascadeClassifier(const std::string& filename)
+CascadeClassifier::CascadeClassifier(const cv::String& filename)
{
load(filename);
}
return oldCascade.empty() && data.stages.empty();
}
-bool CascadeClassifier::load(const std::string& filename)
+bool CascadeClassifier::load(const cv::String& filename)
{
oldCascade.release();
data = Data();
static const float THRESHOLD_EPS = 1e-5f;
// 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 )
stageType = BOOST;
else
return false;
- std::string featureTypeStr = (std::string)root[CC_FEATURE_TYPE];
+ cv::String featureTypeStr = (cv::String)root[CC_FEATURE_TYPE];
if( featureTypeStr == CC_HAAR )
featureType = FeatureEvaluator::HAAR;
else if( featureTypeStr == CC_LBP )
{
void findDataMatrix(InputArray _image,
- std::vector<std::string>& codes,
+ std::vector<cv::String>& codes,
OutputArray _corners,
OutputArrayOfArrays _dmtx)
{
for( i = 0; i < n; i++ )
{
CvDataMatrixCode& rc_i = rc[i];
- codes[i] = std::string(rc_i.msg);
+ codes[i] = cv::String(rc_i.msg);
if( corners.data )
{
}
void drawDataMatrixCodes(InputOutputArray _image,
- const std::vector<std::string>& codes,
+ const std::vector<cv::String>& codes,
InputArray _corners)
{
Mat image = _image.getMat();
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() )
fs << objName;
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);
FileNode obj = !objname.empty() ? fs[objname] : fs.getFirstTopLevelNode();
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);
write(fs, !objName.empty() ? objName : FileStorage::getDefaultObjectName(filename));
cv::groupRectangles(foundLocations, groupThreshold, 0.2);
}
-void HOGDescriptor::readALTModel(std::string modelfile)
+void HOGDescriptor::readALTModel(cv::String modelfile)
{
// read model from SVMlight format..
FILE *modelfl;
if ((modelfl = fopen(modelfile.c_str(), "rb")) == NULL)
{
- std::string eerr("file not exist");
- std::string efile(__FILE__);
- std::string efunc(__FUNCTION__);
+ cv::String eerr("file not exist");
+ cv::String efile(__FILE__);
+ cv::String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
}
char version_buffer[10];
if (!fread (&version_buffer,sizeof(char),10,modelfl))
{
- std::string eerr("version?");
- std::string efile(__FILE__);
- std::string efunc(__FUNCTION__);
+ cv::String eerr("version?");
+ cv::String efile(__FILE__);
+ cv::String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
}
if(strcmp(version_buffer,"V6.01")) {
- std::string eerr("version doesnot match");
- std::string efile(__FILE__);
- std::string efunc(__FUNCTION__);
+ cv::String eerr("version doesnot match");
+ cv::String efile(__FILE__);
+ cv::String efunc(__FUNCTION__);
throw Exception(CV_StsError, eerr, efile, efunc, __LINE__);
}
/* read version number */
{ throw Exception(); }
if (version < 200)
{
- std::string eerr("version doesnot match");
- std::string efile(__FILE__);
- std::string efunc(__FUNCTION__);
+ cv::String eerr("version doesnot match");
+ cv::String efile(__FILE__);
+ cv::String efunc(__FUNCTION__);
throw Exception();
}
int kernel_type;
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 );
}
return detectors.empty();
}
-const std::vector<std::string>& LatentSvmDetector::getClassNames() const
+const std::vector<cv::String>& LatentSvmDetector::getClassNames() const
{
return classNames;
}
return classNames.size();
}
-static std::string extractModelName( const std::string& filename )
+static cv::String extractModelName( const cv::String& filename )
{
size_t startPos = filename.rfind('/');
- if( startPos == std::string::npos )
+ if( startPos == cv::String::npos )
startPos = filename.rfind('\\');
- if( startPos == std::string::npos )
+ if( startPos == cv::String::npos )
startPos = 0;
else
startPos++;
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();
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" )
continue;
}
}
-Ptr<Modality> Modality::create(const std::string& modality_type)
+Ptr<Modality> Modality::create(const cv::String& modality_type)
{
if (modality_type == "ColorGradient")
return new ColorGradient();
Ptr<Modality> Modality::create(const FileNode& fn)
{
- std::string type = fn["type"];
+ cv::String type = fn["type"];
Ptr<Modality> modality = create(type);
modality->read(fn);
return modality;
static const char CG_NAME[] = "ColorGradient";
-std::string ColorGradient::name() const
+cv::String ColorGradient::name() const
{
return CG_NAME;
}
void ColorGradient::read(const FileNode& fn)
{
- std::string type = fn["type"];
+ cv::String type = fn["type"];
CV_Assert(type == CG_NAME);
weak_threshold = fn["weak_threshold"];
static const char DN_NAME[] = "DepthNormal";
-std::string DepthNormal::name() const
+cv::String DepthNormal::name() const
{
return DN_NAME;
}
void DepthNormal::read(const FileNode& fn)
{
- std::string type = fn["type"];
+ cv::String type = fn["type"];
CV_Assert(type == DN_NAME);
distance_threshold = fn["distance_threshold"];
}
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
{
matches.clear();
void Detector::matchClass(const LinearMemoryPyramid& lm_pyramid,
const std::vector<Size>& sizes,
float threshold, std::vector<Match>& matches,
- const std::string& class_id,
+ const cv::String& class_id,
const std::vector<TemplatePyramid>& template_pyramids) const
{
// For each template...
}
}
-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)
{
int num_modalities = static_cast<int>(modalities.size());
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];
int template_id = static_cast<int>(template_pyramids.size());
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);
CV_Assert(i != class_templates.end());
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);
if (i == class_templates.end())
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();
for ( ; i != iend; ++i)
{
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
FileNode mod_fn = fn["modalities"];
FileNodeIterator mod_it = mod_fn.begin(), mod_it_end = mod_fn.end();
int i = 0;
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);
// Detector should not already have this class
- std::string class_id;
+ cv::String class_id;
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());
class_id = class_id_tmp;
}
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);
CV_Assert(it != class_templates.end());
fs << "]"; // pyramids
}
-void Detector::readClasses(const std::vector<std::string>& class_ids,
- const std::string& format)
+void Detector::readClasses(const std::vector<cv::String>& class_ids,
+ const cv::String& format)
{
for (size_t i = 0; i < class_ids.size(); ++i)
{
- const std::string& class_id = class_ids[i];
- std::string filename = cv::format(format.c_str(), class_id.c_str());
+ const cv::String& class_id = class_ids[i];
+ cv::String filename = cv::format(format.c_str(), class_id.c_str());
FileStorage fs(filename, FileStorage::READ);
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();
for ( ; it != it_end; ++it)
{
- const std::string& class_id = it->first;
- std::string filename = cv::format(format.c_str(), class_id.c_str());
+ const cv::String& class_id = it->first;
+ cv::String filename = cv::format(format.c_str(), class_id.c_str());
FileStorage fs(filename, FileStorage::WRITE);
writeClass(class_id, fs);
}
FileNodeIterator it = fn[DETECTOR_NAMES].begin();
for( ; it != fn[DETECTOR_NAMES].end(); )
{
- string _name;
+ String _name;
it >> _name;
detectorNames.push_back(_name);
readDetector(fn[DETECTORS][_name]);
{
for( FileNodeIterator it = fn[IMAGE_FILENAMES].begin(); it != fn[IMAGE_FILENAMES].end(); )
{
- string filename;
+ String filename;
it >> filename;
imageFilenames.push_back(filename);
Mat img = imread( dataPath+filename, 1 );
void CV_CascadeDetectorTest::readDetector( const FileNode& fn )
{
- string filename;
+ String filename;
int flag;
fn[FILENAME] >> filename;
detectorFilenames.push_back(filename);
void CV_HOGDetectorTest::readDetector( const FileNode& fn )
{
- string filename;
+ String filename;
if( fn[FILENAME].node->data.seq != 0 )
fn[FILENAME] >> filename;
detectorFilenames.push_back( filename);
// detector12 - to test case of two (several) classes 'cat' and car
// 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[1] = model_path_car;
LatentSvmDetector detector12( models_pathes );
~Info();
void release();
Info &operator = (const Info &m);
- std::vector<std::string> DeviceName;
+ std::vector<cv::String> DeviceName;
};
//////////////////////////////// Initialization & Info ////////////////////////
//this function may be obsoleted
//! Calls a kernel, by string. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
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],
std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options,
//! Calls a kernel, by file. Pass globalThreads = NULL, and cleanUp = true, to finally clean-up without executing.
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],
std::vector< std::pair<size_t, const void *> > &args,
int channels, int depth, const char *build_options,
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);
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,
- 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 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);
- 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],
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);
- 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, const char *build_options);
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);
- 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, char *build_options, FLUSH_MODE finish_mode = DISABLE);
// bind oclMat to OpenCL image textures
/////////////////////// add subtract multiply divide /////////////////////////
//////////////////////////////////////////////////////////////////////////////
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)
{
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);
}
-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)
{
{
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);
void cv::ocl::multiply(const oclMat &src1, const oclMat &src2, oclMat &dst, double scalar)
}
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)
{
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)
{
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] =
{
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__);
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);
}
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;
arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString);
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;
arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString, 1);
}
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;
arithmetic_scalar( src1, src2, dst, mask, kernelName, kernelString, -1);
}
return;
}
- std::string kernelName = "arithm_s_div";
+ cv::String kernelName = "arithm_s_div";
arithmetic_scalar_run(src, dst, kernelName, &arithm_div, scalar);
}
//////////////////////////////////////////////////////////////////////////////
}
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;
arithmetic_scalar( src1, src2, dst, mask, kernelName, &arithm_absdiff);
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////// 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);
CV_Assert(src1.oclchannels() == 1);
std::cout << "Selected device do not support double" << std::endl;
return;
}
- std::string kernelName;
+ cv::String kernelName;
const char **kernelString = NULL;
switch( cmpOp )
{
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////// 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;
int all_cols = src.step / (vlen * src.elemSize1());
}
-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;
size_t gt[3] = {groupnum * 256, 1, 1}, lt[3] = {256, 1, 1};
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////// 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)
{
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)
{
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////// 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;
int channels = src1.oclchannels();
CV_Assert((lut.oclchannels() == 1 || lut.oclchannels() == cn) && lut.rows == 1 && lut.cols == 256);
dst.create(src.size(), CV_MAKETYPE(lut.depth(), cn));
//oclMat _lut(lut);
- std::string kernelName = "LUT";
+ cv::String kernelName = "LUT";
arithmetic_lut_run(src, lut, dst, kernelName);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////// 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());
CV_Assert(src.cols == dst.cols &&
//////////////////////////////////////////////////////////////////////////////
////////////////////////////// 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)
{
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)
{
{
CV_Assert(x.type() == y.type() && x.size() == y.size() && (x.depth() == CV_32F || x.depth() == CV_64F));
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)
{
arithmetic_phase_run(x, y, Angle, kernelName, &arithm_phase);
////////////////////////////////// cartToPolar ///////////////////////////////
//////////////////////////////////////////////////////////////////////////////
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)
{
////////////////////////////////// polarToCart ///////////////////////////////
//////////////////////////////////////////////////////////////////////////////
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)
{
//////////////////////////////////////////////////////////////////////////////
///////////////////////////// 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;
int all_cols = src.step / (vlen * src.elemSize1());
int vlen = 8 , dbsize = groupnum * vlen;
//cl_ulong start, end;
Context *clCxt = src.clCxt;
- std::string kernelName = "arithm_op_nonzero";
+ cv::String kernelName = "arithm_op_nonzero";
int *p = new int[dbsize], nonzero = 0;
cl_mem dstBuffer = openCLCreateBuffer(clCxt, CL_MEM_WRITE_ONLY, dbsize * sizeof(int));
arithmetic_countNonZero_run(src, dstBuffer, vlen, groupnum, kernelName);
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////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());
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());
CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols &&
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);
}
-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());
CV_Assert(src1.cols == src2.cols && src2.cols == dst.cols &&
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());
}
-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] =
{
cv::ocl::error("Unsupported arithmetic operation", __FILE__, __LINE__);
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);
}
return;
}
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);
}
return;
}
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())
bitwise_run(src1, src2, dst, kernelName, &arithm_bitwise_or);
else
std::cout << "Selected device do not support double" << std::endl;
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)
bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_or_scalar_mask);
else
}
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())
bitwise_run(src1, src2, dst, kernelName, &arithm_bitwise_and);
std::cout << "Selected device do not support double" << std::endl;
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)
bitwise_scalar(src1, src2, dst, mask, kernelName, &arithm_bitwise_and_scalar_mask);
else
return;
}
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())
std::cout << "Selected device do not support double" << std::endl;
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)
bitwise_scalar( src1, src2, dst, mask, kernelName, &arithm_bitwise_xor_scalar_mask);
else
//////////////////////////////////////////////////////////////////////////////
#define TILE_DIM (32)
#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)
{
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.type() == dst.type());
CV_Assert((x.type() == y.type() && x.size() == y.size() && x.depth() == CV_32F) || x.depth() == CV_64F);
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);
}
}
//lookup the binary given the file name
- cl_program progLookup(std::string srcsign);
+ cl_program progLookup(cv::String srcsign);
//add program to the cache
- void addProgram(std::string srcsign, cl_program program);
+ void addProgram(cv::String srcsign, cl_program program);
void releaseProgram();
- std::map <std::string, cl_program> codeCache;
+ std::map <cv::String, cl_program> codeCache;
unsigned int cacheSize;
//The presumed watermark for the cache volume (256MB). Is it enough?
//We may need more delicate algorithms when necessary later.
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 *)&wstep ));
- std::string kernelName = "BlendLinear";
+ cv::String kernelName = "BlendLinear";
openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
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);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
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);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&trainIdx.step ));
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);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&trainIdx.step ));
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);
//float *dis = (float *)clEnqueueMapBuffer(ctx->impl->clCmdQueue, (cl_mem)distance.data, CL_TRUE, CL_MAP_READ, 0, 8, 0, NULL, NULL, NULL);
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
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);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
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);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
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);
}
args.push_back( std::make_pair( sizeof(cl_int), (void *)&query.step ));
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);
}
size_t globalSize[] = {trainIdx.rows * BLOCK_SIZE, 1, 1};
size_t localSize[] = {BLOCK_SIZE, 1, 1};
int block_size = BLOCK_SIZE;
- std::string kernelName = "BruteForceMatch_findBestMatch";
+ cv::String kernelName = "BruteForceMatch_findBestMatch";
for (int i = 0; i < k; ++i)
{
int tl_v = dst_roi.tl().y;
Context *clCxt = Context::getContext();
- std::string kernelName = "buildWarpPlaneMaps";
+ cv::String kernelName = "buildWarpPlaneMaps";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data));
int tl_v = dst_roi.tl().y;
Context *clCxt = Context::getContext();
- std::string kernelName = "buildWarpCylindricalMaps";
+ cv::String kernelName = "buildWarpCylindricalMaps";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data));
int tl_v = dst_roi.tl().y;
Context *clCxt = Context::getContext();
- std::string kernelName = "buildWarpSphericalMaps";
+ cv::String kernelName = "buildWarpSphericalMaps";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map_x.data));
oclMat coeffsOclMat(coeffsMat.reshape(1, 1));
Context *clCxt = Context::getContext();
- std::string kernelName = "buildWarpAffineMaps";
+ cv::String kernelName = "buildWarpAffineMaps";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&xmap.data));
oclMat coeffsOclMat(coeffsMat.reshape(1, 1));
Context *clCxt = Context::getContext();
- std::string kernelName = "buildWarpPerspectiveMaps";
+ cv::String kernelName = "buildWarpPerspectiveMaps";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&xmap.data));
void canny::calcSobelRowPass_gpu(const oclMat &src, oclMat &dx_buf, oclMat &dy_buf, int rows, int cols)
{
Context *clCxt = src.clCxt;
- std::string kernelName = "calcSobelRowPass";
+ cv::String kernelName = "calcSobelRowPass";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src.data));
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;
- std::string kernelName = "calcMagnitude_buf";
+ cv::String kernelName = "calcMagnitude_buf";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dx_buf.data));
void canny::calcMagnitude_gpu(const oclMat &dx, const oclMat &dy, oclMat &mag, int rows, int cols, bool L2Grad)
{
Context *clCxt = dx.clCxt;
- std::string kernelName = "calcMagnitude";
+ cv::String kernelName = "calcMagnitude";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dx.data));
size_t globalThreads[3] = {cols, rows, 1};
- std::string kernelName = "calcMap";
+ cv::String kernelName = "calcMap";
size_t localThreads[3] = {16, 16, 1};
openCLExecuteKernel2(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1);
void canny::edgesHysteresisLocal_gpu(oclMat &map, oclMat &st1, void *counter, int rows, int cols)
{
Context *clCxt = map.clCxt;
- std::string kernelName = "edgesHysteresisLocal";
+ cv::String kernelName = "edgesHysteresisLocal";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map.data));
unsigned int count;
openCLSafeCall(clEnqueueReadBuffer((cl_command_queue)getoclCommandQueue(), (cl_mem)counter, 1, 0, sizeof(float), &count, 0, NULL, NULL));
Context *clCxt = map.clCxt;
- std::string kernelName = "edgesHysteresisGlobal";
+ cv::String kernelName = "edgesHysteresisGlobal";
std::vector< std::pair<size_t, const void *> > args;
size_t localThreads[3] = {128, 1, 1};
void canny::getEdges_gpu(oclMat &map, oclMat &dst, int rows, int cols)
{
Context *clCxt = map.clCxt;
- std::string kernelName = "getEdges";
+ cv::String kernelName = "getEdges";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&map.data));
Context *clCxt = src.clCxt;
- const std::string kernelName = "columnSum";
+ const cv::String kernelName = "columnSum";
std::vector< std::pair<size_t, const void *> > args;
int srcOffset_x = srcOffset % srcStep;
int srcOffset_y = srcOffset / srcStep;
Context *clCxt = src.clCxt;
- std::string kernelName;
+ cv::String kernelName;
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};
int srcOffset_x = srcOffset % srcStep;
int srcOffset_y = srcOffset / srcStep;
Context *clCxt = src.clCxt;
- std::string kernelName;
+ cv::String kernelName;
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};
int cn = src.oclchannels();
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_y = src.offset / src.step;
(src.rows == dst.rows));
Context *clCxt = src.clCxt;
- std::string kernelName = "boxFilter_C1_D0";
+ cv::String kernelName = "boxFilter_C1_D0";
char btype[30];
(src.rows == dst.rows));
Context *clCxt = src.clCxt;
- std::string kernelName = "boxFilter_C4_D0";
+ cv::String kernelName = "boxFilter_C4_D0";
char btype[30];
(src.rows == dst.rows));
Context *clCxt = src.clCxt;
- std::string kernelName = "boxFilter_C1_D5";
+ cv::String kernelName = "boxFilter_C1_D5";
char btype[30];
(src.rows == dst.rows));
Context *clCxt = src.clCxt;
- std::string kernelName = "boxFilter_C4_D5";
+ cv::String kernelName = "boxFilter_C4_D5";
char btype[30];
int channels = src.oclchannels();
size_t localThreads[3] = {16, 16, 1};
- std::string kernelName = "row_filter";
+ cv::String kernelName = "row_filter";
char btype[30];
int channels = src.oclchannels();
size_t localThreads[3] = {16, 16, 1};
- std::string kernelName = "col_filter";
+ cv::String kernelName = "col_filter";
char btype[30];
const cv::ocl::oclMat &qangle, float sigma, cv::ocl::oclMat &block_hists)
{
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;
int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / block_stride_x;
int height, int width, cv::ocl::oclMat &block_hists, float threshold)
{
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;
int block_hist_size = nbins * CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y;
float threshold, cv::ocl::oclMat &labels)
{
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;
int win_block_stride_x = win_stride_x / block_stride_x;
const cv::ocl::oclMat &block_hists, cv::ocl::oclMat &descriptors)
{
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;
int win_block_stride_x = win_stride_x / block_stride_x;
const cv::ocl::oclMat &block_hists, cv::ocl::oclMat &descriptors)
{
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;
int win_block_stride_x = win_stride_x / block_stride_x;
float angle_scale, cv::ocl::oclMat &grad, cv::ocl::oclMat &qangle, bool correct_gamma)
{
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;
size_t localThreads[3] = { NTHREADS, 1, 1 };
float angle_scale, cv::ocl::oclMat &grad, cv::ocl::oclMat &qangle, bool correct_gamma)
{
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;
size_t localThreads[3] = { NTHREADS, 1, 1 };
CV_Assert( (src.channels() == dst.channels()) );
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 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;
uchar thresh_uchar = cvFloor(thresh);
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 bSizeX = 16, bSizeY = 16;
int src_offset = (src.offset >> 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.create(map1.size(), src.type());
- std::string kernelName;
+ cv::String kernelName;
if( map1.type() == CV_32FC2 && !map2.data )
{
int dstStep_in_pixel = dst.step1() / dst.oclchannels();
int dstoffset_in_pixel = dst.offset / dst.elemSize();
//printf("%d %d\n",src.step1() , dst.elemSize());
- std::string kernelName;
+ cv::String kernelName;
if(interpolation == INTER_LINEAR)
kernelName = "resizeLN";
else if(interpolation == INTER_NEAREST)
int dstOffset = dst.offset / dst.oclchannels() / dst.elemSize1();
Context *clCxt = src.clCxt;
- std::string kernelName = "medianFilter";
+ cv::String kernelName = "medianFilter";
std::vector< std::pair<size_t, const void *> > args;
if(m == 3)
{
- std::string kernelName = "medianFilter3";
+ cv::String kernelName = "medianFilter3";
openCLExecuteKernel(clCxt, &imgproc_median, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth());
}
else if(m == 5)
{
- std::string kernelName = "medianFilter5";
+ cv::String kernelName = "medianFilter5";
openCLExecuteKernel(clCxt, &imgproc_median, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth());
}
else
{
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));
//openCLExecuteKernel(clCxt,&imgproc_median,kernelName,globalThreads,localThreads,args,src.oclchannels(),-1);
{
CV_Error(CV_StsBadArg, "unsupported border type");
}
- std::string kernelName = "copymakeborder";
+ cv::String kernelName = "copymakeborder";
size_t localThreads[3] = {16, 16, 1};
size_t globalThreads[3] = {(dst.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0],
(dst.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1
cl_mem coeffs_cm;
Context *clCxt = src.clCxt;
- std::string s[3] = {"NN", "Linear", "Cubic"};
- std::string kernelName = "warpAffine" + s[interpolation];
+ cv::String s[3] = {"NN", "Linear", "Cubic"};
+ cv::String kernelName = "warpAffine" + s[interpolation];
if(src.clCxt->supportsFeature(Context::CL_DOUBLE))
cl_mem coeffs_cm;
Context *clCxt = src.clCxt;
- std::string s[3] = {"NN", "Linear", "Cubic"};
- std::string kernelName = "warpPerspective" + s[interpolation];
+ cv::String s[3] = {"NN", "Linear", "Cubic"};
+ cv::String kernelName = "warpPerspective" + s[interpolation];
if(src.clCxt->supportsFeature(Context::CL_DOUBLE))
{
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)
{
char borderType[30];
Context *clCxt = mat_src.clCxt;
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 globalThreads[3] = { PARTIAL_HISTOGRAM256_COUNT *localThreads[0], 1, 1};
using namespace histograms;
Context *clCxt = sub_hist.clCxt;
- std::string kernelName = "merge_hist";
+ cv::String kernelName = "merge_hist";
size_t localThreads[3] = { 256, 1, 1 };
size_t globalThreads[3] = { HISTOGRAM256_BIN_COUNT *localThreads[0], 1, 1};
calcHist(mat_src, mat_hist);
Context *clCxt = mat_src.clCxt;
- std::string kernelName = "calLUT";
+ cv::String kernelName = "calLUT";
size_t localThreads[3] = { 256, 1, 1};
size_t globalThreads[3] = { 256, 1, 1};
oclMat lut(1, 256, CV_8UC1);
oclMat oclspace_weight(1, d * d, CV_32FC1, space_weight);
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 globalThreads[3] = { (dst.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0],
(dst.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1],
{
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(temp1.depth() == CV_32F);
CV_Assert(t.depth() == CV_32F);
CV_Assert(x.type() == y.type() && x.size() == y.size());
y.create(x.size(), x.type());
- std::string kernelName = "convolve";
+ cv::String kernelName = "convolve";
convolve_run(x, t, y, kernelName, &imgproc_convolve);
}
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);
if(iter != codeCache.end())
return iter->second;
return NULL;
}
- void ProgramCache::addProgram(std::string srcsign , cl_program program)
+ void ProgramCache::addProgram(cv::String srcsign , cl_program program)
{
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()
{
- std::map<std::string, cl_program>::iterator iter;
+ std::map<cv::String, cl_program>::iterator iter;
for(iter = codeCache.begin(); iter != codeCache.end(); iter++)
{
openCLSafeCall(clReleaseProgram(iter->second));
{
cl_platform_id oclplatform;
std::vector<cl_device_id> devices;
- std::vector<std::string> devName;
+ std::vector<cv::String> devName;
cl_context oclcontext;
cl_command_queue clCmdQueue;
char extra_options[512];
int double_support;
int unified_memory; //1 means integrated GPU, otherwise this value is 0
- std::string binpath;
+ cv::String binpath;
int refcounter;
Impl()
size_t extends_size;
openCLSafeCall(clGetDeviceInfo(devices[devnum], CL_DEVICE_EXTENSIONS, EXT_LEN, (void *)extends_set, &extends_size));
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");
double_support = 1;
{
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 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)
{
cl_kernel kernel;
cl_program program ;
cl_int status = 0;
std::stringstream src_sign;
- std::string srcsign;
- std::string filename;
+ cv::String srcsign;
+ cv::String filename;
CV_Assert(programCache != NULL);
if(NULL != build_options)
static double total_execute_time = 0;
static double total_kernel_time = 0;
#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,
int depth, const char *build_options)
{
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],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth)
{
openCLExecuteKernel(clCxt, source, kernelName, globalThreads, localThreads, args,
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],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options)
openCLExecuteKernel_(clCxt, source, kernelName, globalThreads, localThreads, args, channels, depth,
build_options);
#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 << "Function Name: " << kernelName;
if(depth >= 0)
#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],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options,
bool finish, bool measureKernelTime, bool cleanUp)
}
// 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;
char* str;
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],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, const char *build_options,
bool finish, bool measureKernelTime, bool cleanUp)
{
- std::vector<std::string> fsource;
+ std::vector<cv::String> fsource;
for (int i = 0 ; i < numFiles ; i++)
{
- std::string str;
+ cv::String str;
if (convertToString(fileName[i], str) >= 0)
fsource.push_back(str);
}
void interpolate::memsetKernel(float val, oclMat &img, int height, int offset)
{
Context *clCxt = Context::getContext();
- std::string kernelName = "memsetKernel";
+ cv::String kernelName = "memsetKernel";
std::vector< std::pair<size_t, const void *> > args;
int step = img.step / sizeof(float);
offset = step * height * offset;
void interpolate::normalizeKernel(oclMat &buffer, int height, int factor_offset, int dst_offset)
{
Context *clCxt = Context::getContext();
- std::string kernelName = "normalizeKernel";
+ cv::String kernelName = "normalizeKernel";
std::vector< std::pair<size_t, const void *> > args;
int step = buffer.step / sizeof(float);
factor_offset = step * height * factor_offset;
int b_offset, int d_offset)
{
Context *clCxt = Context::getContext();
- std::string kernelName = "forwardWarpKernel";
+ cv::String kernelName = "forwardWarpKernel";
std::vector< std::pair<size_t, const void *> > args;
int f_step = u.step / sizeof(float); // flow step
int b_step = buffer.step / sizeof(float);
int step = buffer.step / sizeof(float);
Context *clCxt = Context::getContext();
- std::string kernelName = "blendFramesKernel";
+ cv::String kernelName = "blendFramesKernel";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&tex_src0));
unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0];
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;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sums[0].data));
CV_Assert(result.rows == image.rows - templ.rows + 1 && result.cols == image.cols - templ.cols + 1);
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;
unsigned long long templ_sqsum = (unsigned long long)sqrSum(templ.reshape(1))[0];
Context *clCxt = image.clCxt;
- std::string kernelName = "normalizeKernel";
+ cv::String kernelName = "normalizeKernel";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&buf.image_sqsums[0].data));
CV_Assert(result.rows == image.rows - templ.rows + 1 && result.cols == image.cols - templ.cols + 1);
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;
matchTemplate_CCORR(image, templ, result, buf);
Context *clCxt = image.clCxt;
- std::string kernelName;
+ cv::String kernelName;
kernelName = "matchTemplate_Prepared_CCOFF";
size_t globalThreads[3] = {result.cols, result.rows, 1};
float scale = 1.f / templ.size().area();
Context *clCxt = image.clCxt;
- std::string kernelName;
+ cv::String kernelName;
kernelName = "matchTemplate_Prepared_CCOFF_NORMED";
size_t globalThreads[3] = {result.cols, result.rows, 1};
int dstStep_in_pixel = dst.step1() / dst.oclchannels();
int pixel_end = dst.wholecols * dst.wholerows - 1;
Context *clCxt = dst.clCxt;
- std::string kernelName = "convertC3C4";
+ cv::String kernelName = "convertC3C4";
char compile_option[32];
switch(dst.depth())
{
int srcStep_in_pixel = src.step1() / src.oclchannels();
int pixel_end = src.wholecols * src.wholerows - 1;
Context *clCxt = src.clCxt;
- std::string kernelName = "convertC4C3";
+ cv::String kernelName = "convertC4C3";
char compile_option[32];
switch(src.depth())
{
///////////////////////////////////////////////////////////////////////////
////////////////////////////////// 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 &&
src.rows == dst.rows && src.cols == dst.cols
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"},
{"uchar3", "char3", "ushort3", "short3", "int3", "float3", "double3"},
{"uchar4", "char4", "ushort4", "short4", "int4", "float4", "double4"}
///////////////////////////////////////////////////////////////////////////
static void convert_run(const oclMat &src, oclMat &dst, double alpha, double beta)
{
- std::string kernelName = "convert_to_S";
- std::stringstream idxStr;
+ cv::String kernelName = "convert_to_S";
+ cv::Stringstream idxStr;
idxStr << src.depth();
kernelName += idxStr.str();
float alpha_f = alpha, beta_f = beta;
setTo(s);
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;
#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);
std::vector<std::pair<size_t , const void *> > args;
}
// 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,
int depth, char *build_options, FLUSH_MODE finish_mode)
{
//construct kernel name
//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)
- std::stringstream idxStr;
+ cv::Stringstream idxStr;
if(channels != -1)
idxStr << "_C" << channels;
if(depth != -1)
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],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, FLUSH_MODE finish_mode)
{
openCLExecuteKernel2(clCxt, source, kernelName, globalThreads, localThreads, args,
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],
std::vector< std::pair<size_t, const void *> > &args, int channels, int depth, char *build_options, FLUSH_MODE finish_mode)
//int channels = dst.channels();
//int depth = dst.depth();
- std::string kernelName = "pyrDown";
+ cv::String kernelName = "pyrDown";
//int vector_lengths[4][7] = {{4, 0, 4, 4, 1, 1, 1},
// {4, 0, 4, 4, 1, 1, 1},
///////////////////////////////////////////////////////////////////////////
static void convert_run_cus(const oclMat &src, oclMat &dst, double alpha, double beta)
{
- std::string kernelName = "convert_to_S";
- std::stringstream idxStr;
+ cv::String kernelName = "convert_to_S";
+ cv::Stringstream idxStr;
idxStr << src.depth();
kernelName += idxStr.str();
float alpha_f = (float)alpha, beta_f = (float)beta;
// setTo(s);
// 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;
///////////////////////////////////////////////////////////////////////////
////////////////////////////////// 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 &&
// src.rows == dst.rows && src.cols == dst.cols
// 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"},
// {"uchar3", "char3", "ushort3", "short3", "int3", "float3", "double3"},
// {"uchar4", "char4", "ushort4", "short4", "int4", "float4", "double4"}
// }
// }
-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)
{
Context *clCxt = src.clCxt;
- std::string kernelName = "pyrDown";
+ cv::String kernelName = "pyrDown";
size_t localThreads[3] = { 256, 1, 1 };
size_t globalThreads[3] = { src.cols, dst.rows, 1};
{
Context *clCxt = I.clCxt;
int elemCntPerRow = I.step / I.elemSize();
- std::string kernelName = "lkSparse";
+ cv::String kernelName = "lkSparse";
bool isImageSupported = support_image2d();
size_t localThreads[3] = { 8, isImageSupported ? 8 : 32, 1 };
size_t globalThreads[3] = { 8 * ptcount, isImageSupported ? 8 : 32, 1};
bool isImageSupported = support_image2d();
int elemCntPerRow = I.step / I.elemSize();
- std::string kernelName = "lkDense";
+ cv::String kernelName = "lkDense";
size_t localThreads[3] = { 16, 16, 1 };
size_t globalThreads[3] = { I.cols, I.rows, 1};
Context *clCxt = src.clCxt;
- const std::string kernelName = "pyrUp";
+ const cv::String kernelName = "pyrUp";
std::vector< std::pair<size_t, const void *> > args;
args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src.data));
// int channels = mat_dst.oclchannels();
// 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},
// {4, 4, 2, 2, 1, 1, 1},
int channels = mat_dst.oclchannels();
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},
{2, 2, 1, 1, 1, 1, 1},
// int channels = mat_src.oclchannels();
// 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},
// {8, 8, 8, 8, 4, 4, 2},
int channels = mat_src.oclchannels();
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},
{4, 4, 2, 2, 1, 1, 1},
{
Context *clCxt = input.clCxt;
- std::string kernelName = "prefilter_xsobel";
+ cv::String kernelName = "prefilter_xsobel";
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName);
size_t blockSize = 1;
Context *clCxt = left.clCxt;
- std::string kernelName = "stereoKernel";
+ cv::String kernelName = "stereoKernel";
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName);
disp.setTo(Scalar_<unsigned char>::all(0));
{
Context *clCxt = left.clCxt;
- std::string kernelName = "textureness_kernel";
+ cv::String kernelName = "textureness_kernel";
cl_kernel kernel = openCLGetKernelFromSource(clCxt, &stereobm, kernelName);
size_t blockSize = 1;
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);
private:
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);
// ========================================================================== //
CV_WRAP virtual int totalChannels() 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);
};
// ========================================================================== //
virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth) = 0;
virtual void setRejectThresholds(OutputArray thresholds) = 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);
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);
if (featureTypeStr == "ICF") featureTypeStr = "HOG6MagLuv";
typedef std::vector<SOctave>::iterator octIt_t;
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
{
static const char *const FEATURE_FORMAT = "featureFormat";
// 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);
- std::string fformat = (std::string)root[FEATURE_FORMAT];
+ cv::String fformat = (cv::String)root[FEATURE_FORMAT];
bool useBoxes = (fformat == "BOX");
// 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);
origObjWidth = (int)root[SC_ORIG_W];
static const char *const SC_F_RECT = "rect";
// 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);
// 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);
int origWidth = (int)root[SC_ORIG_W];
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");
ushort shrinkage = cv::saturate_cast<ushort>((int)root[SC_SHRINKAGE]);
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 (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 << "}";
}
virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth);
virtual void setRejectThresholds(OutputArray thresholds);
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:
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(),
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());
}
using namespace cv::softcascade;
-typedef vector<string> svector;
+typedef vector<cv::String> svector;
class ScaledDataset : public Dataset
{
public:
// Auxiliary functions
// 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);
std::vector<int> CV_EXPORTS leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
#include <android/log.h>
#define LOG_STITCHING_MSG(msg) \
do { \
- std::stringstream _os; \
+ cv::Stringstream _os; \
_os << msg; \
__android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \
} while(0);
//////////////////////////////////////////////////////////////////////////////
-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)
{
std::stringstream str;
std::pair<int,int> edge = *itr;
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("/\\");
- 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);
- std::string name_dst = pathes[edge.second];
+ cv::String name_dst = pathes[edge.second];
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);
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()
<< ", Ni=" << pairwise_matches[pos].num_inliers
<< ", C=" << pairwise_matches[pos].confidence << "\"];\n";
{
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("/\\");
- 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);
- str << "\"" << name << "\";\n";
+ str << "\"" << name.c_str() << "\";\n";
}
}
str << "}";
- return str.str();
+ return str.str().c_str();
}
std::vector<int> leaveBiggestComponent(std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty();
- CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const std::string& fileName);
- CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_GPU(const std::string& fileName);
+ CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const cv::String& fileName);
+ CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_GPU(const cv::String& fileName);
CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0);
class VideoFrameSource : public CaptureFrameSource
{
public:
- VideoFrameSource(const std::string& fileName);
+ VideoFrameSource(const cv::String& fileName);
void reset();
private:
- std::string fileName_;
+ cv::String fileName_;
};
- VideoFrameSource::VideoFrameSource(const std::string& fileName) : fileName_(fileName)
+ VideoFrameSource::VideoFrameSource(const cv::String& fileName) : fileName_(fileName)
{
reset();
}
}
}
-Ptr<FrameSource> cv::superres::createFrameSource_Video(const std::string& fileName)
+Ptr<FrameSource> cv::superres::createFrameSource_Video(const cv::String& fileName)
{
return new VideoFrameSource(fileName);
}
class VideoFrameSource_GPU : public FrameSource
{
public:
- VideoFrameSource_GPU(const std::string& fileName);
+ VideoFrameSource_GPU(const cv::String& fileName);
void nextFrame(OutputArray frame);
void reset();
private:
- std::string fileName_;
+ cv::String fileName_;
VideoReader_GPU reader_;
GpuMat frame_;
};
- VideoFrameSource_GPU::VideoFrameSource_GPU(const std::string& fileName) : fileName_(fileName)
+ VideoFrameSource_GPU::VideoFrameSource_GPU(const cv::String& fileName) : fileName_(fileName)
{
reset();
}
}
}
-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);
}
virtual void read(const FileNode& fn)
{
- CV_Assert( (std::string)fn["name"] == name_ );
+ CV_Assert( (cv::String)fn["name"] == name_ );
history = (int)fn["history"];
nmixtures = (int)fn["nmixtures"];
backgroundRatio = (double)fn["backgroundRatio"];
double varThreshold;
double backgroundRatio;
double noiseSigma;
- std::string name_;
+ cv::String name_;
};
virtual void read(const FileNode& fn)
{
- CV_Assert( (std::string)fn["name"] == name_ );
+ CV_Assert( (cv::String)fn["name"] == name_ );
history = (int)fn["history"];
nmixtures = (int)fn["nmixtures"];
backgroundRatio = (float)fn["backgroundRatio"];
//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.
- std::string name_;
+ cv::String name_;
};
struct GaussBGStatModel2Params
virtual void read(const FileNode& fn)
{
- CV_Assert( (std::string)fn["name"] == name_ );
+ CV_Assert( (cv::String)fn["name"] == name_ );
maxFeatures = (int)fn["maxFeatures"];
learningRate = (double)fn["defaultLearningRate"];
numInitializationFrames = (int)fn["numFrames"];
Size frameSize_;
int frameNum_;
- std::string name_;
+ cv::String name_;
Mat_<int> nfeatures_;
Mat_<unsigned int> colors_;
class CV_EXPORTS VideoFileSource : public IFrameSource
{
public:
- VideoFileSource(const std::string &path, bool volatileFrame = false);
+ VideoFileSource(const cv::String &path, bool volatileFrame = false);
virtual void reset();
virtual Mat nextFrame();
class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase
{
public:
- FromFileMotionReader(const std::string &path);
+ FromFileMotionReader(const cv::String &path);
virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase
{
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 MotionModel motionModel() const { return motionEstimator_->motionModel(); }
class VideoFileSourceImpl : public IFrameSource
{
public:
- VideoFileSourceImpl(const std::string &path, bool volatileFrame)
+ VideoFileSourceImpl(const cv::String &path, bool volatileFrame)
: path_(path), volatileFrame_(volatileFrame) { reset(); }
virtual void reset()
vc.release();
vc.open(path_);
if (!vc.isOpened())
- throw std::runtime_error("can't open file: " + path_);
+ CV_Error(0, "can't open file: " + path_);
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without video I/O support");
#endif
#endif
private:
- std::string path_;
+ cv::String path_;
bool volatileFrame_;
#ifdef HAVE_OPENCV_HIGHGUI
VideoCapture vc;
}//namespace
-VideoFileSource::VideoFileSource(const std::string &path, bool volatileFrame)
+VideoFileSource::VideoFileSource(const cv::String &path, bool volatileFrame)
: impl(new VideoFileSourceImpl(path, volatileFrame)) {}
void VideoFileSource::reset() { impl->reset(); }
}
-FromFileMotionReader::FromFileMotionReader(const std::string &path)
+FromFileMotionReader::FromFileMotionReader(const cv::String &path)
: ImageMotionEstimatorBase(MM_UNKNOWN)
{
file_.open(path.c_str());
}
-ToFileMotionWriter::ToFileMotionWriter(const std::string &path, Ptr<ImageMotionEstimatorBase> estimator)
+ToFileMotionWriter::ToFileMotionWriter(const cv::String &path, Ptr<ImageMotionEstimatorBase> estimator)
: ImageMotionEstimatorBase(estimator->motionModel()), motionEstimator_(estimator)
{
file_.open(path.c_str());