Assigns new value to specifed element of 2D array
| 2181 | |
| 2182 | // Assigns new value to specifed element of 2D array |
| 2183 | CV_IMPL void |
| 2184 | cvSet2D( 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 |
nothing calls this directly
no test coverage detected