MCPcopy Create free account
hub / github.com/creatale/node-dv / SparseMat

Method SparseMat

deps/opencv/modules/core/src/matrix.cpp:3624–3654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3622
3623
3624SparseMat::SparseMat(const Mat& m)
3625: flags(MAGIC_VAL), hdr(0)
3626{
3627 create( m.dims, m.size, m.type() );
3628
3629 int i, idx[CV_MAX_DIM] = {0}, d = m.dims, lastSize = m.size[d - 1];
3630 size_t esz = m.elemSize();
3631 uchar* dptr = m.data;
3632
3633 for(;;)
3634 {
3635 for( i = 0; i < lastSize; i++, dptr += esz )
3636 {
3637 if( isZeroElem(dptr, esz) )
3638 continue;
3639 idx[d-1] = i;
3640 uchar* to = newNode(idx, hash(idx));
3641 copyElem( dptr, to, esz );
3642 }
3643
3644 for( i = d - 2; i >= 0; i-- )
3645 {
3646 dptr += m.step[i] - m.size[i+1]*m.step[i+1];
3647 if( ++idx[i] < m.size[i] )
3648 break;
3649 idx[i] = 0;
3650 }
3651 if( i < 0 )
3652 break;
3653 }
3654}
3655
3656SparseMat::SparseMat(const CvSparseMat* m)
3657: flags(MAGIC_VAL), hdr(0)

Callers

nothing calls this directly

Calls 7

createFunction · 0.85
isZeroElemFunction · 0.85
copyElemFunction · 0.85
cvInitSparseMatIteratorFunction · 0.85
elemSizeFunction · 0.50
typeMethod · 0.45
elemSizeMethod · 0.45

Tested by

no test coverage detected