From 18ab16dbd32ce2f3b09717de9f978cdb17dd88c6 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Tue, 16 Oct 2012 19:35:28 +0400 Subject: [PATCH] Revert "some more fixes towards binary compatibility" This reverts commit a8c5e356199057538d65b7fbd8db573f96089089. Conflicts: modules/imgproc/src/imgwarp.cpp --- modules/core/include/opencv2/core/core.hpp | 25 ++++---------- modules/core/src/algorithm.cpp | 34 +++---------------- .../include/opencv2/features2d/features2d.hpp | 2 +- modules/ml/include/opencv2/ml/ml.hpp | 3 +- modules/ml/src/data.cpp | 2 +- 5 files changed, 14 insertions(+), 52 deletions(-) diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp index 3493beca9..17bc065f1 100644 --- a/modules/core/include/opencv2/core/core.hpp +++ b/modules/core/include/opencv2/core/core.hpp @@ -1400,7 +1400,7 @@ public: virtual bool fixedType() const; virtual bool needed() const; virtual Mat& getMatRef(int i=-1) const; - /*virtual*/ gpu::GpuMat& getGpuMatRef() const; + virtual gpu::GpuMat& getGpuMatRef() const; virtual void create(Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; virtual void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; virtual void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; @@ -2146,7 +2146,7 @@ CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst); //! copies each plane of a multi-channel array to a dedicated array CV_EXPORTS void split(const Mat& src, Mat* mvbegin); -CV_EXPORTS void split(const Mat& m, vector& mv ); +CV_EXPORTS void split(const Mat& src, vector& mv ); //! copies each plane of a multi-channel array to a dedicated array CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv); @@ -4407,11 +4407,6 @@ public: int (Algorithm::*getter)()=0, void (Algorithm::*setter)(int)=0, const string& help=string()); - void addParam(Algorithm& algo, const char* name, - short& value, bool readOnly=false, - int (Algorithm::*getter)()=0, - void (Algorithm::*setter)(int)=0, - const string& help=string()); void addParam(Algorithm& algo, const char* name, bool& value, bool readOnly=false, int (Algorithm::*getter)()=0, @@ -4461,7 +4456,7 @@ protected: struct CV_EXPORTS Param { - enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7, UNSIGNED_INT=8, UINT64=9, SHORT=10 }; + enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7, UNSIGNED_INT=8, UINT64=9 }; Param(); Param(int _type, bool _readonly, int _offset, @@ -4492,14 +4487,6 @@ template<> struct ParamType enum { type = Param::INT }; }; -template<> struct ParamType -{ - typedef int const_param_type; - typedef int member_type; - - enum { type = Param::SHORT }; -}; - template<> struct ParamType { typedef double const_param_type; @@ -4570,8 +4557,8 @@ template<> struct ParamType class CV_EXPORTS CommandLineParser { public: - CommandLineParser(int argc, const char* const argv[], const char* key_map); - CommandLineParser(int argc, const char* const argv[], const string& key_map); + CommandLineParser(int argc, const char* const argv[], const char* keys); + CommandLineParser(int argc, const char* const argv[], const string& keys); CommandLineParser(const CommandLineParser& parser); CommandLineParser& operator = (const CommandLineParser& parser); @@ -4593,7 +4580,7 @@ public: return val; } - bool has(const string& keys); + bool has(const string& name); bool check() const; void about(const string& message); diff --git a/modules/core/src/algorithm.cpp b/modules/core/src/algorithm.cpp index 39b4743cb..3fedfaa48 100644 --- a/modules/core/src/algorithm.cpp +++ b/modules/core/src/algorithm.cpp @@ -456,27 +456,18 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL ) { - CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN || - (p->type == Param::SHORT && argType == Param::INT) ); + CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN ); if( p->type == Param::INT ) { int val = argType == Param::INT ? *(const int*)value : - argType == Param::BOOLEAN ? (int)*(const bool*)value : - saturate_cast(*(const double*)value); + argType == Param::BOOLEAN ? (int)*(const bool*)value : + saturate_cast(*(const double*)value); if( p->setter ) (algo->*f.set_int)(val); else *(int*)((uchar*)algo + p->offset) = val; } - else if( p->type == Param::SHORT ) - { - int val = *(const int*)value; - if( p->setter ) - (algo->*f.set_int)(val); - else - *(short*)((uchar*)algo + p->offset) = (short)val; - } else if( p->type == Param::BOOLEAN ) { bool val = argType == Param::INT ? *(const int*)value != 0 : @@ -563,13 +554,6 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp else *(double*)value = val; } - else if( p->type == Param::SHORT ) - { - CV_Assert( argType == Param::INT ); - int val = p->getter ? (algo->*f.get_int)() : *(short*)((uchar*)algo + p->offset); - - *(int*)value = val; - } else if( p->type == Param::BOOLEAN ) { CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL ); @@ -655,7 +639,7 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argTyp CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL || argType == Param::STRING || argType == Param::MAT || argType == Param::MAT_VECTOR || - argType == Param::ALGORITHM || argType == Param::SHORT ); + argType == Param::ALGORITHM ); data->params.add(string(parameter), Param(argType, readOnly, (int)((size_t)value - (size_t)(void*)&algo), getter, setter, help)); @@ -672,16 +656,6 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, (Algorithm::Getter)getter, (Algorithm::Setter)setter, help); } -void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, - short& value, bool readOnly, - int (Algorithm::*getter)(), - void (Algorithm::*setter)(int), - const string& help) -{ - addParam_(algo, parameter, ParamType::type, &value, readOnly, - (Algorithm::Getter)getter, (Algorithm::Setter)setter, help); -} - void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, bool& value, bool readOnly, int (Algorithm::*getter)(), diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 0b6d884b5..375c861c1 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -586,7 +586,7 @@ protected: int threshold; bool nonmaxSuppression; - short type; + int type; }; diff --git a/modules/ml/include/opencv2/ml/ml.hpp b/modules/ml/include/opencv2/ml/ml.hpp index d6246be44..eaa4bde7a 100644 --- a/modules/ml/include/opencv2/ml/ml.hpp +++ b/modules/ml/include/opencv2/ml/ml.hpp @@ -2069,7 +2069,6 @@ protected: char delimiter; char miss_ch; - short header_lines_number; //char flt_separator; CvMat* values; @@ -2094,6 +2093,8 @@ protected: int* sample_idx; // data of train_sample_idx and test_sample_idx cv::RNG* rng; + + int header_lines_number; }; diff --git a/modules/ml/src/data.cpp b/modules/ml/src/data.cpp index 9894591e1..01d51daee 100644 --- a/modules/ml/src/data.cpp +++ b/modules/ml/src/data.cpp @@ -121,7 +121,7 @@ void CvMLData::clear() void CvMLData::set_header_lines_number( int idx ) { - header_lines_number = (short)std::max(0, idx); + header_lines_number = std::max(0, idx); } int CvMLData::get_header_lines_number() const