hopefully, fixed crash in sparse mat test
This commit is contained in:
parent
66eb270cf7
commit
4a9b244577
@ -4816,7 +4816,8 @@ void SparseMat::copyTo( SparseMat& m ) const
|
|||||||
void SparseMat::copyTo( Mat& m ) const
|
void SparseMat::copyTo( Mat& m ) const
|
||||||
{
|
{
|
||||||
CV_Assert( hdr );
|
CV_Assert( hdr );
|
||||||
m.create( dims(), hdr->size, type() );
|
int ndims = dims();
|
||||||
|
m.create( ndims, hdr->size, type() );
|
||||||
m = Scalar(0);
|
m = Scalar(0);
|
||||||
|
|
||||||
SparseMatConstIterator from = begin();
|
SparseMatConstIterator from = begin();
|
||||||
@ -4825,7 +4826,7 @@ void SparseMat::copyTo( Mat& m ) const
|
|||||||
for( i = 0; i < N; i++, ++from )
|
for( i = 0; i < N; i++, ++from )
|
||||||
{
|
{
|
||||||
const Node* n = from.node();
|
const Node* n = from.node();
|
||||||
copyElem( from.ptr, m.ptr(n->idx), esz);
|
copyElem( from.ptr, (ndims > 1 ? m.ptr(n->idx) : m.ptr(n->idx[0])), esz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user