mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 14:06:27 +08:00
core: extend traits::Type / traits::Depth for compatible types
DMatch and Keypoint are not compatible types (mixed float/int fields)
This commit is contained in:
parent
72f789bf34
commit
7e12c879c2
@ -1911,9 +1911,9 @@ double CV_StereoCalibrationTest_C::calibrateStereoCamera( const vector<vector<Po
|
||||
}
|
||||
|
||||
Mat npoints( 1, nimages, CV_32S ),
|
||||
objPt( 1, total, DataType<Point3f>::type ),
|
||||
imgPt( 1, total, DataType<Point2f>::type ),
|
||||
imgPt2( 1, total, DataType<Point2f>::type );
|
||||
objPt( 1, total, traits::Type<Point3f>::value ),
|
||||
imgPt( 1, total, traits::Type<Point2f>::value ),
|
||||
imgPt2( 1, total, traits::Type<Point2f>::value );
|
||||
|
||||
Point2f* imgPtData2 = imgPt2.ptr<Point2f>();
|
||||
Point3f* objPtData = objPt.ptr<Point3f>();
|
||||
|
@ -153,15 +153,24 @@ namespace cv
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 16,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Affine3<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Affine3<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 16) }; };
|
||||
} // namespace
|
||||
|
||||
//! @} core
|
||||
|
||||
}
|
||||
@ -202,7 +211,7 @@ cv::Affine3<T>::Affine3(const Vec3& _rvec, const Vec3& t)
|
||||
template<typename T> inline
|
||||
cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
|
||||
{
|
||||
CV_Assert(data.type() == cv::DataType<T>::type);
|
||||
CV_Assert(data.type() == cv::traits::Type<T>::value);
|
||||
|
||||
if (data.cols == 4 && data.rows == 4)
|
||||
{
|
||||
@ -271,7 +280,7 @@ void cv::Affine3<T>::rotation(const Vec3& _rvec)
|
||||
template<typename T> inline
|
||||
void cv::Affine3<T>::rotation(const cv::Mat& data)
|
||||
{
|
||||
CV_Assert(data.type() == cv::DataType<T>::type);
|
||||
CV_Assert(data.type() == cv::traits::Type<T>::value);
|
||||
|
||||
if (data.cols == 3 && data.rows == 3)
|
||||
{
|
||||
@ -485,21 +494,21 @@ cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
|
||||
template<typename T> inline
|
||||
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
|
||||
{
|
||||
cv::Mat(4, 4, cv::DataType<T>::type, affine.matrix().data()).copyTo(matrix);
|
||||
cv::Mat(4, 4, cv::traits::Type<T>::value, affine.matrix().data()).copyTo(matrix);
|
||||
}
|
||||
|
||||
template<typename T> inline
|
||||
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
|
||||
{
|
||||
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
|
||||
cv::Mat(4, 4, cv::DataType<T>::type, a.matrix().data()).copyTo(matrix);
|
||||
cv::Mat(4, 4, cv::traits::Type<T>::value, a.matrix().data()).copyTo(matrix);
|
||||
}
|
||||
|
||||
template<typename T> inline
|
||||
cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
|
||||
{
|
||||
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
|
||||
cv::Mat hdr(4, 4, cv::DataType<T>::type, r.matrix().data());
|
||||
cv::Mat hdr(4, 4, cv::traits::Type<T>::value, r.matrix().data());
|
||||
cv::Mat(matrix, false).copyTo(hdr);
|
||||
return r;
|
||||
}
|
||||
|
@ -64,13 +64,13 @@ void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCo
|
||||
{
|
||||
if( !(src.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
Mat _src(src.cols(), src.rows(), DataType<_Tp>::type,
|
||||
Mat _src(src.cols(), src.rows(), traits::Type<_Tp>::value,
|
||||
(void*)src.data(), src.stride()*sizeof(_Tp));
|
||||
transpose(_src, dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mat _src(src.rows(), src.cols(), DataType<_Tp>::type,
|
||||
Mat _src(src.rows(), src.cols(), traits::Type<_Tp>::value,
|
||||
(void*)src.data(), src.stride()*sizeof(_Tp));
|
||||
_src.copyTo(dst);
|
||||
}
|
||||
@ -98,7 +98,7 @@ void cv2eigen( const Mat& src,
|
||||
CV_DbgAssert(src.rows == _rows && src.cols == _cols);
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
if( src.type() == _dst.type() )
|
||||
transpose(src, _dst);
|
||||
@ -112,7 +112,7 @@ void cv2eigen( const Mat& src,
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
src.convertTo(_dst, _dst.type());
|
||||
}
|
||||
@ -125,13 +125,13 @@ void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
|
||||
{
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(_cols, _rows, DataType<_Tp>::type,
|
||||
const Mat _dst(_cols, _rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
transpose(src, _dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(_rows, _cols, DataType<_Tp>::type,
|
||||
const Mat _dst(_rows, _cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
Mat(src).copyTo(_dst);
|
||||
}
|
||||
@ -144,7 +144,7 @@ void cv2eigen( const Mat& src,
|
||||
dst.resize(src.rows, src.cols);
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
if( src.type() == _dst.type() )
|
||||
transpose(src, _dst);
|
||||
@ -158,7 +158,7 @@ void cv2eigen( const Mat& src,
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
src.convertTo(_dst, _dst.type());
|
||||
}
|
||||
@ -172,13 +172,13 @@ void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
|
||||
dst.resize(_rows, _cols);
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(_cols, _rows, DataType<_Tp>::type,
|
||||
const Mat _dst(_cols, _rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
transpose(src, _dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(_rows, _cols, DataType<_Tp>::type,
|
||||
const Mat _dst(_rows, _cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
Mat(src).copyTo(_dst);
|
||||
}
|
||||
@ -193,7 +193,7 @@ void cv2eigen( const Mat& src,
|
||||
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
if( src.type() == _dst.type() )
|
||||
transpose(src, _dst);
|
||||
@ -202,7 +202,7 @@ void cv2eigen( const Mat& src,
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
src.convertTo(_dst, _dst.type());
|
||||
}
|
||||
@ -217,13 +217,13 @@ void cv2eigen( const Matx<_Tp, _rows, 1>& src,
|
||||
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(1, _rows, DataType<_Tp>::type,
|
||||
const Mat _dst(1, _rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
transpose(src, _dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(_rows, 1, DataType<_Tp>::type,
|
||||
const Mat _dst(_rows, 1, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
src.copyTo(_dst);
|
||||
}
|
||||
@ -238,7 +238,7 @@ void cv2eigen( const Mat& src,
|
||||
dst.resize(src.cols);
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||
const Mat _dst(src.cols, src.rows, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
if( src.type() == _dst.type() )
|
||||
transpose(src, _dst);
|
||||
@ -247,7 +247,7 @@ void cv2eigen( const Mat& src,
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||
const Mat _dst(src.rows, src.cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
src.convertTo(_dst, _dst.type());
|
||||
}
|
||||
@ -261,13 +261,13 @@ void cv2eigen( const Matx<_Tp, 1, _cols>& src,
|
||||
dst.resize(_cols);
|
||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||
{
|
||||
const Mat _dst(_cols, 1, DataType<_Tp>::type,
|
||||
const Mat _dst(_cols, 1, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
transpose(src, _dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Mat _dst(1, _cols, DataType<_Tp>::type,
|
||||
const Mat _dst(1, _cols, traits::Type<_Tp>::value,
|
||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||
Mat(src).copyTo(_dst);
|
||||
}
|
||||
|
@ -1666,7 +1666,7 @@ public:
|
||||
inv_scale = 1.f/alpha_scale;
|
||||
|
||||
CV_Assert( src1.type() == src2.type() &&
|
||||
src1.type() == CV_MAKETYPE(DataType<T>::depth, 4) &&
|
||||
src1.type() == CV_MAKETYPE(traits::Depth<T>::value, 4) &&
|
||||
src1.size() == src2.size());
|
||||
Size size = src1.size();
|
||||
dst.create(size, src1.type());
|
||||
@ -1946,7 +1946,7 @@ public:
|
||||
inv_scale = 1.f/alpha_scale;
|
||||
|
||||
CV_Assert( src1.type() == src2.type() &&
|
||||
src1.type() == DataType<VT>::type &&
|
||||
src1.type() == traits::Type<VT>::value &&
|
||||
src1.size() == src2.size());
|
||||
Size size = src1.size();
|
||||
dst.create(size, src1.type());
|
||||
|
@ -1665,7 +1665,7 @@ void Mat_<_Tp>::release()
|
||||
{
|
||||
Mat::release();
|
||||
#ifdef _DEBUG
|
||||
flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
|
||||
flags = (flags & ~CV_MAT_TYPE_MASK) | traits::Type<_Tp>::value;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,23 @@ public:
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 2,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels) };
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Complex<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Complex<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; };
|
||||
} // namespace
|
||||
|
||||
|
||||
//////////////////////////////// Point_ ////////////////////////////////
|
||||
@ -190,15 +199,23 @@ public:
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 2,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Point_<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Point_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; };
|
||||
} // namespace
|
||||
|
||||
|
||||
//////////////////////////////// Point3_ ////////////////////////////////
|
||||
@ -261,16 +278,23 @@ public:
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 3,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Point3_<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Point3_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 3) }; };
|
||||
} // namespace
|
||||
|
||||
//////////////////////////////// Size_ ////////////////////////////////
|
||||
|
||||
@ -324,16 +348,23 @@ public:
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 2,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Size_<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Size_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 2) }; };
|
||||
} // namespace
|
||||
|
||||
//////////////////////////////// Rect_ ////////////////////////////////
|
||||
|
||||
@ -427,16 +458,23 @@ public:
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 4,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Rect_<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Rect_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 4) }; };
|
||||
} // namespace
|
||||
|
||||
///////////////////////////// RotatedRect /////////////////////////////
|
||||
|
||||
@ -505,15 +543,23 @@ public:
|
||||
typedef float channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = (int)sizeof(value_type)/sizeof(channel_type), // 5
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<>
|
||||
struct Depth< RotatedRect > { enum { value = Depth<float>::value }; };
|
||||
template<>
|
||||
struct Type< RotatedRect > { enum { value = CV_MAKETYPE(Depth<float>::value, (int)sizeof(RotatedRect)/sizeof(float)) }; };
|
||||
} // namespace
|
||||
|
||||
|
||||
//////////////////////////////// Range /////////////////////////////////
|
||||
@ -561,15 +607,23 @@ public:
|
||||
typedef int channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 2,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<>
|
||||
struct Depth< Range > { enum { value = Depth<int>::value }; };
|
||||
template<>
|
||||
struct Type< Range > { enum { value = CV_MAKETYPE(Depth<int>::value, 2) }; };
|
||||
} // namespace
|
||||
|
||||
|
||||
//////////////////////////////// Scalar_ ///////////////////////////////
|
||||
@ -617,15 +671,23 @@ public:
|
||||
typedef _Tp channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = 4,
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<typename _Tp>
|
||||
struct Depth< Scalar_<_Tp> > { enum { value = Depth<_Tp>::value }; };
|
||||
template<typename _Tp>
|
||||
struct Type< Scalar_<_Tp> > { enum { value = CV_MAKETYPE(Depth<_Tp>::value, 4) }; };
|
||||
} // namespace
|
||||
|
||||
|
||||
/////////////////////////////// KeyPoint ////////////////////////////////
|
||||
@ -712,6 +774,7 @@ public:
|
||||
CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
|
||||
};
|
||||
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
template<> class DataType<KeyPoint>
|
||||
{
|
||||
public:
|
||||
@ -728,7 +791,7 @@ public:
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////// DMatch /////////////////////////////////
|
||||
@ -755,6 +818,7 @@ public:
|
||||
bool operator<(const DMatch &m) const;
|
||||
};
|
||||
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
template<> class DataType<DMatch>
|
||||
{
|
||||
public:
|
||||
@ -771,7 +835,7 @@ public:
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////// TermCriteria //////////////////////////////
|
||||
@ -885,15 +949,24 @@ public:
|
||||
typedef double channel_type;
|
||||
|
||||
enum { generic_type = 0,
|
||||
depth = DataType<channel_type>::depth,
|
||||
channels = (int)(sizeof(value_type)/sizeof(channel_type)), // 24
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8),
|
||||
type = CV_MAKETYPE(depth, channels)
|
||||
fmt = DataType<channel_type>::fmt + ((channels - 1) << 8)
|
||||
#ifdef OPENCV_TRAITS_ENABLE_DEPRECATED
|
||||
,depth = DataType<channel_type>::depth
|
||||
,type = CV_MAKETYPE(depth, channels)
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Vec<channel_type, channels> vec_type;
|
||||
};
|
||||
|
||||
namespace traits {
|
||||
template<>
|
||||
struct Depth< Moments > { enum { value = Depth<double>::value }; };
|
||||
template<>
|
||||
struct Type< Moments > { enum { value = CV_MAKETYPE(Depth<double>::value, (int)(sizeof(Moments)/sizeof(double))) }; };
|
||||
} // namespace
|
||||
|
||||
//! @} imgproc_shape
|
||||
|
||||
//! @cond IGNORED
|
||||
|
Loading…
Reference in New Issue
Block a user