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

Function cvSetReal1D

deps/opencv/modules/core/src/array.cpp:2244–2275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2242
2243
2244CV_IMPL void
2245cvSetReal1D( CvArr* arr, int idx, double value )
2246{
2247 int type = 0;
2248 uchar* ptr;
2249
2250 if( CV_IS_MAT( arr ) && CV_IS_MAT_CONT( ((CvMat*)arr)->type ))
2251 {
2252 CvMat* mat = (CvMat*)arr;
2253
2254 type = CV_MAT_TYPE(mat->type);
2255 int pix_size = CV_ELEM_SIZE(type);
2256
2257 // the first part is mul-free sufficient check
2258 // that the index is within the matrix
2259 if( (unsigned)idx >= (unsigned)(mat->rows + mat->cols - 1) &&
2260 (unsigned)idx >= (unsigned)(mat->rows*mat->cols))
2261 CV_Error( CV_StsOutOfRange, "index is out of range" );
2262
2263 ptr = mat->data.ptr + (size_t)idx*pix_size;
2264 }
2265 else if( !CV_IS_SPARSE_MAT( arr ) || ((CvSparseMat*)arr)->dims > 1 )
2266 ptr = cvPtr1D( arr, idx, &type );
2267 else
2268 ptr = icvGetNodePtr( (CvSparseMat*)arr, &idx, &type, -1, 0 );
2269
2270 if( CV_MAT_CN( type ) > 1 )
2271 CV_Error( CV_BadNumChannels, "cvSetReal* support only single-channel arrays" );
2272
2273 if( ptr )
2274 icvSetReal( value, ptr, type );
2275}
2276
2277
2278CV_IMPL void

Callers

nothing calls this directly

Calls 3

cvPtr1DFunction · 0.85
icvGetNodePtrFunction · 0.85
icvSetRealFunction · 0.85

Tested by

no test coverage detected