Merge pull request #1277 from NCBee:2.4
This commit is contained in:
@@ -3001,6 +3001,58 @@ static inline void read(const FileNode& node, string& value, const string& defau
|
||||
value = !node.node ? default_value : CV_NODE_IS_STRING(node.node->tag) ? string(node.node->data.str.ptr) : string("");
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
|
||||
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat=SparseMat() );
|
||||
|
||||
|
Reference in New Issue
Block a user