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

Function icvWriteMat

deps/opencv/modules/core/src/persistence.cpp:3531–3562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3529}
3530
3531static void
3532icvWriteMat( CvFileStorage* fs, const char* name,
3533 const void* struct_ptr, CvAttrList /*attr*/ )
3534{
3535 const CvMat* mat = (const CvMat*)struct_ptr;
3536 char dt[16];
3537 CvSize size;
3538 int y;
3539
3540 assert( CV_IS_MAT_HDR_Z(mat) );
3541
3542 cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_MAT );
3543 cvWriteInt( fs, "rows", mat->rows );
3544 cvWriteInt( fs, "cols", mat->cols );
3545 cvWriteString( fs, "dt", icvEncodeFormat( CV_MAT_TYPE(mat->type), dt ), 0 );
3546 cvStartWriteStruct( fs, "data", CV_NODE_SEQ + CV_NODE_FLOW );
3547
3548 size = cvGetSize(mat);
3549 if( size.height > 0 && size.width > 0 && mat->data.ptr )
3550 {
3551 if( CV_IS_MAT_CONT(mat->type) )
3552 {
3553 size.width *= size.height;
3554 size.height = 1;
3555 }
3556
3557 for( y = 0; y < size.height; y++ )
3558 cvWriteRawData( fs, mat->data.ptr + (size_t)y*mat->step, size.width, dt );
3559 }
3560 cvEndWriteStruct( fs );
3561 cvEndWriteStruct( fs );
3562}
3563
3564
3565static int

Callers

nothing calls this directly

Calls 7

cvStartWriteStructFunction · 0.85
cvWriteIntFunction · 0.85
cvWriteStringFunction · 0.85
icvEncodeFormatFunction · 0.85
cvGetSizeFunction · 0.85
cvWriteRawDataFunction · 0.85
cvEndWriteStructFunction · 0.85

Tested by

no test coverage detected