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

Function cvWriteRawData

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

Source from the content-addressed store, hash-verified

3123
3124
3125CV_IMPL void
3126cvWriteRawData( CvFileStorage* fs, const void* _data, int len, const char* dt )
3127{
3128 const char* data0 = (const char*)_data;
3129 int offset = 0;
3130 int fmt_pairs[CV_FS_MAX_FMT_PAIRS*2], k, fmt_pair_count;
3131 char buf[256] = "";
3132
3133 CV_CHECK_OUTPUT_FILE_STORAGE( fs );
3134
3135 if( len < 0 )
3136 CV_Error( CV_StsOutOfRange, "Negative number of elements" );
3137
3138 fmt_pair_count = icvDecodeFormat( dt, fmt_pairs, CV_FS_MAX_FMT_PAIRS );
3139
3140 if( !len )
3141 return;
3142
3143 if( !data0 )
3144 CV_Error( CV_StsNullPtr, "Null data pointer" );
3145
3146 if( fmt_pair_count == 1 )
3147 {
3148 fmt_pairs[0] *= len;
3149 len = 1;
3150 }
3151
3152 for(;len--;)
3153 {
3154 for( k = 0; k < fmt_pair_count; k++ )
3155 {
3156 int i, count = fmt_pairs[k*2];
3157 int elem_type = fmt_pairs[k*2+1];
3158 int elem_size = CV_ELEM_SIZE(elem_type);
3159 const char* data, *ptr;
3160
3161 offset = cvAlign( offset, elem_size );
3162 data = data0 + offset;
3163
3164 for( i = 0; i < count; i++ )
3165 {
3166 switch( elem_type )
3167 {
3168 case CV_8U:
3169 ptr = icv_itoa( *(uchar*)data, buf, 10 );
3170 data++;
3171 break;
3172 case CV_8S:
3173 ptr = icv_itoa( *(char*)data, buf, 10 );
3174 data++;
3175 break;
3176 case CV_16U:
3177 ptr = icv_itoa( *(ushort*)data, buf, 10 );
3178 data += sizeof(ushort);
3179 break;
3180 case CV_16S:
3181 ptr = icv_itoa( *(short*)data, buf, 10 );
3182 data += sizeof(short);

Callers 9

icvWriteMatFunction · 0.85
icvWriteMatNDFunction · 0.85
icvWriteSparseMatFunction · 0.85
icvWriteImageFunction · 0.85
icvWriteHeaderDataFunction · 0.85
icvWriteSeqFunction · 0.85
icvWriteGraphFunction · 0.85
writeRawMethod · 0.85
icvWriteHistFunction · 0.85

Calls 7

icvDecodeFormatFunction · 0.85
cvAlignFunction · 0.85
icv_itoaFunction · 0.85
icvFloatToStringFunction · 0.85
icvDoubleToStringFunction · 0.85
icvXMLWriteScalarFunction · 0.85
icvYMLWriteFunction · 0.85

Tested by

no test coverage detected