Merge pull request #1297 from SpecLad:merge-2.4
This commit is contained in:
@@ -406,6 +406,59 @@ CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat = Ma
|
||||
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat = SparseMat() );
|
||||
CV_EXPORTS void read(const FileNode& node, std::vector<KeyPoint>& keypoints);
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 2 ? default_value : Point_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Point3_<_Tp>& value, const Point3_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 3 ? default_value : Point3_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
|
||||
saturate_cast<_Tp>(temp[2]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Size_<_Tp>& value, const Size_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 2 ? default_value : Size_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Complex<_Tp>& value, const Complex<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 2 ? default_value : Complex<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Rect_<_Tp>& value, const Rect_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
|
||||
saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
|
||||
}
|
||||
|
||||
template<typename _Tp, int cn> static inline void read(const FileNode& node, Vec<_Tp, cn>& value, const Vec<_Tp, cn>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != cn ? default_value : Vec<_Tp, cn>(&temp[0]);
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Scalar_<_Tp>& value, const Scalar_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 4 ? default_value : Scalar_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
|
||||
saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
|
||||
}
|
||||
|
||||
static inline void read(const FileNode& node, Range& value, const Range& default_value)
|
||||
{
|
||||
Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end);
|
||||
read(node, temp, default_temp);
|
||||
value.start = temp.x; value.end = temp.y;
|
||||
}
|
||||
|
||||
|
||||
CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str);
|
||||
|
||||
|
||||
|
@@ -56,6 +56,9 @@
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
||||
#define CVAUX_STRW_EXP(__A) L#__A
|
||||
#define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A)
|
||||
|
||||
#if CV_VERSION_REVISION
|
||||
# define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION)
|
||||
#else
|
||||
|
Reference in New Issue
Block a user