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

Method convertTo

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

Source from the content-addressed store, hash-verified

3733
3734
3735void SparseMat::convertTo( SparseMat& m, int rtype, double alpha ) const
3736{
3737 int cn = channels();
3738 if( rtype < 0 )
3739 rtype = type();
3740 rtype = CV_MAKETYPE(rtype, cn);
3741 if( hdr == m.hdr && rtype != type() )
3742 {
3743 SparseMat temp;
3744 convertTo(temp, rtype, alpha);
3745 m = temp;
3746 return;
3747 }
3748
3749 CV_Assert(hdr != 0);
3750 if( hdr != m.hdr )
3751 m.create( hdr->dims, hdr->size, rtype );
3752
3753 SparseMatConstIterator from = begin();
3754 size_t i, N = nzcount();
3755
3756 if( alpha == 1 )
3757 {
3758 ConvertData cvtfunc = getConvertElem(type(), rtype);
3759 for( i = 0; i < N; i++, ++from )
3760 {
3761 const Node* n = from.node();
3762 uchar* to = hdr == m.hdr ? from.ptr : m.newNode(n->idx, n->hashval);
3763 cvtfunc( from.ptr, to, cn );
3764 }
3765 }
3766 else
3767 {
3768 ConvertScaleData cvtfunc = getConvertScaleElem(type(), rtype);
3769 for( i = 0; i < N; i++, ++from )
3770 {
3771 const Node* n = from.node();
3772 uchar* to = hdr == m.hdr ? from.ptr : m.newNode(n->idx, n->hashval);
3773 cvtfunc( from.ptr, to, cn, alpha, 0 );
3774 }
3775 }
3776}
3777
3778
3779void SparseMat::convertTo( Mat& m, int rtype, double alpha, double beta ) const

Callers 2

reduceMethod · 0.45
normalizeFunction · 0.45

Calls 9

getConvertElemFunction · 0.85
getConvertScaleElemFunction · 0.85
nodeMethod · 0.80
newNodeMethod · 0.80
convertToFunction · 0.70
channelsFunction · 0.50
typeFunction · 0.50
createMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected