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

Function cvPtrND

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

Returns pointer to specified element of n-d array

Source from the content-addressed store, hash-verified

1871
1872// Returns pointer to specified element of n-d array
1873CV_IMPL uchar*
1874cvPtrND( const CvArr* arr, const int* idx, int* _type,
1875 int create_node, unsigned* precalc_hashval )
1876{
1877 uchar* ptr = 0;
1878 if( !idx )
1879 CV_Error( CV_StsNullPtr, "NULL pointer to indices" );
1880
1881 if( CV_IS_SPARSE_MAT( arr ))
1882 ptr = icvGetNodePtr( (CvSparseMat*)arr, idx,
1883 _type, create_node, precalc_hashval );
1884 else if( CV_IS_MATND( arr ))
1885 {
1886 CvMatND* mat = (CvMatND*)arr;
1887 int i;
1888 ptr = mat->data.ptr;
1889
1890 for( i = 0; i < mat->dims; i++ )
1891 {
1892 if( (unsigned)idx[i] >= (unsigned)(mat->dim[i].size) )
1893 CV_Error( CV_StsOutOfRange, "index is out of range" );
1894 ptr += (size_t)idx[i]*mat->dim[i].step;
1895 }
1896
1897 if( _type )
1898 *_type = CV_MAT_TYPE(mat->type);
1899 }
1900 else if( CV_IS_MAT_HDR(arr) || CV_IS_IMAGE_HDR(arr) )
1901 ptr = cvPtr2D( arr, idx[0], idx[1], _type );
1902 else
1903 CV_Error( CV_StsBadArg, "unrecognized or unsupported array type" );
1904
1905 return ptr;
1906}
1907
1908
1909// Returns specifed element of n-D array given linear index

Callers 9

matrix.cppFile · 0.85
icvReadSparseMatFunction · 0.85
cvGetNDFunction · 0.85
cvGetRealNDFunction · 0.85
cvSetNDFunction · 0.85
cvSetRealNDFunction · 0.85
cvClearNDFunction · 0.85
cvCompareHistFunction · 0.85
cvCalcArrHistFunction · 0.85

Calls 2

icvGetNodePtrFunction · 0.85
cvPtr2DFunction · 0.85

Tested by

no test coverage detected