Commit 1307bb1d authored by Maksim Shabunin's avatar Maksim Shabunin

Merge pull request #6314 from mvukad:bugfix_dtreeswrite

parents 2b29db86 695e33b2
......@@ -1225,6 +1225,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "minDisparity" << params.minDisparity
<< "numDisparities" << params.numDisparities
......
......@@ -1512,6 +1512,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "minDisparity" << params.minDisparity
<< "numDisparities" << params.numDisparities
......
......@@ -3067,6 +3067,9 @@ public:
/** Returns the algorithm string identifier.
This string is used as top level xml/yml node tag when the object is saved to a file or string. */
CV_WRAP virtual String getDefaultName() const;
protected:
void writeFormat(FileStorage& fs) const;
};
struct Param {
......
......@@ -57,7 +57,6 @@ void Algorithm::save(const String& filename) const
{
FileStorage fs(filename, FileStorage::WRITE);
fs << getDefaultName() << "{";
fs << "format" << (int)3;
write(fs);
fs << "}";
}
......@@ -67,6 +66,11 @@ String Algorithm::getDefaultName() const
return String("my_object");
}
void Algorithm::writeFormat(FileStorage& fs) const
{
fs << "format" << (int)3;
}
}
/* End of file. */
......@@ -93,6 +93,7 @@ namespace
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << "Canny_CUDA"
<< "low_thresh" << low_thresh_
<< "high_thresh" << high_thresh_
......
......@@ -99,6 +99,7 @@ namespace
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << "HoughCirclesDetector_CUDA"
<< "dp" << dp_
<< "minDist" << minDist_
......
......@@ -95,6 +95,7 @@ namespace
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << "HoughLinesDetector_CUDA"
<< "rho" << rho_
<< "theta" << theta_
......
......@@ -98,6 +98,7 @@ namespace
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << "PHoughLinesDetector_CUDA"
<< "rho" << rho_
<< "theta" << theta_
......
......@@ -217,6 +217,7 @@ namespace cv
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "descriptor" << descriptor;
fs << "descriptor_channels" << descriptor_channels;
fs << "descriptor_size" << descriptor_size;
......
......@@ -184,6 +184,7 @@ void SimpleBlobDetectorImpl::read( const cv::FileNode& fn )
void SimpleBlobDetectorImpl::write( cv::FileStorage& fs ) const
{
writeFormat(fs);
params.write(fs);
}
......
......@@ -159,6 +159,7 @@ namespace cv
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "extended" << (int)extended;
fs << "upright" << (int)upright;
fs << "threshold" << threshold;
......
......@@ -1179,6 +1179,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
void FlannBasedMatcher::write( FileStorage& fs) const
{
writeFormat(fs);
fs << "indexParams" << "[";
if (indexParams)
......
......@@ -1151,6 +1151,7 @@ public:
return;
int i, l_count = layer_count();
writeFormat(fs);
fs << "layer_sizes" << layer_sizes;
write_params( fs );
......
......@@ -387,6 +387,7 @@ public:
if( roots.empty() )
CV_Error( CV_StsBadArg, "RTrees have not been trained" );
writeFormat(fs);
writeParams(fs);
int k, ntrees = (int)roots.size();
......
......@@ -770,6 +770,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "training_params" << "{";
write_params(fs);
fs << "}";
......
......@@ -466,6 +466,7 @@ public:
void write( FileStorage& fs ) const
{
writeFormat(fs);
impl->write(fs);
}
......
......@@ -578,6 +578,7 @@ void LogisticRegressionImpl::write(FileStorage& fs) const
{
CV_Error(CV_StsBadArg,"file can't open. Check file path");
}
writeFormat(fs);
string desc = "Logisitic Regression Classifier";
fs<<"classifier"<<desc.c_str();
fs<<"alpha"<<this->params.alpha;
......
......@@ -342,6 +342,7 @@ public:
{
int nclasses = (int)cls_labels.total(), i;
writeFormat(fs);
fs << "var_count" << (var_idx.empty() ? nallvars : (int)var_idx.total());
fs << "var_all" << nallvars;
......
......@@ -296,6 +296,7 @@ public:
if( roots.empty() )
CV_Error( CV_StsBadArg, "RTrees have not been trained" );
writeFormat(fs);
writeParams(fs);
fs << "oob_error" << oobError;
......
......@@ -2037,6 +2037,7 @@ public:
if( !isTrained() )
CV_Error( CV_StsParseError, "SVM model data is invalid, check sv_count, var_* and class_count tags" );
writeFormat(fs);
write_params( fs );
fs << "var_count" << var_count;
......
......@@ -364,6 +364,7 @@ void SVMSGDImpl::write(FileStorage& fs) const
if( !isTrained() )
CV_Error( CV_StsParseError, "SVMSGD model data is invalid, it hasn't been trained" );
writeFormat(fs);
writeParams( fs );
fs << "weights" << weights_;
......
......@@ -1681,6 +1681,7 @@ void DTreesImpl::writeTree( FileStorage& fs, int root ) const
void DTreesImpl::write( FileStorage& fs ) const
{
writeFormat(fs);
writeParams(fs);
writeTree(fs, roots[0]);
}
......
......@@ -184,6 +184,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "max_bits" << max_bits
<< "exclude_range" << exclude_range
......
......@@ -141,6 +141,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "samples" << samples
<< "lambda" << lambda
......@@ -250,6 +251,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "max_iter" << max_iter
<< "threshold" << threshold;
......
......@@ -265,6 +265,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "contrast_weight" << wcon
<< "saturation_weight" << wsat
......
......@@ -83,6 +83,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "gamma" << gamma;
}
......@@ -161,6 +162,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "gamma" << gamma
<< "bias" << bias
......@@ -242,6 +244,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "gamma" << gamma
<< "contrast" << contrast
......@@ -339,6 +342,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "gamma" << gamma
<< "intensity" << intensity
......@@ -446,6 +450,7 @@ public:
void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name
<< "gamma" << gamma
<< "scale" << scale
......
......@@ -79,6 +79,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "affine_type" << int(fullAffine);
}
......
......@@ -77,6 +77,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "distance" << distanceFlag
<< "rank" << rankProportion;
......
......@@ -99,6 +99,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "flag" << flag
<< "dummies" << nDummies
......@@ -224,6 +225,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "flag" << flag
<< "dummies" << nDummies
......@@ -350,6 +352,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "dummies" << nDummies
<< "default" << defaultCost;
......@@ -466,6 +469,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "dummies" << nDummies
<< "default" << defaultCost;
......
......@@ -137,6 +137,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "nRads" << nRadialBins
<< "nAngs" << nAngularBins
......
......@@ -81,6 +81,7 @@ public:
//! write/read
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "regularization" << regularizationParameter;
}
......
......@@ -183,6 +183,7 @@ public:
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "history" << history
<< "nsamples" << nN
......
......@@ -286,6 +286,7 @@ public:
virtual void write(FileStorage& fs) const
{
writeFormat(fs);
fs << "name" << name_
<< "history" << history
<< "nmixtures" << nmixtures
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment