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

Function cvSet2D

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

Assigns new value to specifed element of 2D array

Source from the content-addressed store, hash-verified

2181
2182// Assigns new value to specifed element of 2D array
2183CV_IMPL void
2184cvSet2D( CvArr* arr, int y, int x, CvScalar scalar )
2185{
2186 int type = 0;
2187 uchar* ptr;
2188
2189 if( CV_IS_MAT( arr ))
2190 {
2191 CvMat* mat = (CvMat*)arr;
2192
2193 if( (unsigned)y >= (unsigned)(mat->rows) ||
2194 (unsigned)x >= (unsigned)(mat->cols) )
2195 CV_Error( CV_StsOutOfRange, "index is out of range" );
2196
2197 type = CV_MAT_TYPE(mat->type);
2198 ptr = mat->data.ptr + (size_t)y*mat->step + x*CV_ELEM_SIZE(type);
2199 }
2200 else if( !CV_IS_SPARSE_MAT( arr ))
2201 ptr = cvPtr2D( arr, y, x, &type );
2202 else
2203 {
2204 int idx[] = { y, x };
2205 ptr = icvGetNodePtr( (CvSparseMat*)arr, idx, &type, -1, 0 );
2206 }
2207 cvScalarToRawData( &scalar, ptr, type );
2208}
2209
2210
2211// Assigns new value to specifed element of 3D array

Callers

nothing calls this directly

Calls 3

cvPtr2DFunction · 0.85
icvGetNodePtrFunction · 0.85
cvScalarToRawDataFunction · 0.85

Tested by

no test coverage detected