mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
add API to reinterpret Mat type
This commit is contained in:
@@ -1261,6 +1261,16 @@ Mat Mat::reshape(int _cn, const std::vector<int>& _newshape) const
|
||||
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
|
||||
}
|
||||
|
||||
Mat Mat::reinterpret(int type) const
|
||||
{
|
||||
type = CV_MAT_TYPE(type);
|
||||
CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
|
||||
Mat m = *this;
|
||||
m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
|
||||
m.updateContinuityFlag();
|
||||
return m;
|
||||
}
|
||||
|
||||
Mat Mat::diag(const Mat& d)
|
||||
{
|
||||
CV_Assert( d.cols == 1 || d.rows == 1 );
|
||||
|
||||
Reference in New Issue
Block a user